PDA

View Full Version : Mesa benchmarks & 2d init



Kuranes
12-30-2001, 03:03 AM
My application is at 2 fps on a pentium II 300 on a linux debian with mesa 3.1,
it is much too slow !!!

Is there any linux opengl benchmarks, that can give me performance of mesa implementation ?
(I wanna know perf diffs from mesa 3.1 to mesa 4)

I use opengl only for 2d drawing, no 3d, what GL inits hints can give me max perf ?

I actually use this code
(l and h is the canvas height and width)
--------------------
glViewport (0, 0, l, h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
glOrtho (0, l, 0, h, -1, 1);
glMatrixMode (GL_MODELVIEW);
glLoadIdentity();
/* Simplest Lighting model*/
glShadeModel(GL_FLAT);
/* I need transparency so... */
glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
/* I turn all these off for faster drawing with quality loss*/
glEnable (GL_LINE_SMOOTH);
glEnable (GL_POINT_SMOOTH);
glEnable (GL_POLYGON_SMOOTH);
/**/
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
/*This matters on 3d scene, does it here ?*/
glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST );
/* Is it the fastest in 2d ?*/
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
------------------------

Any clues ?

zerodeux
01-01-2002, 06:43 PM
Is there any linux opengl benchmarks, that can give me performance of mesa implementation ?
(I wanna know perf diffs from mesa 3.1 to mesa 4)


Use 'glperf' and bench the primitives you're using. Full answer : http://www.specbench.org/



I use opengl only for 2d drawing, no 3d, what GL inits hints can give me max perf ?


Seems you already got them. Also make sure you're context does not have a z-buffer (you obviously don't need it), you'll spare memory. Or disable depth test. Also note that polygon smoothing is often rather expensive, even with 3D hardware (the global AA method is actually better - works with polygon intersections -, and recommended by nvidia for instance). Also make sure lighting is disabled (this is de default for all(?) driver). Etc... http://www.opengl.org/discussion_boards/ubb/smile.gif

Kuranes
01-04-2002, 07:01 AM
Thx !! Now, i've a different init, all embeded in a display list, hope it does all 2d perf hints !! (texture are now in the texture functions, not called even if there is no texture in the page rendered) : OpenglPipelineState = glGenLists (1); glNewList (OpenglPipelineState, GL_COMPILE_AND_EXECUTE); if (HighQuality) { /* Simple Lighting model*/ glShadeModel(GL_SMOOTH); /* Transparency */ glEnable (GL_BLEND); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); /* Antialiasing Those Options give better quality image upon performance loss Must be a user Option */ glEnable (GL_LINE_SMOOTH); glEnable (GL_POINT_SMOOTH); /* Not recommended for nvidia cards... Global Antialiasing is done elsewhere...*/ /*glEnable (GL_POLYGON_SMOOTH);*/ } else { /* Simple Lighting model*/ glShadeModel(GL_FLAT); /* Transparency */ glDisable (GL_BLEND); /* Texture enhancement*/ glDisable (GL_DITHER); /* AntiAliasing*/ /* glDisable (GL_LINE_SMOOTH); */ /* glDisable (GL_POINT_SMOOTH); */ glDisable (GL_LINE_SMOOTH); glDisable (GL_POINT_SMOOTH); glDisable (GL_POLYGON_SMOOTH); } /* No lights */ glDisable (GL_LIGHTING); glDisable (GL_COLOR_MATERIAL); glDisable (GL_DEPTH_TEST); /* No stencil buffer (one day perhaps, for background)*/ glDisable (GL_STENCIL_TEST); /* No scissor for now (svg viewports will use it, one day)*/ glDisable (GL_SCISSOR_TEST); /* Polygon are alway filled (until now) Because Thot draws outlined polygons with joined lines so... */ glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); /* Erase Screen buffer Big cpu&memcopy usage... if we can do another Way, it will be faster !! */ glClearColor (1, 1, 1, 1); glClear(GL_COLOR_BUFFER_BIT); /* Paints a background color */ /* GL_ClearBackground(l, h); */ glEndList ();

Kuranes
01-04-2002, 07:04 AM
Wow, my other broswer kills lines...
Here it is again, Best opengl init for 2d drawing :

OpenglPipelineState = glGenLists (1);
glNewList (OpenglPipelineState, GL_COMPILE_AND_EXECUTE);
if (HighQuality)
{
/* Simple Lighting model*/
glShadeModel(GL_SMOOTH);
/* Transparency */
glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
/*
Antialiasing
Those Options give better quality image upon performance loss
Must be a user Option
*/
glEnable (GL_LINE_SMOOTH);
glEnable (GL_POINT_SMOOTH);
/* Not recommended for nvidia cards...
Global Antialiasing is done elsewhere...*/
glEnable (GL_POLYGON_SMOOTH);

}
else
{
/* Simple Lighting model*/
glShadeModel(GL_FLAT);
/* Transparency */
glDisable (GL_BLEND);
/* Texture enhancement*/
glDisable (GL_DITHER);
/* AntiAliasing*/
/* glDisable (GL_LINE_SMOOTH); */
/* glDisable (GL_POINT_SMOOTH); */
glDisable (GL_LINE_SMOOTH);
glDisable (GL_POINT_SMOOTH);
glDisable (GL_POLYGON_SMOOTH);
}
/* No lights */
glDisable (GL_LIGHTING);
glDisable (GL_COLOR_MATERIAL);
glDisable (GL_DEPTH_TEST);
/* No stencil buffer (one day perhaps, for background)*/
glDisable (GL_STENCIL_TEST);
/* No scissor for now (svg viewports will use it, one day)*/
glDisable (GL_SCISSOR_TEST);
/* Polygon are alway filled (until now)
Because Thot draws outlined polygons with joined lines
so...
*/
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
/* Erase Screen buffer
Big cpu&memcopy usage...
if we can do another Way, it will be faster !!
*/
glClearColor (1, 1, 1, 1);
glClear(GL_COLOR_BUFFER_BIT);
/* Paints a background color */
/* GL_ClearBackground(l, h); */
glEndList ();