Jump to content
  • Advertisement
Sign in to follow this  
Pooya65

OpenGL problem with PNG files and devil

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

hi i have a png file with alpha chanel but i cant use the alpha chanel in opengl in other word all of the transparent pixels shown dark this is my code, where is my problem? ilGenImages (1, &ImgId); ilOriginFunc(IL_ORIGIN_LOWER_LEFT); ilEnable(IL_ORIGIN_SET); ilBindImage (ImgId); ilutGLLoadImage("C:/kge.png"); Width = ilGetInteger(IL_IMAGE_WIDTH); Height = ilGetInteger(IL_IMAGE_HEIGHT); ilConvertImage(IL_RGBA,IL_UNSIGNED_INT); sourcedata = ilGetData(); ilDeleteImages(1, &ImgId); glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); glRasterPos2i(0,0); glDrawPixels(Width ,Height,GL_RGBA,GL_UNSIGNED_INT, sourcedata); and,when i enable blending, any thing dont be shown

Share this post


Link to post
Share on other sites
Advertisement
It depends on what values are present in the alpha, so have a look at sourcedata with a debugger.
Why do you use ilConvertImage(IL_RGBA,IL_UNSIGNED_INT)
instead of just using unsigned bytes?

Share this post


Link to post
Share on other sites
hi
i use ilConvertImage for using all of the components in the png file ( in default devil use RGB)
unsigned int--> 8bits for every component (RGBA) => 32bit(UNSIGNED_INT)

Share this post


Link to post
Share on other sites
unsigned int means that every component will be 32 bit. So each pixel will be 128-bit sized with RGBA.

Share this post


Link to post
Share on other sites
Quote:
Original post by keltarSo each pixel will be 128-bit sized with RGBA.

Exactly.
Besides, why glDrawPixels? It's definetely not the fastest way to do it…
You can draw this image using the texture prepared by ilutGLLoadImage.

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!