PDA

View Full Version : transparency



phanie
06-12-2001, 02:59 AM
help me please http://www.opengl.org/discussion_boards/ubb/confused.gif

i want to display a transparent object composed by several levels of polygons. Each level is a closed ribbon of gl_triangle_strip ( so that it seems like a stack of cylinders).
i draw my ribbons of gl_strip_triangle with :
glBegin(GL_TRIANGLE_STRIP) ;
for each level
Vertices from 1 to n ;
Vertice 1 ; //to close the ribbon

i use blending :

glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

i saw in the forum, that i should sort the polygons and display them according to their z value. but my problem is here : how can i sort the triangles while :
* i use gl_triangl_strip,
* for the same ribbon of gl_triangle_strip, i have to pass behind or foreward the triangles i have just drawn ;

moreover, my object is composed by nearly 20,000 triangles and i want to perform "real-time".
how can i sort such a number of triangles and have good performances ?

thanks http://www.opengl.org/discussion_boards/ubb/smile.gif

billy
06-12-2001, 05:38 AM
This is a good question. I also have this problem. How do you sort the triangles?
Another rule is to draw opaque objects fisrt and then transparent ones.

phanie
06-12-2001, 05:59 AM
Thanks for your answer.

for the moment i don't sort the triangles 'cause i don't know how.
currently, i display opaque object, and then transparent object. but it don't resolve my problem because when i display a transparent one i have for the same object some polygons front and some behind.
i wondering if it is a good idea to procede with gl_triangle_strip. do you have an idea ?

zed
06-12-2001, 07:15 PM
u wont be able to sort the triangles in a strip. u will have to break the strip up into indivual triangles + use GL_TRIANGLES. also there was a paper recently on the nvidia developer website which might be of interest.

phanie
06-12-2001, 11:03 PM
thanks for the information !