PDA

View Full Version : Confused about Frustrum and Vertex Shader



uwi2k2
02-07-2013, 08:00 AM
---- 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

...// 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.

...// 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 !!
uwi

(edit) sorry i just spent 5 min away from the pc and now its all obvious to me.... question solved !

menzel
02-07-2013, 09:00 AM
Hi,

gl_Position.xyz / gl_Position.w has to be between -1 and 1. Maybe your w component is >= 8.2 in your second example?