Jump to content
  • Advertisement
Sign in to follow this  
Leonard_E

Same Content n-Windows

This topic is 2856 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,

is it possible to render the some context in two different windows? The way I do right now:

int main(int argc, char **argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);

window1 = glutCreateWindow("Window 1");
glutPositionWindow(0, 0);
glutDisplayFunc(display);

init();

window2 = glutCreateWindow("Window 2");
glutPositionWindow(400, 0);

glutDisplayFunc(display);

init();
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}


In the display-callback I also call glutSwapBuffer(). So again the question how can I visualize the same scene into both windows without render the whole scene twice?

Cheers
Lasse

[Edited by - Leonard_E on August 24, 2010 10:26:42 AM]

Share this post


Link to post
Share on other sites
Advertisement
Right off the bat, I will say I don't have a lot of experience with OpenGL (or DirectX), and no experience with Glut, so keep that in mind as you read this.

One way I can see it technically being done is to write your own function, one that is aware of your two windows, and it calls the display function. The display function won't call the glutSwapBuffer() anymore but, instead, it just stores the rendered frame. Now, in your function you use the glMakeCurrent() and output the rendered frame to each window. Of course, this might require having a second copy of the buffer because, I assume (remember not a lot of experience), that glutSwapBuffer() does just that and your newly rendered frame will be replaced with the old one.

I might be way off, that's just what came to my mind, initially

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!