PDA

View Full Version : Textures



CyBBe
08-13-2000, 12:46 AM
I've done a 256x256x32 Targa image where I've just done a Cloud effect in Photoshop, it looks like hell in my game, in photoshop it looks nice, but in my game its about 6 different colors...

If any of you ever played ProMode mod to Q3, their first version background had this problem/effect to...

Whats wrong?

Bob
08-13-2000, 03:38 AM
This is the problem with specifying only GL_RGB (or whatever) as internal format when uploading the texture. The OpenGL-specs says that (among a few other constants) GL_RGB is a constant that only tells OpenGL to use red, green and blue components, but it does NOT tell you HOW MANY bits for each component, this is up to the driver to choose (probably some default set by the one who wrote the driver).

Using GL_RGB when uploading the texture can mean quite a few different combinations. One implementation can interpret this as GL_R5G5B6 (meaning 5 bits per component, taking two bytes per pixel), or maybe even GL_R16G16B16 (yes, TWO bytes per component, with a total of SIX bytes per pixel). So your driver probably chooses some pixelformat with less acuracy.

To solve these kind of problem, you should use the constats specifying a predefined set of bits, like the ones i mentioned above.

The other constans that is used like this is constans like GL_RGB, GL_RGBA, GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA, and maybe a few more.

Marc
08-14-2000, 03:04 AM
Had the same problem. I come to it because the VC (5) documentation is not correct or at least complete at this point. By choosing GL_RGB or GL_RGBA I got a 16bit texture format, which means all components are packed together to 16 bits (urgh) (more exactly the documentation names the 3rd parameter of glTexImage2D 'components' which should specify the number of color components (1 to 4), but there are a lot of other constants with symbolic names like...). The Way out of this was to set the 3rd parameter of glTexImage2D to GL_RGB8 or GL_RGBA8. This way you get 8bit precision for every color component of the pixel (24 bits for RGB and 32 bits for RGBA).
Hope it helps.

Marc

CyBBe
08-14-2000, 04:46 AM
thanx, It was the solution...