zhigao

10-19-2010, 09:12 PM

I need to create triangle for each vertex in opengl geometry shader. The problem is I do not know how to specify the coordinates for the new triangle.

For eaxmple, i have a vertex glVertex3f(x, y, 0.0f). I would want to create a triangle surrounding the vertex whose world coordinates are (x - 0.5f, y - 0.5f, 0.0f), (x+ 0.5f, y-0.5f,0.0f),(x ,y+0.5f,0.0f);

Using the glPositionIn[0], i get the vertex position in clip space, if i simple use the glPostionIn[0].x - 0.5 or + 0.5f thing, the result is not what I want. How should i specify the position for the triangle vertex so that I could get a traingle surrounding the input vertex? Thanks.

For eaxmple, i have a vertex glVertex3f(x, y, 0.0f). I would want to create a triangle surrounding the vertex whose world coordinates are (x - 0.5f, y - 0.5f, 0.0f), (x+ 0.5f, y-0.5f,0.0f),(x ,y+0.5f,0.0f);

Using the glPositionIn[0], i get the vertex position in clip space, if i simple use the glPostionIn[0].x - 0.5 or + 0.5f thing, the result is not what I want. How should i specify the position for the triangle vertex so that I could get a traingle surrounding the input vertex? Thanks.