salut je debute en openGL et j'ai du mal a creer une fenetre le compilateur me mets 2 erreurs :
PS: les erreurs du compilateur(vc++ 6.0)sont plus bas !
// debut du code
#include <windows.h>
#include <gl/gl.h>
#include <gl/glu.h>
HWND hWnd;
WNDCLASS wc;
MSG msg;
HDC DC;
HGLRC RC;
void RePaint ()
{
glClear (GL_COLOR_BUFFER_BIT);
glMatrixMode (GL_MODELVIEW);
glLoadIdentity ();
SwapBuffers (DC);
}
void InitPixelFormat (HDC hDC)
{
PIXELFORMATDESCRIPTOR pfd =
{
sizeof (PIXELFORMATDESCRIPTOR),
1,
PFD_SUPPORT_OPENGL | PFD_TYPE_RGBA | PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER,
16,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
16,
0, 0, 0, 0, 0, 0, 0
};
SetPixelFormat (hDC, ChoosePixelFormat (hDC, &pfd), &pfd);
}
LRESULT CALLBACK WindowProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
RC=wglCreateContext(DC);
wgMakeCurrent(DC,RC);
switch(uMsg)
{
case WM_CREATE:
DC=GetDC(hWnd);
InitPixelFormat(HDC);
break;
case WM_SIZE:
glViewport (0,0,LOWORD (lParam),HIWORD (lParam));
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
gluPerspective (45,(float)(LOWORD(lParam))/(float)(HIWORD (lParam)),1,100);
break;
case WM_PAINT :
RePaint();
break;
case WM_CLOSE :
wglMakeCurrent(NULL,NULL);
wglDeleteContext(RC);
ReleaseDC(hWnd,DC);
PostQuitMessage(0);
break;
default :
return DefWindowProc(hWnd,uMsg,wParam,lParam);
break;
}
return 0;
}
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int CmdShow)
{
wc.style = CS_OWNDC;
wc.lpfnWndProc = WindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = "OGL";
RegisterClass(&wc);
hWnd=CreateWindow("OGL","Fenetre OpenGl",WS_CAPTION | WS_POPUPWINDOW | WS_VISIBLE,0,0,640,480,NULL,NULL,hInstance,NULL);
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
// fin du code
--------------------Configuration: sdf - Win32 Debug--------------------
Compiling...
sdf.cpp
C:\Program Files\Microsoft Visual Studio\MyProjects\jesis\sdf.cpp(46) : error C2065: 'wgMakeCurrent' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\MyProjects\jesis\sdf.cpp(51) : error C2275: 'HDC' : illegal use of this type as an expression
c:\program files\microsoft visual studio\vc98\include\windef.h(239) : see declaration of 'HDC'
Error executing cl.exe.
sdf.exe - 2 error(s), 0 warning(s)
merci de me dire ou sont les erreurs ! :)