PDA

View Full Version : glViewport



jamse101
08-05-2013, 02:24 AM
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.

hlewin
08-05-2013, 09:12 AM
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.

jamse101
08-05-2013, 10:23 PM
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.

jamse101
08-06-2013, 03:33 AM
Ah...the problem was that I'm using two threads and glViewport() had to be called in the rendering thread..