dimanche 18 juin 2017

How to draw in two windows using OpenGL?

I make game engine. The structure is as follow: There is Core class which object creates at start of program, modules(class Module) join to core and have workers(class Worker). Workers divided into two types: normal and graphical. I made it for game loop organization.

So, I create GLFWOpenGLModule, which, as the name suggests, use GLFW for creating of window and OpenGL for drawing in this window. But GLFW doesn't allow to create two windows and draw in each of them. I can make GLFWOpenGLModule singleton by adding this code:

static int objectsCount = 0;
objectsCount++;
if (objectsCount > 1)
   throw SomeKindOfException("error message");

in constructor and not create two windows in module, but then I can't make two windows(for example for rendering multiple cameras, each camera in each window). How should I do in this case? Maybe I should use another library instead of GLFW?

Aucun commentaire:

Enregistrer un commentaire