Jump to content
  • Advertisement
Sign in to follow this  

OpenGL wglSetCurrent() and render to texture fails

This topic is 1281 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'm trying to render with OpenGL 3.3 into multiple windows.

The technique I'm using at the moment is to use only one context, and switch target windows.


On win32, what I did so far is something like this:



- Create main context with a dummy, invisible window (HWND)

- Create one or more visible windows

- Set an OpenGL-compatible pixel format on those windows



- Call wglMakeCurrent() before rendering on any of these windows

- Render (OpenGL calls)

- After rendering, call SwapBuffer on every window



My first test only targets one window, but even then I don't see anything, the screen stays black sad.png

If I resize the window, I see the clear color appear, but nothing more.


However, if I bypass post-processing effects (working with render to textures) during execution with a shortcut, I see my animated scene blink.png

Once I re-enable effects, I see two static frames flickering rapidly: one with the effects, the other without. Both don't animate.



My application worked perfectly fine before I introduced this multi-window technique, and I get no errors so far...

I previously tried with shared contexts, but got the same weird result.


So... I'm wondering, do I missed something about render to textures?



Note: I'm using raw win32 and OpenGL with Glew, no other libraries involved.


EDIT: it's "wglMakeCurrent" for the title of the topic, but I don't know how to change it.

Edited by Zylann

Share this post

Link to post
Share on other sites

Ok, nevermind, I found it. Just forgot to disable depth test before drawing the full-viewport quads on render textures...

Now I know RenderTextures have nothing to do with this :)

Edited by Zylann

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!