Hi all,
I've been trying OpenGL for a few days now. I currently have a problem with my rendering context.
I am following NeHe's tutorial at :
NeHe Productions: Creating an OpenGL Window (Win32)
I use the following header files and global variables :
Code:
#include "StdAfx.h"
#include <gl/GL.h>
#include <gl/GLU.h>
#include <gl/GLAUX.h>
#include <tchar.h>
HGLRC hRC=NULL;
HDC hDC=NULL;
HWND hWnd=NULL;
HINSTANCE hInstance;
This is the part of the code that seem to be the problem, if it comes from the code at all.
Code:
if(!(hDC=GetDC(hWnd)))
{
KillGLWindow(); // Reset the display
MessageBox(NULL,_T("Can't create a GL Device Context."), _T("ERROR"), MB_OK|MB_ICONEXCLAMATION);
return FALSE;
}
if(!(PixelFormat=ChoosePixelFormat(hDC,&pfd)))
{
KillGLWindow();
MessageBox(NULL,_T("Can't find a suitable pixelformat."), _T("ERROR"),MB_OK|MB_ICONEXCLAMATION);
return FALSE;
}
if(!(hRC=wglCreateContext(hDC)))
{
KillGLWindow();
MessageBox(NULL,_T("Can't Create a GL Rendering Context."),_T("ERROR"),MB_OK|MB_ICONEXCLAMATION);
return FALSE;
}
if(!wglMakeCurrent(hDC,hRC))
{
KillGLWindow();
MessageBox(NULL,_T("Can't Activate the GL Rendering Context."),_T("ERROR"),MB_OK|MB_ICONEXCLAMATION);
return FALSE;
}
I get the "Can't Create a GL Rendering Context." message box...
Any clue?