I do know: WM_PAINT IS being sent, that SwapBuffer IS being called, openGL IS initialized, doing the barebones cpu StretchDIBits method does NOT have this problem.
It could very well be a problem with my code, and this is a split of the code (Of course It's going to look a lot like the series).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | void initOpenGL(HWND window) { HDC deviceContext = GetDC(window); PIXELFORMATDESCRIPTOR desiredFormat = {}; desiredFormat.nSize = sizeof(desiredFormat); desiredFormat.nVersion = 1; desiredFormat.iPixelType = PFD_TYPE_RGBA; desiredFormat.dwFlags = PFD_SUPPORT_OPENGL|PFD_DRAW_TO_WINDOW|PFD_DOUBLEBUFFER; desiredFormat.cColorBits = 32; desiredFormat.cAlphaBits = 8; desiredFormat.iLayerType = PFD_MAIN_PLANE; //================ ._. ====================== // TODO: Why does ChoosePixelFormat take ~1.7 seconds to call the first time? D: LARGE_INTEGER aqPerfFreq; QueryPerformanceFrequency(&aqPerfFreq); double perfFreq = (double)aqPerfFreq.QuadPart / 1000.0f; LARGE_INTEGER start; LARGE_INTEGER end; QueryPerformanceCounter(&start); int suggestedIndex = ChoosePixelFormat(deviceContext, &desiredFormat); QueryPerformanceCounter(&end); double time = (double)(end.QuadPart - start.QuadPart)/perfFreq; char buffer[256]; sprintf(buffer, "ChoosePixelFormat call time (%0.1f)milliseconds\n", time); OutputDebugStringA(buffer); //================ ._. ====================== PIXELFORMATDESCRIPTOR suggestedFormat; DescribePixelFormat(deviceContext, suggestedIndex, sizeof(suggestedFormat), &suggestedFormat); SetPixelFormat(deviceContext, suggestedIndex, &suggestedFormat); HGLRC openGLRC = wglCreateContext(deviceContext); if(wglMakeCurrent(deviceContext, openGLRC)) { int a = 0xb; // Note: For a breakpoint } else { // Todo: :( , switch to software rendering? invalidCodePath; } ReleaseDC(window, deviceContext); } void blitBackBuffer(win32_backbuffer *buffer, HDC deviceContext, int windowWidth, int windowHeight) { #if 0 StretchDIBits(deviceContext, 0, 0, windowWidth, windowHeight, 0, 0, buffer->width, buffer->height, buffer->memory, &buffer->bitmapInfo, DIB_RGB_COLORS, SRCCOPY); #endif glViewport(0, 0, windowWidth, windowHeight); glClearColor(0.75f, 0.75f, 0.75f, 0.0f); glClear(GL_COLOR_CLEAR_VALUE); SwapBuffers(deviceContext); } |
Of course I'll be on standby if anyone thinks it's a different section of code that's the problem. I'm at a loss on this :/