PDA

View Full Version : using vertex arrays while using tessallation



him_me2
11-24-2009, 10:29 PM
hi all,
i'm using tessallation feature for tesslating my polygons but due to huge amount of data it is giving me slow performance. currently i'm using immediate mode. can any one tell me how to use the vertex array while tessallating because i'm not getting any clue how to access the vertex data while using tessaltion feature.

here are my call backs fucnc:

gluTessCallback(pTess, GLU_TESS_BEGIN, (void (__stdcall*)())glBegin);


// Just call glEnd at end of triangle batch
gluTessCallback(pTess, GLU_TESS_END, (void (__stdcall*)())glEnd);

// Just call glVertex3dv for each vertex
gluTessCallback(pTess, GLU_TESS_VERTEX, (void (__stdcall*)())glVertex3dv );

// Register error callback
gluTessCallback(pTess, GLU_TESS_ERROR, (void (__stdcall *)(void))tessError);

gluTessProperty(pTess, GLU_TESS_TOLERANCE, 0.9F);
gluTessProperty(pTess, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_NONZERO);

gluTessCallback(pTess, GLU_TESS_COMBINE, (void (__stdcall *) ())combineCallback);



gluTessBeginPolygon(pTess, NULL);

// Gegin the one and only contour
gluTessBeginContour(pTess);

// Feed in the list of vertices
for(int nVertIndex = 0; nVertIndex < nIndex; nVertIndex++)
{
gluTessVertex(pTess, Coords[nVertIndex], Coords[nVertIndex]); // Can't be NULL
}

// Close contour and polygon
gluTessEndContour(pTess);
gluTessEndPolygon(pTess);




gluDeleteTess(pTess);

Coords are nothing just 1x3 array pointer to point x y z values.

pls help me in this regard. Thank you

Alfonse Reinheart
11-24-2009, 11:05 PM
Everything in GLU runs on the CPU. And tessellation was created before vertex arrays, and long before buffer objects.

In short, don't use tessellation if you actually care about performance. Do the tessellation yourself, either in optimized CPU routines or with shaders designed for that purpose.

him_me2
11-25-2009, 05:22 AM
thanks for the reply....
can u tell me some alternate ways to do tessallation.....

Vilem Otte
11-25-2009, 06:37 AM
Under OpenGL you can use geometry shaders (this is probably the best and only way on most graphics cards ... your card also must support geometry shaders), but this is NOT definitely the fast way to do it ... sample how to do it is here http://www.naixela.com/alex/downloads/gs_tess.zip

On some AMD graphics cards (F.e. HD 2900xt and others) you have extension GL_AMD_vertex_shader_tessellation (or experimental GL_AMDX_vertex_shader_tessellation), this way you perform hardware tessellation (using AMD tessellator) - this way is much faster than using geometry shaders.

Graham Sellers
11-25-2009, 09:11 AM
On some AMD graphics cards ...
Actually, all currently supported AMD cards support the AMD_vertex_shader_tessellator extension (R600+ GPUs, basically anything that you can download a new Catalyst for). There's a whitepaper and some example code for using it here: http://developer.amd.com/GPU/WGSDK/Pages/default.aspx under the 'OpenGL Tessellation Samples' heading. If you need the application to have access to the tessellated vertices, you can use transform feedback to record the output of the tessellator and read it back from the buffer after the draw.

Cheers,

Graham