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…
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 ();
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 ();