2

I work with Qt5 and must code something like simple 3D-editor. I need to have 4 projection-views in my main window (for different scene-projections). I saw OpenGLWindow example, but there was only one window and i don't know how to modify it for my purpose.

There are next lines in example.

class OpenGLWindow : public QWindow, protected QOpenGLFunctions { ........ private: QOpenGLContext *m_context; }

As Assistant says, QOpenGLContext can draw only on QSufrace, which is direct base of QWindow.

So, how can I put several projection-views on one MainWindow.

I need tools, contained in QOpenGLFunctions.

1 Answer 1

1

You only need to have one QOpenGLContext. Drawing multiple views is usually done by like this:

//Top Left
glViewport (0, windowHeight/2, windowWidth/2, windowHeight/2);
draw();

//Top Right
glViewport (windowWidth/2, windowHeight/2, windowWidth/2, windowHeight/2);
draw();

//Bottom Right
glViewport (windowWidth/2, 0, windowWidth/2, windowHeight/2); 
draw();

//Bottom Left
glViewport (0, 0, windowWidth/2, windowHeight/2);
draw();
Sign up to request clarification or add additional context in comments.

2 Comments

hmmm, thanks, i thought about this idea. can you tell me where can i find some example for this ?
example isn't necessary more, i've found out how to do that)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.