Jump to content
  • Advertisement
Sign in to follow this  
g33rd0

OpenGL JOGL: OpenGL calls outside callback class

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

Using JOGL, you need to implement an interface GLListener, which acts like a set of callback functions for your window (e.g. display, reshape). Apparently, it is not possible to successfully execute ogl-commands from outside this callback class. Am I mistaken here or is there any workaround? The actual problem is, that I'd like to compile my display lists and load my textures in an independent thread in the background, i.e. not at initialization time and not when rendering to the screen. Thanks alot!

Share this post


Link to post
Share on other sites
Advertisement
OpenGL commands can only be made in the thread in which the GL context is active. Jogl enforces this by only allowing GL calls within the listener callback (which is fired in the correct thread). Any calls made outside of the correct thread will fail. IIRC there isn't any workaround for this in Jogl.

You might consider LWJGL, which allows you to manage the context (and the thread it's active in) manually if you want to for this kind of situation.

Share this post


Link to post
Share on other sites
You can call GLContext.makeCurrent()/release() to manually manage your context. YOu will probably run into threading issues so make sure to check the return value of the makeCurrent call.

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!