Hello guys,

 

I have been playing a bit with GLU library in context of 2d graphics. I found 
that GLU tessellator

can be improved in regards of the interface with very little code added. As of 
standard gluTessVertex

accepts only arrays of double[3] values, which is a bit annoying when one has 
arrays of type float[2] 

or int[2]. It is quite easy to add more flexible interface in style of:

 

GLAPI void GLAPIENTRY gluTessVertex2i (GLUtesselator* tess, GLint *location, 
GLvoid* data);
GLAPI void GLAPIENTRY gluTessVertex2f (GLUtesselator* tess, GLfloat *location, 
GLvoid* data);
GLAPI void GLAPIENTRY gluTessVertex2d (GLUtesselator* tess, GLdouble 
*location,GLvoid* data);
 
GLAPI void GLAPIENTRY gluTessVertex3i (GLUtesselator* tess, GLint *location, 
GLvoid* data);
GLAPI void GLAPIENTRY gluTessVertex3f (GLUtesselator* tess, GLfloat 
*location,GLvoid* data);
GLAPI void GLAPIENTRY gluTessVertex3d (GLUtesselator* tess, GLdouble 
*location,GLvoid* data);

 

I also found by looking at the tessellation algorithm and docs, that one can 
make it more effectively when working

in 2d. Originally the algorithm will project all vertices of a polygon into 
same plane. When working in 2d we can skipp

this projection, since we anyway have all vertices in same plane, say Z = 0. 
Furthermore it is quite easy to hack GLU

to incorporate this by simply adding new boolean property (say 
GLU_TESS_DONT_PROJECT) which can be set by programmer and checked

by algorithm before projection. 

 

Those two addons does not break any previous functionality of GLU so one can 
use new library as a drop-in repl. 

 

I have used mesa code for my own GLU dll and if this can be of interest to more 
people than me,

I can post patches to this list or maybe entire project code somewhere on the 
net.

 

best regards

_________________________________________________________________
More than messages–check out the rest of the Windows Live™.
http://www.microsoft.com/windows/windowslive/
------------------------------------------------------------------------------
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to