Jump to content
  • Advertisement
Sign in to follow this  
philipptr

Transparency in Opengl-Textures

This topic is 4863 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 started coding a 2d engine in c++ with Sdl and Ogl and wanted to know how to use transparency in Opengl-Textures. I only need completly visible or invisible pixels so im searching for something similar to SDL_SetColorKey(temp, SDL_SRCCOLORKEY, SDL_MapRGB(temp->format, 0, 0, 0)); (I already tried to make the temp-SDL_Surface transparent before converting it but that doesnt seem to work.) Another problem i have would be that SDL uses the Red channel instead of the Blue and the Blue instead of the Red one. ( i use glTexImage2D(GL_TEXTURE_2D, 0, 3, temp->w, temp->h, 0, GL_RGB, GL_UNSIGNED_BYTE, temp->pixels); but GL_BGR doesnt work (`GL_BGR' undeclared (first use this function)).. i appreciate any help :)

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
for your transparency issue: there is a tutorial at nehe which deals with masking. but the easier way would be to use tga textures, you can easily use sdl_image to load it (at least with pygame which is python port of sdl).
for your GL_BGR issue: #define GL_BGR GL_BGR_EXT

Share this post


Link to post
Share on other sites
well it doesnt work with sdl_image so im trying to understand the masking way...

the GL_BGR_EXT thing doesnt work (if i do that and use BGR it says GL_BGR_EXT is undeclared)

Share this post


Link to post
Share on other sites
It should be

#define GL_BGR 0x80E0


or better yet google for a file name 'glext.h' and add it to the opengl include path and then just include it in your project. You'll probably need to use it anyway if you want to use extensions and things like that...

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!