From: <sp...@us...> - 2009-03-16 17:54:39
|
Revision: 802 http://freeglut.svn.sourceforge.net/freeglut/?rev=802&view=rev Author: spanne Date: 2009-03-16 17:53:54 +0000 (Mon, 16 Mar 2009) Log Message: ----------- Set the default number of samples per pixel to 4 and actually use the value set with glutSetOption(GLUT_MULTISAMPLE,...) in Windows code. Previously the Windows code used a hardwired value of 4 and the GLX code had a default of 0, neither made much sense. Similarly, set the default number of auxiliary buffers to 1 and use that value when GLUT_AUX is used. Note: There latter token has the same value as GLUT_AUX1, and for historical reasons we seem to have 2 APIs to set the number of auxiliary buffers: Explicitly using GLUT_AUX1 ... GLUT_AUX4, and using a combination of GLUT_AUX with glutSetOption. The default of 1 ensures consistent behaviour in both cases. Modified Paths: -------------- trunk/freeglut/freeglut/ChangeLog trunk/freeglut/freeglut/src/freeglut_init.c trunk/freeglut/freeglut/src/freeglut_window.c Modified: trunk/freeglut/freeglut/ChangeLog =================================================================== --- trunk/freeglut/freeglut/ChangeLog 2009-03-16 17:30:37 UTC (rev 801) +++ trunk/freeglut/freeglut/ChangeLog 2009-03-16 17:53:54 UTC (rev 802) @@ -1,5 +1,16 @@ 2009-03-16 Sven Panne <sve...@ae...> + * src/freeglut_init.c,src/freeglut_window.c: Set the default number of + samples per pixel to 4 and actually use the value set with + glutSetOption(GLUT_MULTISAMPLE,...) in Windows code. Previously the + Windows code used a hardwired value of 4 and the GLX code had a + default of 0, neither made much sense. Similarly, set the default + number of auxiliary buffers to 1 and use that value when GLUT_AUX is + used. Note: There latter token has the same value as GLUT_AUX1, and + for historical reasons we seem to have 2 APIs to set the number of + auxiliary buffers: Explicitly using GLUT_AUX1 ... GLUT_AUX4, and using + a combination of GLUT_AUX with glutSetOption. The default of 1 ensures + consistent behaviour in both cases. * src/freeglut_state.c: Added GLUT_AUX and GLUT_MULTISAMPLE as possible parameters for glutGet, making things more symmetric with glutSetOption. Modified: trunk/freeglut/freeglut/src/freeglut_init.c =================================================================== --- trunk/freeglut/freeglut/src/freeglut_init.c 2009-03-16 17:30:37 UTC (rev 801) +++ trunk/freeglut/freeglut/src/freeglut_init.c 2009-03-16 17:53:54 UTC (rev 802) @@ -84,8 +84,8 @@ NULL, /* ProgramName */ GL_FALSE, /* JoysticksInitialised */ GL_FALSE, /* InputDevsInitialised */ - 0, /* AuxiliaryBufferNumber */ - 0, /* SampleNumber */ + 1, /* AuxiliaryBufferNumber */ + 4, /* SampleNumber */ 1, /* MajorVersion */ 0, /* MajorVersion */ 0 /* ContextFlags */ Modified: trunk/freeglut/freeglut/src/freeglut_window.c =================================================================== --- trunk/freeglut/freeglut/src/freeglut_window.c 2009-03-16 17:30:37 UTC (rev 801) +++ trunk/freeglut/freeglut/src/freeglut_window.c 2009-03-16 17:53:54 UTC (rev 802) @@ -132,14 +132,22 @@ ATTRIB_VAL( GLX_ACCUM_ALPHA_SIZE, 1 ); } - if ((fgState.DisplayMode & GLUT_AUX) - || (fgState.DisplayMode & GLUT_AUX1) - || (fgState.DisplayMode & GLUT_AUX2) - || (fgState.DisplayMode & GLUT_AUX3) - || (fgState.DisplayMode & GLUT_AUX4)) - { - ATTRIB_VAL(GLX_AUX_BUFFERS, fgState.AuxiliaryBufferNumber) - } + if( fgState.DisplayMode & GLUT_AUX4 ) + { + ATTRIB_VAL(GLX_AUX_BUFFERS, 4); + } + else if( fgState.DisplayMode & GLUT_AUX3 ) + { + ATTRIB_VAL(GLX_AUX_BUFFERS, 3); + } + else if( fgState.DisplayMode & GLUT_AUX2 ) + { + ATTRIB_VAL(GLX_AUX_BUFFERS, 2); + } + else if( fgState.DisplayMode & GLUT_AUX1 ) /* NOTE: Same as GLUT_AUX! */ + { + ATTRIB_VAL(GLX_AUX_BUFFERS, fgState.AuxiliaryBufferNumber); + } if (fgState.DisplayMode & GLUT_MULTISAMPLE) { @@ -427,8 +435,8 @@ pfd.cAuxBuffers = 3; else if( fgState.DisplayMode & GLUT_AUX2 ) pfd.cAuxBuffers = 2; - else if( fgState.DisplayMode & GLUT_AUX1 ) - pfd.cAuxBuffers = 1; + else if( fgState.DisplayMode & GLUT_AUX1 ) /* NOTE: Same as GLUT_AUX! */ + pfd.cAuxBuffers = fgState.AuxiliaryBufferNumber; else pfd.cAuxBuffers = 0; @@ -497,7 +505,7 @@ pAttributes[iCounter++]=WGL_DOUBLE_BUFFER_ARB; pAttributes[iCounter++]=(fgState.DisplayMode & GLUT_DOUBLE)!=0; pAttributes[iCounter++]=WGL_SAMPLE_BUFFERS_ARB; pAttributes[iCounter++]=GL_TRUE; - pAttributes[iCounter++]=WGL_SAMPLES_ARB; pAttributes[iCounter++]=4; + pAttributes[iCounter++]=WGL_SAMPLES_ARB; pAttributes[iCounter++]=fgState.SampleNumber; pAttributes[iCounter++]=0; pAttributes[iCounter++]=0; /* terminator */ bValid = wglChoosePixelFormatARBProc(window->Window.Device,pAttributes,fAttributes,1,&iPixelFormat,&numFormats); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |