Jump to content
  • Advertisement
Sign in to follow this  
C0D1F1ED

OpenGL Functions depending on the Rendering Contex

This topic is 4794 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 all, I've been playing around with OpenGL a bit lately, and I wonder how rendering contexts really work (DirectX doesn't really have such thing). In particular, what OpenGL function can work without an active rendering context (if any)? I'd like to know because glGetError keeps returning GL_INALID_OPERATION and it seems to originate from my init code... Thanks for any help! c0d1f1ed

Share this post


Link to post
Share on other sites
Advertisement
I don't know that any OpenGL function will really work without a valid RC. You may be able to get away with a few innocuous state changes, but nothing useful. I suppose it depends on the driver.

As for your init code problem, unless you want to post some source I guess the best thing I can suggest is to do a ton of error checking in the init code. I found it useful in the beginning to scatter my init code with message boxes that would pop up whenever there was an error or function that didn't return the expected value.

Oh, and DirectX certainly USES render contexts, it simply hides them from view. (Which isn't really a bad thing...) A render context is required to draw to a win32 window.

Share this post


Link to post
Share on other sites
the context needs to be valid if u wanna use opengl commands if u wanna query something quickly jjust create a dummy window and query various opengl stuff and then destroy it again (this is what i do) the user never sees it + take practically no time
for finding out where your errors are download glintercept this program (which runs the same time as your app) will tell u exactlly which lines of code cause the gl errors (as well as a lot more stuff)

Share this post


Link to post
Share on other sites
Thanks for the quick information!

I copied my init code from NeHe. It seems that Lesson 5 also has this problem. When choosing to run fullscreen, it calls glViewport before creating the render context. This happens because the window procedure recieves the WM_SIZE message.

So, is this correct behaviour (the GL is expected to ignore the calls), or should we make sure the render context is created before calling any other functions?

Thanks again,

c0d1f1ed

Share this post


Link to post
Share on other sites
Quote:
Original post by C0D1F1ED
So, is this correct behaviour (the GL is expected to ignore the calls), or should we make sure the render context is created before calling any other functions?
Generaly good coding practice, checking anything for validity avoids bugs and false alarms [smile]

Share this post


Link to post
Share on other sites
Quote:
I copied my init code from NeHe. It seems that Lesson 5 also has this problem

perhaps have a look at sdl www.libsdl.org it most likely has a more stable/trustworthy implementation

Share this post


Link to post
Share on other sites
Microsoft has some documentation on MSDN that discusses Rendering Contexts. Here's the link:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/devcons_0g6r.asp

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!