DevIL/ILUT Poor Texture Quality - General GLUT Texture Quality

Started by
4 comments, last by V-man 15 years, 9 months ago
I have noticed that the quality of my texture is not any where as good once loaded into my game. I use something like this to load my texture: -
ilInit() ;
iluInit() ;
ilutRenderer( ILUT_OPENGL ) ;
ILuint image ;
ilGenImages( 1, &image ) ;
ilBindImage( image ) ;
if( ilLoadImage(filename) )
{
   GLuint texture = ilutGLBindTexImage() ;
}
ilDeleteImages(1, &image) ;
The texture is used for a large terrain map, so it is "stretched" over many triangles. This is the source texture: - This what it looks like once it is applied as a texture: - I have tried playing around with glTexParameter to no avail. I don't know if the solution lies in ILUT or GLUT... I have looked through the ILUT documentation, and also played around with iluBuildMipmaps, but I don't know if that's what's needed or if I'm using it correctly. (Calling iluBuildMipmaps() just after calling ilutGLBindTexImage()) What can I do to increase the quality of the texture? Note that the enum "GL_TEXTURE_LOD_BIAS" does not compile - an error occurs explaining that it has not been defined. Thanks for any help If this helps, my extensions string includes: - GL_ARB_depth_texture GL_ARB_shadow GL_EXT_texture_lod
GLUT Setup: -Dev C++ 4.9.9.2GPU: GeForce 7600GT (256mb)CPU: Core 2 Due 1.86RAM: 1Gig
Advertisement
Ok, I've played around with the following: -

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST) ; glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST) ;

and

glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ) ;
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ) ;

The terrain texture is a 2500 x 2500 pixel bitmap (17.8 MB) - (the "source texture" shown in my previous post was a small sample of the whole texture)
The small coloured square is a 4 x 4 pixel jpeg ( 1.6 KB )

This is with LINEAR: -


This is with NEAREST: -


All screenshots can be found here.

Regarding the large terrain texture... is there a limit to the size of a texture? It seems like the true texture resolution is not being represented in-game. How do I achieve a highly detailed terrain texture?
GLUT Setup: -Dev C++ 4.9.9.2GPU: GeForce 7600GT (256mb)CPU: Core 2 Due 1.86RAM: 1Gig
What hardware are you on? GF8 series has 8192x8192 support. You can query the hardware to see what the max texture size is as so...

int maxtexturesize = 0;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxtexturesize);

How large is your terrain mesh? If it really large you will need to tile the textures so they repeat. You do this with shaders, or GL_REPEAT with the FFP, and make sure you modify the texture coordinates to however many times you want the texture repeated. Unless you have a NPOT texture support on your card, GL2.0 I think is required for this, some ATI cards last I checked didn't have support for it, you should resize the texture to a POT size. 2048x2048.
With the various calls to glGetString and MARS_999's max texture retrieval, I get this: -

Vendor : NVIDIA Corporation
Renderer : GeForce 7600 GT/PCI/SSE2
Version : 2.1.2
Max Texture size : 4096


If I wanted a really detailed terrain, I would have to use many different textures and tile them across it...?

In game, the size of the map is 680 x 800 (OpenGL units), although, this is very likely to change (I have a vector of vectors storing the map data).
GLUT Setup: -Dev C++ 4.9.9.2GPU: GeForce 7600GT (256mb)CPU: Core 2 Due 1.86RAM: 1Gig
If you want detailed terrain you will need to use many texture types, and you will need to look into Charles Blooms "Texture Splatting". You may also want to look at using a detailed texture to modulate over the terrain to add a bit of detail also.
To me, the texture on your terrain looked like a 128x128 texture. Perhaps you shouldn't use ILUT and look for an alternative or just use IL to get the pixels and upload to GL by yourself.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

This topic is closed to new replies.

Advertisement