Registriert: Di Jul 01, 2003 18:59 Beiträge: 887 Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
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?
Registriert: Mo Sep 23, 2002 19:27 Beiträge: 5812
Programmiersprache: C++
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:
// Activate first RC
ActivateRenderingContext(DC1, RC1);
// Render your first scene
SwapBuffers(DC1);
DeActivateRenderingContext;
...
// Activate second RC
ActivateRenderingContext(DC2, RC2);
// Render your second scene
SwapBuffers(DC2);
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.
Registriert: Di Jul 01, 2003 18:59 Beiträge: 887 Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
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.
Registriert: Di Jul 01, 2003 18:59 Beiträge: 887 Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
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.
Mitglieder in diesem Forum: 0 Mitglieder und 1 Gast
Du darfst keine neuen Themen in diesem Forum erstellen. Du darfst keine Antworten zu Themen in diesem Forum erstellen. Du darfst deine Beiträge in diesem Forum nicht ändern. Du darfst deine Beiträge in diesem Forum nicht löschen. Du darfst keine Dateianhänge in diesem Forum erstellen.