Jump to content
  • Advertisement
Sign in to follow this  
Sheree

OpenGL Geometry Shader attach error

This topic is 3204 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everybody, I want to use Geometry shader, but it seems that I had misunderstanding of the way of using it. Actually, What I want to do is just getting the visible vertices within Shaders before doing anything with the vertices. Therefore, I found two ways : First: as using two passes of (vertex+Fragment) program where the first is just a filter in which only the vertices within the view frustum are passed and then in the second pass vertices are modified. Here: the question ..is it possible to get only Modelview matrex out of there and check wether the vertex is visible or not and if yes how can I get the only visble vertex? anyone know some information about that like tutorial or may be a simple example. Second : is using two passes one with (vertex+Geometry+Fragment) program where Geometry shader did the task of passing visible vertices and the second as mentioned in First Here: I tried to use only as example passing vertices from vertex to Geometry to Fragment without adding any thing..the problem is that by just using vertex and fragement shaders the program is running well.. but wen I add geometry (attaching it) I got opengl error. my geometry shader looks like : ////////////////////////////////////////////////////////////////// #version 150 #extension GL_EXT_geometry_shader4 : enable void main() { int i; for( i =0; i< gl_VerticesIn; i++){ gl_Position = gl_PositionIn; EmitVertex(); } EndPrimitive(); } and in shader setting : glAttachShader(program,g); glProgramParameteriEXT(program,GL_GEOMETRY_INPUT_TYPE_EXT,GL_POINTS); glProgramParameteriEXT(program,GL_GEOMETRY_OUTPUT_TYPE_EXT,GL_POINTS); int temp; glGetIntegerv(GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT,&temp); glProgramParameteriEXT(program,GL_GEOMETRY_VERTICES_OUT_EXT,temp); /////////////////////////////////////////////////////////////////////// Can you please tell me where I am doing wrong or you may have any comments on the way of solving such problem

Share this post


Link to post
Share on other sites
Advertisement
Hi all,
I think the main opengl error was because I used in my display function (GL_LINES)

and in the setting of input/output Geometry setting (GL_POINTS)/(GL_POINTS)

and the problem is vanished when I just replaced (GL_LINES) by (GL_POINTS)

So.... the question now is : how can I pass vertices cashed in VBO to the

Geometry shader ? is there another token to be used in Geometry input/output

setting other than just(GL_POINTS). In fact, I used just (GL_POINTS) but I got

balck screen... without any errors.

Thanks for any kind of comments.

Share this post


Link to post
Share on other sites
Okay, ... I already figure out where is the problem indeed ;-)=)
Again I should look how the VBO send the vertices where is the key of Geometry input

Even I solved it alone ... Thankssss

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!