glViewport

I’m trying to render two triangles that will fill the whole window and I have simple pass trough vertex shader:

#version 140

in vec4 vVertex;

void main()
{
gl_Position = vVertex;
}

Then I have the triangles in normalized device coordinates and after first creating the window everything is ok but when I use glViewport in processing of WM_SIZE it doesn’t have any effect…I mean the triangles stay in same size??

I’m using GLEW 1.10.0 as static library and I have opengl32.lib for WGL stuff.

Do you mean in absolute measure - eg compared to the screen - or compared to the window?
I would expect them to fill the whole window if the viewport gets set to (0,0,width,height) on WM_SIZE.

I do glViewport(0, 0, LOWORD(lParam), HIWORD(lParam)) in processing of WM_SIZE and I have:

GLfloat triangles [6][2] = {
{ -1.0, -1.0 },
{ 1.0, -1.0 },
{ -1.0, 1.0 },
{ 1.0, -1.0 },
{ 1.0, 1.0 },
{ -1.0, 1.0 }
};

When I start the program the triangles fill the window but glViewport() in WM_SIZE has no effect.

Ah…the problem was that I’m using two threads and glViewport() had to be called in the rendering thread…

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.