PDA

View Full Version : cannot turn off GL_RASTERIZER_DISCARD ?



somboon
07-20-2010, 12:46 AM
I have noticed that glDisable(GL_RASTERIZER_DISCARD); will not take any effect until I rebind target draw buffer.

The thing is I try to use glEnable(GL_RASTERIZER_DISCARD); in transform feedback code that have to be call every time I render an object

The transform feedback code is for camera-Z calculation for sorting transparent polygon since the same mesh maybe drawn on screen at many different position at the same time , the TF cannot be done as a preprocessing (there only one structure per mesh to store transformed Z for the said mesh).

The problem is after calling glEnable(GL_RASTERIZE_DISCARD) even if I try to turn the discarding off by calling glDisable(GL_RASTERIZE_DISCARD) any thing render after that will not write to target draw buffer unless I rebind the draw buffer first.



1 . bind target draw buffer
2 . call glEnable(GL_RASTERIZE_DISCARD);
3 . do TF (actually even if I didnt do TF the result are the same)
4 . call glDisable(GL_RASTERIZE_DISCARD);
5 . render a BOX


with the code above a box will not get render even after calling glDisable(GL_RASTERIZE_DISCARD); but if I rebind target drawbuffer before render a box , it render fine

Can anyone familiar with this feature give me some info on this ?

Using OpenGL 3.2 core profile on ATI HD4670 with catalyst 10.6.

vindoctor2
12-14-2010, 01:53 AM
Did you ever get this working? I'm having issues with GL_RASTERIZER_DISCARD/transform buffer as well. Things work perfectly on an NVIDIA card. I'm using opengl 330 core shaders. Did you check your glerror? I've found that my drawelements generates an error. One may think that comment is strange, but with ATI hardware I've had shaderes compile ok, but then gldrawelements generates an error due to something about the shader... time for a test/example app I guess...but I see you are doing something similar and wanted to see how you made out.

aqnuep
12-14-2010, 08:23 AM
I used RASTERIZER_DISCARD with success on an ATI 2600 and 5770 with Catalyst version 10.4 to 10.10.


One may think that comment is strange, but with ATI hardware I've had shaderes compile ok, but then gldrawelements generates an error due to something about the shader
This is quite possible as during implicit Begin (e.g. because of DrawElements) the shader has to be validated and this step may find some problems with it (due to other state settings that cannot be detected up front during compilation).