Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: glViewport

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2010
    Posts
    9

    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.

  2. #2
    Junior Member Regular Contributor
    Join Date
    Nov 2012
    Location
    Bremen, Germany
    Posts
    149
    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.

  3. #3
    Junior Member Newbie
    Join Date
    Feb 2010
    Posts
    9
    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.

  4. #4
    Junior Member Newbie
    Join Date
    Feb 2010
    Posts
    9
    Ah...the problem was that I'm using two threads and glViewport() had to be called in the rendering thread..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •