Thread: [PyOpenGL-Users] Depth buffers and GLSL
Brought to you by:
mcfletch
From: James G. <ja...@ja...> - 2012-02-24 13:03:35
|
Sorry for spamming the list, but I've seem to find another problem with my code. I can't seem to get depth test to work. I've checked all the usual suspects -- glEnable, glut is allocating the depth buffer. I'm using almost exclusively glsl 1.1 (no fixed function commands) -- is there something I must do in the shaders themselves in order to get depth test to work? Thanks in advance! -James |
From: Ian M. <geo...@gm...> - 2012-02-24 15:44:22
|
On Fri, Feb 24, 2012 at 6:03 AM, James Gao <ja...@ja...> wrote: > Sorry for spamming the list, but I've seem to find another problem with my > code. I can't seem to get depth test to work. I've checked all the usual > suspects -- glEnable, glut is allocating the depth buffer. I'm using almost > exclusively glsl 1.1 (no fixed function commands) -- is there something I > must do in the shaders themselves in order to get depth test to work? You can write to gl_DepthCoord, but typically this is implicitly done as glFragCoord.z. Can we see code? |
From: James G. <ja...@ja...> - 2012-02-24 19:32:52
|
I did try to write to gl_FragDepth, but it had no effect... Here's some trimmed test code: http://pastebin.com/YD9pu0TU Basically, I draw two planes -- a red one fairly close, and a blue one that should be completely occluded by the red plane. As you can see in the demo though, the blue one still gets drawn on top of the red one... On Fri, Feb 24, 2012 at 7:43 AM, Ian Mallett <geo...@gm...> wrote: > On Fri, Feb 24, 2012 at 6:03 AM, James Gao <ja...@ja...> wrote: > >> Sorry for spamming the list, but I've seem to find another problem with >> my code. I can't seem to get depth test to work. I've checked all the usual >> suspects -- glEnable, glut is allocating the depth buffer. I'm using almost >> exclusively glsl 1.1 (no fixed function commands) -- is there something I >> must do in the shaders themselves in order to get depth test to work? > > You can write to gl_DepthCoord, but typically this is implicitly done as > glFragCoord.z. > > Can we see code? > |
From: Alejandro S. <as...@gm...> - 2012-02-24 20:17:50
|
Dear James, It seems to me that you should trying creating your window _after_ having initialized GLUT, otherwise your GL configuration is being set before having an actual OpenGL Context. Hope this helps. Alejandro.- 2012/2/24 James Gao <ja...@ja...> > I did try to write to gl_FragDepth, but it had no effect... Here's some > trimmed test code: http://pastebin.com/YD9pu0TU > Basically, I draw two planes -- a red one fairly close, and a blue one > that should be completely occluded by the red plane. As you can see in the > demo though, the blue one still gets drawn on top of the red one... > > > On Fri, Feb 24, 2012 at 7:43 AM, Ian Mallett <geo...@gm...> wrote: > >> On Fri, Feb 24, 2012 at 6:03 AM, James Gao <ja...@ja...> wrote: >> >>> Sorry for spamming the list, but I've seem to find another problem with >>> my code. I can't seem to get depth test to work. I've checked all the usual >>> suspects -- glEnable, glut is allocating the depth buffer. I'm using almost >>> exclusively glsl 1.1 (no fixed function commands) -- is there something I >>> must do in the shaders themselves in order to get depth test to work? >> >> You can write to gl_DepthCoord, but typically this is implicitly done as >> glFragCoord.z. >> >> Can we see code? >> > > > > ------------------------------------------------------------------------------ > Virtualization & Cloud Management Using Capacity Planning > Cloud computing makes use of virtualization - but cloud computing > also focuses on allowing computing to be delivered as a service. > http://www.accelacomm.com/jaw/sfnl/114/51521223/ > _______________________________________________ > PyOpenGL Homepage > http://pyopengl.sourceforge.net > _______________________________________________ > PyOpenGL-Users mailing list > PyO...@li... > https://lists.sourceforge.net/lists/listinfo/pyopengl-users > > -- http://alejandrosegovia.net |
From: Alejandro S. <as...@gm...> - 2012-02-24 20:19:34
|
Ahh, nevermind, I just realized you are taking that into account. 2012/2/24 Alejandro Segovia <as...@gm...> > Dear James, > > It seems to me that you should trying creating your window _after_ having > initialized GLUT, otherwise your GL configuration is being set before > having an actual OpenGL Context. > > Hope this helps. > > Alejandro.- > > 2012/2/24 James Gao <ja...@ja...> > >> I did try to write to gl_FragDepth, but it had no effect... Here's some >> trimmed test code: http://pastebin.com/YD9pu0TU >> Basically, I draw two planes -- a red one fairly close, and a blue one >> that should be completely occluded by the red plane. As you can see in the >> demo though, the blue one still gets drawn on top of the red one... >> >> >> On Fri, Feb 24, 2012 at 7:43 AM, Ian Mallett <geo...@gm...>wrote: >> >>> On Fri, Feb 24, 2012 at 6:03 AM, James Gao <ja...@ja...> wrote: >>> >>>> Sorry for spamming the list, but I've seem to find another problem with >>>> my code. I can't seem to get depth test to work. I've checked all the usual >>>> suspects -- glEnable, glut is allocating the depth buffer. I'm using almost >>>> exclusively glsl 1.1 (no fixed function commands) -- is there something I >>>> must do in the shaders themselves in order to get depth test to work? >>> >>> You can write to gl_DepthCoord, but typically this is implicitly done as >>> glFragCoord.z. >>> >>> Can we see code? >>> >> >> >> >> ------------------------------------------------------------------------------ >> Virtualization & Cloud Management Using Capacity Planning >> Cloud computing makes use of virtualization - but cloud computing >> also focuses on allowing computing to be delivered as a service. >> http://www.accelacomm.com/jaw/sfnl/114/51521223/ >> _______________________________________________ >> PyOpenGL Homepage >> http://pyopengl.sourceforge.net >> _______________________________________________ >> PyOpenGL-Users mailing list >> PyO...@li... >> https://lists.sourceforge.net/lists/listinfo/pyopengl-users >> >> > > > -- > http://alejandrosegovia.net > > -- http://alejandrosegovia.net |
From: James G. <ja...@ja...> - 2012-02-25 00:50:07
|
Well, it seems that I've solved my own problem! I turns out that I had a very subtle bug in my perspective function, and it was giving me incorrect values for the projection. Hence, the depth buffer was active and working, but the depth values were incorrect, which is why it appeared that the depth buffer wasn't running... On Fri, Feb 24, 2012 at 5:03 AM, James Gao <ja...@ja...> wrote: > Sorry for spamming the list, but I've seem to find another problem with my > code. I can't seem to get depth test to work. I've checked all the usual > suspects -- glEnable, glut is allocating the depth buffer. I'm using almost > exclusively glsl 1.1 (no fixed function commands) -- is there something I > must do in the shaders themselves in order to get depth test to work? > > Thanks in advance! > > -James > |