Jump to content
  • Advertisement
Sign in to follow this  
petercnm

OpenGL glTexImage

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

Hello, i just started using SDL to import my textures, and in a tutorial i come across this : glTexImage2D(GL_TEXTURE_2D, 0, GL_BGR, temp->w, temp->w, 0, GL_RGB, GL_UNSIGNED_BYTE, temp->pixels); when i compile (Dev-CPP), i get "GL_BGR undeclared". Do i miss some special OpenGL librarie or something ? ( GL_RGB works ok). I know i normally have to switch red and blue, but was hoping to make my life easier. Thanks in advance

Share this post


Link to post
Share on other sites
Advertisement
There is no such thing as GL_BGR. Probably an error in the tutorial. GL_RGB is the one you want to use.

EDIT:
Why do you have to switch red and blue?

Share this post


Link to post
Share on other sites
my texture map switches red and blue. Before i came to use SDL, i made my own image loader and there also i had to swap the red and blue pixels.

Share this post


Link to post
Share on other sites
What file format for images are you using? Anyways... when you load the image just put the color components in the right order as in RGB. Then everything should work out fine.

Share this post


Link to post
Share on other sites
Hi,

Its GL_BGR_EXT and you need GL/glext.h for it probably.

glTexImage2D(GL_TEXTURE_2D, 0, 3, temp->w, temp->w, 0, GL_BGR_EXT, GL_UNSIGNED_BYTE, temp->pixels);

Share this post


Link to post
Share on other sites
its part of the core now amd called GL_BGR (no EXT on the end) like others have said u need to included any semi recent glext file or even better use an extension loading library

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!