Jump to content
  • Advertisement
Sign in to follow this  
SulphurTenM

OpenGL DevIL/ILUT Poor Texture Quality - General GLUT Texture Quality

This topic is 3709 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!