Adding support for the multisampling query per bug report 1274193

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@704 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
fayjf 2006-09-21 22:39:12 +00:00
parent 938aa5fa90
commit 94662b8d1b
2 changed files with 27 additions and 7 deletions

View File

@ -119,6 +119,16 @@ void FGAPIENTRY glutSetOption( GLenum eWhat, int value )
} }
} }
#if TARGET_HOST_MS_WINDOWS
/* WRONG-- FIXME */
/* The following include file is available from SGI but is not standard:
* #include <GL/wglext.h>
* So we copy the necessary parts out of it to support the multisampling query
*/
#define WGL_SAMPLES_ARB 0x2042
#endif
/* /*
* General settings query method * General settings query method
*/ */
@ -129,6 +139,8 @@ int FGAPIENTRY glutGet( GLenum eWhat )
GLboolean boolValue ; GLboolean boolValue ;
#endif #endif
int nsamples = 0;
switch (eWhat) switch (eWhat)
{ {
case GLUT_INIT_STATE: case GLUT_INIT_STATE:
@ -154,15 +166,17 @@ int FGAPIENTRY glutGet( GLenum eWhat )
case GLUT_INIT_WINDOW_HEIGHT: return fgState.Size.Y ; case GLUT_INIT_WINDOW_HEIGHT: return fgState.Size.Y ;
case GLUT_INIT_DISPLAY_MODE: return fgState.DisplayMode ; case GLUT_INIT_DISPLAY_MODE: return fgState.DisplayMode ;
#if TARGET_HOST_POSIX_X11
/* /*
* The window/context specific queries are handled mostly by * The window/context specific queries are handled mostly by
* fghGetConfig(). * fghGetConfig().
*/ */
case GLUT_WINDOW_NUM_SAMPLES: case GLUT_WINDOW_NUM_SAMPLES:
/* XXX Multisampling. Return what I know about multisampling. */ #ifdef GLX_VERSION_1_3
return 0; glGetIntegerv(GL_SAMPLES, &nsamples);
#endif
return nsamples;
#if TARGET_HOST_POSIX_X11
/* /*
* The rest of GLX queries under X are general enough to use a macro to * The rest of GLX queries under X are general enough to use a macro to
* check them * check them
@ -279,6 +293,10 @@ int FGAPIENTRY glutGet( GLenum eWhat )
#elif TARGET_HOST_MS_WINDOWS #elif TARGET_HOST_MS_WINDOWS
case GLUT_WINDOW_NUM_SAMPLES:
glGetIntegerv(WGL_SAMPLES_ARB, &nsamples);
return nsamples;
/* Handle the OpenGL inquiries */ /* Handle the OpenGL inquiries */
case GLUT_WINDOW_RGBA: case GLUT_WINDOW_RGBA:
glGetBooleanv ( GL_RGBA_MODE, &boolValue ); glGetBooleanv ( GL_RGBA_MODE, &boolValue );

View File

@ -433,10 +433,12 @@ void fgOpenWindow( SFG_Window* window, const char* title,
fgState.DisplayMode &= ~GLUT_DOUBLE; fgState.DisplayMode &= ~GLUT_DOUBLE;
} }
/* if( fgState.DisplayMode & GLUT_MULTISAMPLE )
* GLUT also checks for multi-sampling, but I don't see that {
* anywhere else in FREEGLUT so I won't bother with it for the moment. fgState.DisplayMode &= ~GLUT_MULTISAMPLE ;
*/ window->Window.VisualInfo = fgChooseVisual( );
fgState.DisplayMode &= GLUT_MULTISAMPLE;
}
} }
FREEGLUT_INTERNAL_ERROR_EXIT( window->Window.VisualInfo != NULL, FREEGLUT_INTERNAL_ERROR_EXIT( window->Window.VisualInfo != NULL,