ok merci du conseil mais tu sais je suis vraiment une grosse m*rde et je crois que ça me fera pas de mal
@++
i_am_the_law Posté le 03 octobre 2003 à 23:18:00
euh, il vaut mieux pas qu´il voit ce topic
C´etait une plaisanterie.
https://www.jeuxvideo.com/[...]_page=1&_ndx=1
>>>>>>>>>>....hum hum....ok, si c´est une plaisenterie.
euh claculatro le lien que tu as posté est un lien qui conduit à rien le sujet est mort...
C´est parce qu´il à copié directement l´adresse de i_am_the_law.
Et il a laissé le [...] ![]()
euh c´est moi qui doit etre c.. mais Dev-C++ me dit qu´il y a deux erreurs dans le code suivant, c´est le code de Calculator_V2 ( cette discussion était sujette a polémique et je sais pas comment ça c´est fini mais je m´en fous)
enfin voilà comme il me dit qu´il y a deux erreur il peut pas le compiler j´aimerais avoir votre avis les gars
LRESULT CALLBACK WndProc ( HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam);
void EnableOpenGL ( HWND hWnd, HDC *hDC, HGLRC *hRC);
void DisableOpenGL ( HWND hWnd, HDC hDC, HGLRC hRC);
int WINAPI WinMain ( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int iCmdShow)
{
WNDCLASS wc;
HWND hWnd;
HDC hDC;
HGLRC hRC;
MSG msg;
BOOL bQuit = FALSE;
float theta = 0.0f;
wc.style = CS_OWNDC;
wc.lpfnWndProc = WndProc;
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 ( BLACK_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = " GLSample";
RegisterClass ( &);
hWnd = CreateWindow (
" GLSample", " OpenGL Sample",
WS_CAPTION | WS_POPUPWINDOW | WS_VISIBLE,
0, 0, 800, 640,
NULL, NULL, hInstance, NULL);
EnableOpenGL ( hWnd, &, &);
while ( ! bQuit)
{
if ( PeekMessage ( &, NULL, 0, 0, PM_REMOVE))
{
if ( msg.message == WM_QUIT)
{
bQuit = TRUE;
}
else
{
TranslateMessage ( &);
DispatchMessage ( &);
}
}
else
{
glClearColor ( 0.0f, 0.0f, 0.0f, 0.0f);
glClear ( GL_COLOR_BUFFER_BIT);
glPushMatrix ( ) ;
glRotatef ( theta, 0.0f, 0.0f, 0.0f);
glBegin ( GL_POLYGON);
glColor3f ( 1.0f, 0.0f, 0.0f); glVertex2f ( -0.1f, 0.1f);
glVertex2f ( -0.5f, -0.9f);
glColor3f ( 0.0f, 0.0f, 1.0f); glVertex2f ( 0.5f, -0.5f);
glVertex2f ( 0.5f, 1.0f);
glVertex2f ( 1.3f, 0.3f);
glVertex2f ( 1.0f, 0.5f);
glEnd ( ) ;
glPopMatrix ( ) ;
SwapBuffers ( hDC);
theta += 1.0f;
Sleep ( 1);
}
}
DisableOpenGL ( hWnd, hDC, hRC);
DestroyWindow ( hWnd);
return msg.wParam;
}
LRESULT CALLBACK WndProc ( HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
switch ( message)
{
case WM_CREATE:
return 0;
case WM_CLOSE:
PostQuitMessage ( 0);
return 0;
case WM_DESTROY:
return 0;
case WM_KEYDOWN:
switch ( wParam)
{
case VK_ESCAPE:
PostQuitMessage(0);
return 0;
}
return 0;
default:
return DefWindowProc ( hWnd, message, wParam, lParam);
}
}
void EnableOpenGL ( HWND hWnd, HDC *hDC, HGLRC *hRC)
{
PIXELFORMATDESCRIPTOR pfd;
int iFormat;
ZeroMemory ( &, sizeof ( pfd));
pfd.nSize = sizeof ( pfd);
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW |
PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 24;
pfd.cDepthBits = 16;
pfd.iLayerType = PFD_MAIN_PLANE;
iFormat = ChoosePixelFormat ( *hDC, &);
SetPixelFormat ( *hDC, iFormat, &);
wglMakeCurrent( *hDC, *hRC ) ;
}
void DisableOpenGL ( HWND hWnd, HDC hDC, HGLRC hRC)
{
wglMakeCurrent ( NULL, NULL);
wglDeleteContext ( hRC);
ReleaseDC ( hWnd, hDC);
}
aidez moi please !
help me ! !!
enfin voilà comme il me dit qu´il y a deux erreur il peut pas le compiler j´aimerais avoir votre avis les gars
ben, dis nous quelles sont ces erreurs ? !
c clair
Calculator, t´aurais pas foiré ton copié collé du code ![]()
ah na les erreurs sont qu´il ne trouve pas le fichier windows.h alors qu´il est bien dans la librairie et que le répertoire d´accès est valide !
j´ai demandé à JYY il ne savait pas non plus...
Enléves les deux espaces dans < windows.h>
bien joué freedix ! il n´en reste plus qu´une qui est un peu spéciale et qui a changé depuis que tu m´as corrigé c´est ça:
C:\DOCUME~1\DANIEL~1.JUR\LOCALS~1\Temp\cc4Ocaaa.o(
.text+0x17c):untitl~1.cpp: undefined reference to `glClearColor@16´
C:\DOCUME~1\DANIEL~1.JUR\LOCALS~1\Temp\cc4Ocaaa.o(
.text+0x189):untitl~1.cpp: undefined reference to `glClear@4´
C:\DOCUME~1\DANIEL~1.JUR\LOCALS~1\Temp\cc4Ocaaa.o(
.text+0x191):untitl~1.cpp: undefined reference to `glPushMatrix@0´
C:\DOCUME~1\DANIEL~1.JUR\LOCALS~1\Temp\cc4Ocaaa.o(
.text+0x1a5):untitl~1.cpp: undefined reference to `glRotatef@16´
C:\DOCUME~1\DANIEL~1.JUR\LOCALS~1\Temp\cc4Ocaaa.o(
.text+0x1af):untitl~1.cpp: undefined reference to `glBegin@4´
C:\DOCUME~1\DANIEL~1.JUR\LOCALS~1\Temp\cc4Ocaaa.o(
.text+0x1c3):untitl~1.cpp: undefined reference to `glColor3f@12´
C:\DOCUME~1\DANIEL~1.JUR\LOCALS~1\Temp\cc4Ocaaa.o(
.text+0x1e6):untitl~1.cpp: undefined reference to `glVertex2f@8´
C:\DOCUME~1\DANIEL~1.JUR\LOCALS~1\Temp\cc4Ocaaa.o(
.text+0x209):untitl~1.cpp: undefined reference to `glVertex2f@8´
C:\DOCUME~1\DANIEL~1.JUR\LOCALS~1\Temp\cc4Ocaaa.o(
.text+0x21d):untitl~1.cpp: undefined reference to `glColor3f@12´
C:\DOCUME~1\DANIEL~1.JUR\LOCALS~1\Temp\cc4Ocaaa.o(
.text+0x240):untitl~1.cpp: undefined reference to `glVertex2f@8´
C:\DOCUME~1\DANIEL~1.JUR\LOCALS~1\Temp\cc4Ocaaa.o(
.text+0x25c):untitl~1.cpp: undefined reference to `glVertex2f@8´
C:\DOCUME~1\DANIEL~1.JUR\LOCALS~1\Temp\cc4Ocaaa.o(
.text+0x27f):untitl~1.cpp: undefined reference to `glVertex2f@8´
C:\DOCUME~1\DANIEL~1.JUR\LOCALS~1\Temp\cc4Ocaaa.o(
.text+0x29b):untitl~1.cpp: undefined reference to `glVertex2f@8´
C:\DOCUME~1\DANIEL~1.JUR\LOCALS~1\Temp\cc4Ocaaa.o(
.text+0x2a3):untitl~1.cpp: undefined reference to `glEnd@0´
C:\DOCUME~1\DANIEL~1.JUR\LOCALS~1\Temp\cc4Ocaaa.o(
.text+0x2a8):untitl~1.cpp: undefined reference to `glPopMatrix@0´
C:\DOCUME~1\DANIEL~1.JUR\LOCALS~1\Temp\cc4Ocaaa.o(
.text+0x427):untitl~1.cpp: undefined reference to `wglCreateContext@4´
C:\DOCUME~1\DANIEL~1.JUR\LOCALS~1\Temp\cc4Ocaaa.o(
.text+0x445):untitl~1.cpp: undefined reference to `wglMakeCurrent@8´
C:\DOCUME~1\DANIEL~1.JUR\LOCALS~1\Temp\cc4Ocaaa.o(
.text+0x462):untitl~1.cpp: undefined reference to `wglMakeCurrent@8´
C:\DOCUME~1\DANIEL~1.JUR\LOCALS~1\Temp\cc4Ocaaa.o(
.text+0x471):untitl~1.cpp: undefined reference to `wglDeleteContext@4´
euh c´est quoi le problème ?
Neoprogrhammer Posté le 04 octobre 2003 à 21:50:50
bien joué freedix !
Merci merci
Il faut que tu linke la lib opengl32 :
Tu tapes :
-lopengl32
Et tu met comme type de projet : Win32 GUI
c´est où que tu linke la lib ?
// Includes
// Function Declarations
LRESULT CALLBACK
WndProc( HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam ) ;
VOID EnableOpenGL( HWND hWnd, HDC * hDC, HGLRC * hRC ) ;
VOID DisableOpenGL( HWND hWnd, HDC hDC, HGLRC hRC ) ;
// WinMain
int WINAPI
WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int iCmdShow )
{
WNDCLASS wc;
HWND hWnd;
HDC hDC;
HGLRC hRC;
MSG msg;
BOOL bQuit = FALSE;
float theta = 0.0f;
// register window class
wc.style = CS_OWNDC;
wc.lpfnWndProc = WndProc;
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( BLACK_BRUSH ) ;
wc.lpszMenuName = NULL;
wc.lpszClassName = " GLSample";
RegisterClass( & ) ;
// create main window
hWnd = CreateWindow(
" GLSample", " OpenGL Sample",
WS_CAPTION | WS_POPUPWINDOW | WS_VISIBLE,
0, 0, 256, 256,
NULL, NULL, hInstance, NULL ) ;
// enable OpenGL for the window
EnableOpenGL( hWnd, &, & ) ;
// program main loop
while ( ! bQuit ) {
// check for messages
if ( PeekMessage( &, NULL, 0, 0, PM_REMOVE ) ) {
// handle or dispatch messages
if ( msg.message == WM_QUIT ) {
bQuit = TRUE;
} else {
TranslateMessage( & ) ;
DispatchMessage( & ) ;
}
} else {
// OpenGL animation code goes here
}
}
// shutdown OpenGL
DisableOpenGL( hWnd, hDC, hRC ) ;
// destroy the window explicitly
DestroyWindow( hWnd ) ;
return msg.wParam;
}
// Window Procedure
LRESULT CALLBACK
WndProc( HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam )
{
switch ( message ) {
case WM_CREATE:
return 0;
case WM_CLOSE:
PostQuitMessage( 0 ) ;
return 0;
case WM_DESTROY:
return 0;
case WM_KEYDOWN:
switch ( wParam ) {
case VK_ESCAPE:
PostQuitMessage( 0 ) ;
return 0;
}
return 0;
default:
return DefWindowProc( hWnd,
message, wParam, lParam ) ;
}
}
// Enable OpenGL
VOID EnableOpenGL( HWND hWnd, HDC * hDC, HGLRC * hRC )
{
PIXELFORMATDESCRIPTOR pfd;
int iFormat;
// get the device context ( DC)
// set the pixel format for the DC
ZeroMemory( &, sizeof( pfd ) ) ;
pfd.nSize = sizeof( pfd ) ;
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW |
PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 24;
pfd.cDepthBits = 16;
pfd.iLayerType = PFD_MAIN_PLANE;
iFormat = ChoosePixelFormat( *hDC, & ) ;
SetPixelFormat( *hDC, iFormat, & ) ;
// create and enable the render context ( RC)
wglMakeCurrent( *hDC, *hRC ) ;
}
// Disable OpenGL
VOID DisableOpenGL( HWND hWnd, HDC hDC, HGLRC hRC )
{
wglMakeCurrent( NULL, NULL ) ;
wglDeleteContext( hRC ) ;
ReleaseDC( hWnd, hDC ) ;
}
quand je l´exécute il ouvre une fenetre tte noir c normal ?
Projet -> Options du projet ( Alt + P) Et tout en bas tu marques -lopengl32
? ?? hey freedix je viens de chopé se source en exemple dans DEV-C++ tu trouves pas qu´il ressemble au code de Calculator un peu plus haut ?
je veux dire, à part les commentaires tu remarque pas la ressemblance ?
bizarre...
surtout au début m´enfin les prog en openGl doivent tous commencer pareil ce doit etre ça...
Oui c´est la même
Si tu veux comprendre tu relis tout le topic de calculator.
Pour te résumer, calculator avait mis la source d´un programme OpenGL en disant que c´était lui qui l´avait faite.
oui je sais freedix, merci j´étais là...
seulement je savais pas sur quel exemple il l´avait pris, ben maintenant je sais... ![]()