forked from enlightenment/efl
Use display list for OpenGL polygons implementation. This improve speed on
my computer in expedite test bench from 400 to 650. SVN revision: 34795
This commit is contained in:
parent
e2aa481463
commit
0de14ee3ef
|
@ -133,6 +133,8 @@ struct _Evas_GL_Image
|
|||
struct _Evas_GL_Polygon
|
||||
{
|
||||
Evas_List *points;
|
||||
GLuint dl;
|
||||
Evas_Bool changed : 1;
|
||||
};
|
||||
|
||||
struct _Evas_GL_Polygon_Point
|
||||
|
|
|
@ -14,6 +14,7 @@ evas_gl_common_poly_point_add(Evas_GL_Polygon *poly, int x, int y)
|
|||
pt->x = x;
|
||||
pt->y = y;
|
||||
poly->points = evas_list_append(poly->points, pt);
|
||||
poly->changed = 1;
|
||||
return poly;
|
||||
}
|
||||
|
||||
|
@ -29,6 +30,7 @@ evas_gl_common_poly_points_clear(Evas_GL_Polygon *poly)
|
|||
poly->points = evas_list_remove(poly->points, pt);
|
||||
free(pt);
|
||||
}
|
||||
if (poly->dl > 0) glDeleteLists(poly->dl, 1);
|
||||
free(poly);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -106,6 +108,12 @@ evas_gl_common_poly_draw(Evas_GL_Context *gc, Evas_GL_Polygon *poly)
|
|||
evas_gl_common_context_read_buf_set(gc, GL_BACK);
|
||||
evas_gl_common_context_write_buf_set(gc, GL_BACK);
|
||||
|
||||
if (poly->changed || poly->dl <= 0)
|
||||
{
|
||||
if (poly->dl > 0) glDeleteLists(poly->dl, 1);
|
||||
poly->dl = glGenLists(1);
|
||||
|
||||
glNewList(poly->dl, GL_COMPILE_AND_EXECUTE);
|
||||
#ifdef GLU_TESS
|
||||
if (!tess)
|
||||
{
|
||||
|
@ -150,4 +158,12 @@ evas_gl_common_poly_draw(Evas_GL_Context *gc, Evas_GL_Polygon *poly)
|
|||
}
|
||||
glEnd();
|
||||
#endif
|
||||
glEndList();
|
||||
|
||||
poly->changed = 0;
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
glCallList(poly->dl);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue