Answer the question
In order to leave comments, you need to log in
How to draw in two windows in OpenGL?
I am writing a game engine. The structure is approximately the following: there is a Core class, an object of which is created at the beginning of the program, modules (heirs of the Module class) are connected to it, modules have Workers that can be registered in Core for periodic processing. Modules are all equal, but Workers are divided into regular ones (they may have priority and some other settings that don’t really matter now) and graphic ones, this was done to organize the game cycle, so that Workers with physics game logic are processed first, etc. etc., and after - graphic and all this in a cycle.
So, I sketched a graphical module GLFWOpenGLModule, which, as the name implies, uses OpenGL and the GLFW library to create a window and draw on it, but GLFW is made in such a way that it can’t work in two windows at once (maybe I searched badly, but not found out how to do it).
You can make the GLFWOpenGLModule class a singleton, like so:
static int objectsCount = 0;
objectsCount++;
if (objectsCount > 1)
throw SomeKindOfException("error message");
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question