I am working on a new app using GL 4.2 core profile from scratch.
This is my init code:
HDC hDC = ::GetDC(hWnd);
pfd.nSize = sizeof(pfd);
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL
| PFD_GENERIC_ACCELERATED | PFD_DOUBLEBUFFER;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 32;
pfd.cAlphaBits = 8;
pfd.cDepthBits = 24;
pfd.cStencilBits = 8;
int format = ::ChoosePixelFormat(hDC, &pfd);
::SetPixelFormat (hDC, format, &pfd);
HGLRC hTempRC = ::wglCreateContext(hDC);
int attribs =
HGLRC hRC = ::wglCreateContextAttribsARB(hDC, nullptr, attribs);
I then clear the framebuffer to red:
::glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
::glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
This is the result:
What am I doing wrong?
I am on Windows 7 SP1 64-bit, with AMD Catalyst 12.11 drivers.
How about without PFD_GENERIC_ACCELERATED specified in pfd.dwFlags?
From the MSDN PIXELFORMATDESCRIPTOR docs:
The generic implementation is the Microsoft GDI software implementation of OpenGL.
Asking for a pixel format that supports a software implementation of OpenGL, and then creating an OpenGL 4.2 context may be the cause of the problem.
[QUOTE=Dan Bartlett;1244456]How about without PFD_GENERIC_ACCELERATED specified in pfd.dwFlags?
Asking for a pixel format that supports a software implementation of OpenGL, and then creating an OpenGL 4.2 context may be the cause of the problem.[/QUOTE]
Removing that did not change anything.
Also the MSDN docs say next to PFD_GENERIC_ACCELERATED:
The pixel format is supported by a device driver that accelerates the generic implementation. If this flag is clear and the PFD_GENERIC_FORMAT flag is set, the pixel format is supported by the generic implementation only.
Which indicates that it is the opposite of what you think, it looks for a non-generic implementation.
I discovered the problem.
It looks like it’s a bug in AMD’s driver.
I am running this on my HP latop which comes with two GPUs - an integrated one in the CPU/APU, and a dedicated GPU. AMD calls this Radeon Dual Graphics.
In the AMD driver control panel I can control whether a program runs in power saving mode - which means it only runs on the APU, or high performance mode - which runs it on both GPUs using CrossFire.
When I run it in high performance I get the corruption, but when I run it in power saving it correctly renders solid red.
So it must be a bug in the CrossFire driver.
EDIT: Just checked the current Catalyst driver versions, I was running Catalyst 12.11 Beta 3, which is about 1 month old, the current version 12.11 Beta 7.
I will test to see if the bug is still in Beta 7 - when it finishes downloading…
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.