Sign in to follow this  
FXACE

Important questions about GLSL geometry shaders

Recommended Posts

Hi everybody! I have started to use geometry shaders fully in my projects. I have done some experiments with so I have these questions:

1. What shader executing first? (vertex shader or geometry shader)

-> if geometry shader then, Is it true that all gl_PositionIn[] are already projected to window coordinate system?  If yes, can I set the instruction which wouldn't multiply to "mvp" matrix? (I mean gl_PositionIn[] equals to gl_Vertex)

2. Can I use texture samplers in geometry shaders? (Because in vertex shader all "textureX" calls always returns vec4(0.0). If you know how to fix this I would be glad to see that)

3. Does geometry shader executes when primitive drawing rules done? (even if I use VAO or VBO?)




Share this post


Link to post
Share on other sites
1. Vertex shader executes before OpenGL - section 2.4, page 32-35 in http://www.opengl.org/registry/doc/glspec41.core.20100725.pdf
2. Yes, you can use samplers in all shaders - vertex, geometry shader and fragment.
3. What is "primitive drawing rule" ? It doesn't matter for geometry shader if you use VBO, VAO or immediate mode. If it is enabled, it will execute.

Share this post


Link to post
Share on other sites
Thanks for reply, MartinsM... This link is useful. :)

[quote name='MartinsM' timestamp='1306167323' post='4814632']


3. What is "primitive drawing rule" ? It doesn't matter for geometry shader if you use VBO, VAO or immediate mode. If it is enabled, it will execute.
[/quote]

I mean "shaders are executing each 3-rd glVertex call (when drawing mode is GL_TRIANGLES) or after glEnd call? (if considering VBO/VAO as operation passed by glBegin/glEnd)". But, never mind, I found the answer for it. (gl_VerticesIn with drawing mode GL_TRIANGLES always equals 3 if I'm right).





[quote name='MartinsM' timestamp='1306167323' post='4814632']


2. Yes, you can use samplers in all shaders - vertex, geometry shader and fragment.

[/quote]

1. Is there an example of using samplers by vertex shader (GLSL) on the internet? because as I said I had a problem with. Maybe, I missed something...




2. Can somebody introduce me an image of how the processing pipeline of using geometry shaders to be sure "how it works" for 99%? please... :)







Share this post


Link to post
Share on other sites
Using a texture in a VS
http://opengl.org/wiki/Vertex_Texture_Fetch

http://opengl.org/wiki/Geometry_Shaders
but not much detail there. Check out nVidia's SDK since I had seen an example there.

Share this post


Link to post
Share on other sites
[quote name='V-man' timestamp='1307477139' post='4820665']
Using a texture in a VS
[url="http://opengl.org/wiki/Vertex_Texture_Fetch"]http://opengl.org/wi...x_Texture_Fetch[/url]

[url="http://opengl.org/wiki/Geometry_Shaders"]http://opengl.org/wi...eometry_Shaders[/url]
but not much detail there. Check out nVidia's SDK since I had seen an example there.
[/quote]
Thanks for links, V-Man. I would check them out.




Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this