Answer the question
In order to leave comments, you need to log in
How to make a window resize in OpenGL so that when the window is resized, the image does not scale?
When changing the height of the window, the picture is scaled to fit in the window
to set the scene using the following code
Gl.glViewport(0, 0, simpleOpenGlControl1.Width, simpleOpenGlControl1.Height);
Gl.glMatrixMode(Gl.GL_PROJECTION);
Gl.glLoadIdentity();
Glu.gluPerspective(45.0f,
(float)simpleOpenGlControl1.Width / (float)simpleOpenGlControl1.Height,
0.1f, 100.0f);
Gl.glMatrixMode(Gl.GL_MODELVIEW);
Gl.glLoadIdentity();
Answer the question
In order to leave comments, you need to log in
In general, you need to work with the projection matrix (you have gluPerspective) and glViewport. You can try to put constants at the viewport instead of the width and height of the control.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question