Jump to content
  • Advertisement
Sign in to follow this  
animeaholic

OpenGL glGetIntergerv and glGetError behaving badly

This topic is 4332 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'm trying to use glGetIntegerv to get the number of bit planes for the color GL_BLUE_BITS, GL_GREEN_BITS, GL_RED_BITS, but whenever I pass an integer to this, it doesn't change my value. Also when I try to use glGetError() to get the error string, it never properly clears the error, so running a loop to clear them results in an infinite loop. Oddly enough, before opengl even opens I have an invalid operation on my hands. Here's the code for the two parts I've been using: GLint red, green, blue; GLenum tempError; red = green = blue = 0; while ( (tempError = glGetError()) != GL_NO_ERROR ) cerr << gluErrorString(tempError) << endl; glGetIntegerv(GL_RED_BITS, &red); glGetIntegerv(GL_BLUE_BITS, &blue); glGetIntegerv(GL_GREEN_BITS, &green); As I said before, even if I haven't run a single opengl command, I get an infinite amount of errors, and if I remove the error string, the glGetIntegerv call doesn't work (even though it works with the enum GL_DRAW_BUFFER). I'm wondering if this is a windows related problem, because I've compiled it using the WINAPI's version of openGL built using visual studio and cygwin's version using gcc (currently using Windows XP SP2 Professional, the latest Cygwin). If anyone can help that'd be great.

Share this post


Link to post
Share on other sites
Advertisement
You cannot call ANY OpenGL function until the rendering context is created. You must create it first, and only then can you make sense of any calls to OpenGL. So glGetError returning an error even before the window is created makes perfect sense.

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!