From: John Tsiombikas Date: Sat, 30 May 2020 12:48:29 +0000 (+0300) Subject: fixed win32 srgb/multisample context creation X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=commitdiff_plain;h=5fe916cfd1a3eafee404f2e7ea90d0c32ff7f722;p=miniglut fixed win32 srgb/multisample context creation --- diff --git a/miniglut.c b/miniglut.c index cffa432..825374f 100644 --- a/miniglut.c +++ b/miniglut.c @@ -1286,7 +1286,7 @@ static unsigned int choose_pixfmt(unsigned int mode) } *aptr++ = 0; - while(!wglChoosePixelFormat(dc, attr, 0, 1, &pixfmt, &num_pixfmt) && samples && *samples) { + while((!wglChoosePixelFormat(dc, attr, 0, 1, &pixfmt, &num_pixfmt) || !num_pixfmt) && samples && *samples) { *samples >>= 1; if(!*samples) { aptr[-3] = 0; @@ -1336,8 +1336,8 @@ static int create_window_wglext(const char *title, int width, int height) } tmpdc = GetDC(tmpwin); - if(!(pixfmt = ChoosePixelFormat(dc, &tmppfd)) || - !SetPixelFormat(dc, pixfmt, &tmppfd) || + if(!(pixfmt = ChoosePixelFormat(tmpdc, &tmppfd)) || + !SetPixelFormat(tmpdc, pixfmt, &tmppfd) || !(tmpctx = wglCreateContext(tmpdc))) { goto fail; } diff --git a/test.c b/test.c index 6e68405..762fea6 100644 --- a/test.c +++ b/test.c @@ -1,3 +1,4 @@ +#include #include #include "miniglut.h" @@ -24,12 +25,33 @@ int bnstate[8]; int anim; float torus_pos[3], torus_rot[4] = {0, 0, 0, 1}; +#ifndef GL_FRAMEBUFFER_SRGB +#define GL_FRAMEBUFFER_SRGB 0x8db9 +#endif + +#ifndef GL_MULTISAMPLE +#define GL_MULTISAMPLE 0x809d +#endif int main(int argc, char **argv) { + int i, test_aa = 0, test_srgb = 0; + unsigned int mode = GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE; + + for(i=1; i