Hello, I've been developing an application for 4 years and it always worked like a charm in AMD/ATI graphics cards / igps, but now after installing Catalyst 13.04 the only I can see is a blank screen.
The last Catalyst I've been working successfuly with are the 12.08 with a HD6670 graphics card. Below I'm posting the C# code to initialize the OpenGL context.
Please, could anybody take a look at this and help me to know what could make the code incompatible with the latest Catalyst drivers?
IntPtr ptr = WGL.LoadLibrary("opengl32.dll"); // Cargo la dll OpenGL32.dll para que no falle ChoosePixelFormat o SetPixelFormat
m_HWND = hWnd.ToInt32();
m_DC = WGL.GetDC(m_HWND);
WGL.wglSwapBuffers(m_DC);
//Get the pixel format
WGL.PIXELFORMATDESCRIPTOR pfd = new WGL.PIXELFORMATDESCRIPTOR();
WGL.ZeroPixelDescriptor(ref pfd);
pfd.nVersion = 1;
pfd.dwFlags = dobleBuffer ?
(WGL.PFD_DRAW_TO_WINDOW | WGL.PFD_SUPPORT_OPENGL | WGL.PFD_DOUBLEBUFFER | WGL.PFD_TYPE_RGBA | WGL.PFD_GENERIC_ACCELERATED) :
(WGL.PFD_DRAW_TO_WINDOW | WGL.PFD_SUPPORT_OPENGL | WGL.PFD_TYPE_RGBA | WGL.PFD_GENERIC_ACCELERATED);
pfd.iPixelType = (byte)(WGL.PFD_TYPE_RGBA);
pfd.cColorBits = 32;
pfd.cDepthBits = 16;
pfd.iLayerType = (byte)(WGL.PFD_MAIN_PLANE);
int pixelFormatIndex = 0;
pixelFormatIndex = WGL.ChoosePixelFormat(m_DC, ref pfd);
if (pixelFormatIndex == 0) return false;
if (WGL.SetPixelFormat(m_DC, pixelFormatIndex, ref pfd) == 0) return false;
m_RC = WGL.wglCreateContext(m_DC);
if (m_RC == 0) return false;
if (WGL.wglMakeCurrent(m_DC, m_RC) == 0) return false;
openGLVersion = Marshal.PtrToStringAnsi(GL.glGetString(GL.GL_VERSION)).ToUpper();
openGLRenderer = Marshal.PtrToStringAnsi(GL.glGetString(GL.GL_RENDERER)).ToUpper();
openGLVendor = Marshal.PtrToStringAnsi(GL.glGetString(GL.GL_VENDOR)).ToUpper();
openGLExtensions = Marshal.PtrToStringAnsi(GL.glGetString(GL.GL_EXTENSIONS)).ToUpper();
bool canOnlyLoadTexturesPowerOfTwo = !openGLExtensions.Contains("ARB_TEXTURE_NON_POWER_OF_TWO");
bool canUsePixelBufferObjects = openGLExtensions.Contains("ARB_PIXEL_BUFFER_OBJECT");
if (canOnlyLoadTexturesPowerOfTwo) return false;
if (!canUsePixelBufferObjects) return false;
if (!GL.Load_ARB_pixel_buffer_object()) return false;
CambiaArea(x, y, width, height);
GL.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
GL.glCullFace(GL.GL_BACK);
GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
GL.glEnable(GL.GL_BLEND);
GL.glEnable(GL.GL_COLOR_MATERIAL);
GL.glDisable(GL.GL_LIGHTING);
GL.glDisable(GL.GL_TEXTURE_2D);
GL.glEnable(GL.GL_LINE_SMOOTH);
GL.glEnable(GL.GL_POLYGON_SMOOTH);
GL.glHint(GL.GL_LINE_SMOOTH_HINT, GL.GL_NICEST);
GL.glHint(GL.GL_POLYGON_SMOOTH_HINT, GL.GL_NICEST);
WGL.wglMakeCurrent(m_DC, m_RC);
GL.glMatrixMode(GL.GL_PROJECTION);
GL.glLoadIdentity();
GL.glOrtho(spaceLeft, spaceRight, spaceBottom, spaceTop, -1, 1);
WGL.wglMakeCurrent(m_DC, m_RC);
GL.glViewport(screenX, screenY, screenW, screenH);
GL.glMatrixMode(GL.GL_MODELVIEW);
GL.glLoadIdentity();