implemented GLUT_WINDOW_STENCIL_SIZE and GLUT_WINDOW_BUFFER_SIZE for glutGet

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1529 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
dcnieho 2013-02-28 08:53:31 +00:00
parent ccebf6f3df
commit 766e0cafc5
2 changed files with 19 additions and 3 deletions

View File

@ -386,6 +386,12 @@ int main( int argc, char** argv )
glutGet( GLUT_WINDOW_X ), glutGet( GLUT_WINDOW_Y )
);
/*
* Describe pixel format
*/
printf("The current window has %i red bits, %i green bits, %i blue bits and %i alpha bits for a total buffer size of %i bits\n",glutGet(GLUT_WINDOW_RED_SIZE),glutGet(GLUT_WINDOW_GREEN_SIZE),glutGet(GLUT_WINDOW_BLUE_SIZE),glutGet(GLUT_WINDOW_ALPHA_SIZE),glutGet(GLUT_WINDOW_BUFFER_SIZE));
printf("It furthermore has %i depth bits and %i stencil bits\n",glutGet(GLUT_WINDOW_DEPTH_SIZE),glutGet(GLUT_WINDOW_STENCIL_SIZE));
/*
* Enter the main FreeGLUT processing loop
*/

View File

@ -141,10 +141,20 @@ int fgPlatformGlutGet ( GLenum eWhat )
return returnValue;
case GLUT_WINDOW_BUFFER_SIZE:
returnValue = 1 ; /* TODO????? */
return returnValue;
{
PIXELFORMATDESCRIPTOR pfd;
HDC hdc = fgStructure.CurrentWindow->Window.pContext.Device;
int iPixelFormat = GetPixelFormat( hdc );
DescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
returnValue = pfd.cColorBits;
if (pfd.iPixelType==PFD_TYPE_RGBA)
returnValue += pfd.cAlphaBits;
return returnValue;
}
case GLUT_WINDOW_STENCIL_SIZE:
returnValue = 0 ; /* TODO????? */
glGetIntegerv ( GL_STENCIL_BITS, &returnValue );
return returnValue;
case GLUT_WINDOW_X: