Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Confused about Frustrum and Vertex Shader

  1. #1
    Junior Member Regular Contributor uwi2k2's Avatar
    Join Date
    Mar 2011

    Confused about Frustrum and Vertex Shader

    ---- solved ----

    Hi all,

    i allready work with shaders for some time, but today i am totally confused about a strange beavior.
    I just strted a new opengl project and implemented a simple shader pair...
    I was getting no visible result so i started testing around ..

    In my new setup Project i only get visible output when i set 'gl_Position.z' between -1 and 1
    Code :
    ...// vertex shader last line
     gl_Position.z = -0.2 ; // << works
    gl_Position.z = -1.2 ; // << does not work

    BUT in one of my other Projects i can use larger values and still see the output.
    Code :
    ...// vertex shader last line
     gl_Position.z = -0.2 ; // << works
    gl_Position.z = -8.2 ; // << works as well

    I donīt understand why, cause as i use my onw Programm( shader pair ) and my own matrix fpr perspective
    the opengl frustrum or any other global state should not have any effect on the visible range ( near / far clipping plane ).

    Do in need to set a Frustum when i use shader and my own matrix ?

    Can anyone tell me what i am doing wrong ??
    What is my mistake - have i missunderstood something ??

    thanx a lot !!

    (edit) sorry i just spent 5 min away from the pc and now its all obvious to me.... question solved !
    Last edited by uwi2k2; 02-07-2013 at 09:02 AM.
    uwi2k2 - OpenGL Trainer:
    The OpenGL and VULKAN Podcast ( OpenGL2GO ) : OpenGL & Vulkan Podcast
    --------------------------------------------------------- - Indie TeamUp

  2. #2
    Member Regular Contributor
    Join Date
    Jan 2012
    Hi, / gl_Position.w has to be between -1 and 1. Maybe your w component is >= 8.2 in your second example?

Posting Permissions

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