Jump to content
  • Advertisement
Sign in to follow this  
Yhonatan

OpenGL Vbo problem when using 2 windows

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

Hey all,

I've got a certain problem - I'm trying to draw a model using VBO, but on 2 different windows.

what i'm doing is this:
I open 2 windows (win api..) for each I get its Device Context, and create a Rendering Context (for openGL rendering!).

then, each time I recieve WM_PAINT, I draw it this way:


wglMakeCurrent(_mhDC,_mhRC);
...drawing the scene....
SwapBuffers(_mhDC);






_mhDC - is current window Device Context
_mhRC - is current window Rendering Context

Everything works fine if I draw a triangle on each window, BUT
If I use a VBO (even if its only on one window and on the other one I dont draw anything)
my program start running, I see a Window (the other one is covered behind), and when I try to move the window, my program crash.

two more things:
*if I open just 1 window, and draw on it with the vbo, everything works fine.
*if I draw the VBO only at the last opened window, it works. if I change the order, it will crash. For example if I'll open 3 windows ,it must be window number 3.


Any ideas on what could be the problem and how can I solve it?

Thanks in advance!

[Edited by - Yhonatan on October 23, 2010 10:08:31 AM]

Share this post


Link to post
Share on other sites
Advertisement
Well I believe that VBO are per-context, so if you change to a different context you can't render a VBO from the first context.

I did a little googling and this might be your best bet.

http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=238068

I think you might want to make only one rendering context, and then just pass it back and forth between your windows. I don't know much about this though, so maybe that thread can help.

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!