Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Ilici

GL texture trouble

This topic is 5560 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

when i load a texture with 4 channels (RGBA) with glBuild2dMipmaps the texture looks bad kind of streched and with few colors. but when i load it with 3 channels it looks good. what is the problem ? /*ilici*/

Share this post


Link to post
Share on other sites
Advertisement
Without code it''s hard to say, are you sure the actual image data is RGBA?

Share this post


Link to post
Share on other sites
did you gave the function the right params?


gluBuild2DMipmaps(GL_TEXTURE_2D, !!! 4 !!!, width, height,
!!! GL_RGBA !!!, GL_UNSIGNED_BYTE, rgba_data);

Share this post


Link to post
Share on other sites
this is the code:
glGenTextures(1, &texnum);
glBindTexture(type, texnum);
glTexParameteri(type, GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
glTexParameteri(type, GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR);

gluBuild2DMipmaps(GL_TEXTURE_2D, 4, width, height, GL_RGBA, GL_UNSIGNED_BYTE, TexData)


/*ilici*/

Share this post


Link to post
Share on other sites
dont just use 4 or GL_RGBA, that way you dont even hint the driver about what format you want, its better to use GL_RGBA4 or GL_RGBA8 to ask for 16 and 32 bit format (the driver can ignore, but atleast you give a hint about it).

the stretching part.. chould be that you dont draw it in the same aspect as its in original.

Share this post


Link to post
Share on other sites
the GL_RGBA4 stuff doesn''t work

it works when i use
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, width, height, GL_RGBA, GL_UNSIGNED_BYTE, TexData)

instead of
gluBuild2DMipmaps(GL_TEXTURE_2D, 4, width, height, GL_RGBA, GL_UNSIGNED_BYTE, TexData)

the image is quite streched but this is not a problem because it is a big tex


/*ilici*/

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!