PDA

View Full Version : Geometry shader + transform feedback + triangles



GabrielZ
04-05-2011, 01:34 AM
I have managed to make the example from http://cvit.iiit.ac.in/
work on my Mac (OSX 10.6, Snow Leopard).

I've got a very simple example that just renders 2 points, which works, i.e., I do get the points from the geometry shader in the transform feedback buffer (TFB).
However, basically the same example that renders 2 triangles instead of the points does not work.

You can find the two sample source codes here:
http://zach.in.tu-clausthal.de/tmp/main_points.cpp
http://zach.in.tu-clausthal.de/tmp/main_triangles.cpp
They are both self-contained.

As you can see in the source code, I render two points, have the geometry shader just pass the data through, and capture the geometry shader's output in the TFB. Then, I render the contents of the TFB again.
This works fine.

However, the same procedure, but with triangles instead of points, does not work.

Can you spot anything I did wrong?

Thanks a lot in advance for any kind of insights, pointers, or suggestions!

Best regards,
Gabriel.

PS:
Yes, it has to be GLSL 1.20

zeoverlord
04-05-2011, 06:10 AM
well first of all GL_GEOMETRY_OUTPUT_TYPE_EXT for the geometry shader has to be GL_TRIANGLE_STRIP in this case, The other valid types are GL_POINTS and GL_LINESTRIP
besides from that i cant really see any problem with it directly but i wrote a few tutorial about it, take a look and see if it helps
Geometry shaders part 1 (http://www.flashbang.se/archives/307)
Geometry shaders part 2 (http://www.flashbang.se/archives/315)
Geometry shaders part 3 (http://www.flashbang.se/archives/326)

GabrielZ
04-05-2011, 11:45 PM
Thanks, that was one of the bugs in my code.
There were some more, but now it works.

So, for the record, here is my sample code: http://zach.in.tu-clausthal.de/software/index.html#transform_feedback_buffer

G.