DGL
https://delphigl.com/forum/

more then one opengl rendering context at once?
https://delphigl.com/forum/viewtopic.php?f=19&t=2110
Seite 1 von 1

Autor:  noeska [ Di Okt 28, 2003 19:46 ]
Betreff des Beitrags:  more then one opengl rendering context at once?

I want to use more then one opengl rendering context at once.
But it does not seem to work.
Only the last one rendered is updated. The first one does not update.
The idea i want is a preview window for a mesh before inserting a new mesh into the scene. Without a preview window everything goes ok. But i cannot get back the rendering context anymore. All rendering goes to the preview window, even after it is closed down.

Has anyone ever used more than one opengl rendering context at once?

Autor:  Sascha Willems [ Di Okt 28, 2003 20:02 ]
Betreff des Beitrags: 

Using more than one rendering context in the same app shouldn't make any bigger problems if you keep some things in mind.You most likely need two device contexts and two render contexts (two coherrent DC/RC-pairs) and your code should looke something like this :

Code:
  1. // Activate first RC
  2. ActivateRenderingContext(DC1, RC1);
  3. // Render your first scene
  4. SwapBuffers(DC1);
  5. DeActivateRenderingContext;
  6. ...
  7. // Activate second RC
  8. ActivateRenderingContext(DC2, RC2);
  9. // Render your second scene
  10. SwapBuffers(DC2);
  11. DeActivateRenderingContext;


That should work,and don't forget to call wglShareLists(RC1, RC2) if you want to use the same textures and displaylists in both contexts.

Autor:  noeska [ Mi Okt 29, 2003 19:11 ]
Betreff des Beitrags: 

thanks. I have a look at that angle. I use a opengl class so my idea is that i already use different dc and rc for different instances of that class. But maybe not.

Autor:  Phobeus [ Do Okt 30, 2003 00:57 ]
Betreff des Beitrags: 

Also keep in mind that a template for this situation exists on our page. Have a look at the templates ;)

Autor:  noeska [ Do Okt 30, 2003 19:13 ]
Betreff des Beitrags: 

does the template use a tcustompanel class? I have a look again at the templates.
Also i solved the problem. I forgot to add wglMakeCurrent (dc, hrc); i used it when creating the panel. But when focus has changed to another glpanel i need to call it again.

Autor:  Phobeus [ Do Okt 30, 2003 20:45 ]
Betreff des Beitrags: 

the type of "window" that is used for rendering is nearly unimportant as long as it has some kind of handle the rc can get use ;)

Autor:  noeska [ Do Okt 30, 2003 22:37 ]
Betreff des Beitrags: 

i know, i have been optimizing to much.

Seite 1 von 1 Alle Zeiten sind UTC + 1 Stunde
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/