CONNEXION
  • RetourJeux
    • Sorties
    • Hit Parade
    • Les + populaires
    • Les + attendus
    • Soluces
    • Tous les Jeux
    • Gaming
  • RetourActu Gaming
    • News
    • Astuces
    • Tests
    • Previews
    • Toute l'actu gaming
  • RetourBons plans
    • Bons plans
    • Bons plans Smartphone
    • Bons plans Hardware
    • Bons plans Image et Son
    • Bons plans Amazon
    • Bons plans Cdiscount
    • Bons plans Decathlon
    • Bons plans Fnac
    • Tous les Bons plans
  • RetourJVTech
    • Actus High-Tech
    • Intelligence Artificielle
    • Smartphones
    • Mobilité urbaine
    • Hardware
    • Image et son
    • Tutoriels
    • Tests produits High-Tech
    • Guides d'achat High-Tech
    • JVTech
  • RetourCulture
    • Actus Culture
    • Culture
  • RetourVidéos
    • A la une
    • Gaming Live
    • Vidéos Tests
    • Vidéos Previews
    • Gameplay
    • Trailers
    • Chroniques
    • Replay Web TV
    • Toutes les vidéos
  • RetourForums
    • Hardware PC
    • PS5
    • Switch 2
    • Xbox Series
    • Switch
    • Pokemon pocket
    • FC 25 Ultimate Team
    • League of Legends
    • Tous les Forums
  • PC
  • PS5
  • Xbox Series
  • Switch 2
  • PS4
  • One
  • Switch
  • iOS
  • Android
  • MMO
  • RPG
  • FPS
En ce moment Genshin Impact Valhalla Breath of the wild Animal Crossing GTA 5 Red dead 2
Liste des sujets

question sur un programme en openGL

Neoprogrhammer
Neoprogrhammer
Niveau 6
04 octobre 2003 à 01:00:34

ok merci du conseil mais tu sais je suis vraiment une grosse m*rde et je crois que ça me fera pas de mal
@++

Calculator_V2
Calculator_V2
Niveau 10
04 octobre 2003 à 01:19:56

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.

Neoprogrhammer
Neoprogrhammer
Niveau 6
04 octobre 2003 à 11:22:35

euh claculatro le lien que tu as posté est un lien qui conduit à rien le sujet est mort...

freedix
freedix
Niveau 10
04 octobre 2003 à 11:33:07

C´est parce qu´il à copié directement l´adresse de i_am_the_law.

Et il a laissé le [...] :)

Neoprogrhammer
Neoprogrhammer
Niveau 6
04 octobre 2003 à 11:35:13

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

  1. include < windows.h>
  2. include < gl/gl.h>

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;

  • hDC = GetDC ( hWnd);

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, &);

  • hRC = wglCreateContext( *hDC ) ;

wglMakeCurrent( *hDC, *hRC ) ;

}

void DisableOpenGL ( HWND hWnd, HDC hDC, HGLRC hRC)
{
wglMakeCurrent ( NULL, NULL);
wglDeleteContext ( hRC);
ReleaseDC ( hWnd, hDC);
}

Neoprogrhammer
Neoprogrhammer
Niveau 6
04 octobre 2003 à 16:25:02

:up: aidez moi please !
help me ! !!

ackeur
ackeur
Niveau 8
04 octobre 2003 à 18:41:07

enfin voilà comme il me dit qu´il y a deux erreur il peut pas le compiler j´aimerais avoir votre avis les gars
:d) ben, dis nous quelles sont ces erreurs ? !

Calculator_V2
Calculator_V2
Niveau 10
04 octobre 2003 à 18:53:11

c clair

freedix
freedix
Niveau 10
04 octobre 2003 à 19:19:56

Calculator, t´aurais pas foiré ton copié collé du code :rire2:

Neoprogrhammer
Neoprogrhammer
Niveau 6
04 octobre 2003 à 21:15:51

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...

freedix
freedix
Niveau 10
04 octobre 2003 à 21:22:18

Enléves les deux espaces dans < windows.h>

Neoprogrhammer
Neoprogrhammer
Niveau 6
04 octobre 2003 à 21:50:50

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 ?

freedix
freedix
Niveau 10
04 octobre 2003 à 22:02:01

Neoprogrhammer Posté le 04 octobre 2003 à 21:50:50
bien joué freedix !
Merci merci :rire2:

Il faut que tu linke la lib opengl32 :
Tu tapes :
-lopengl32
Et tu met comme type de projet : Win32 GUI

Neoprogrhammer
Neoprogrhammer
Niveau 6
04 octobre 2003 à 22:20:52

c´est où que tu linke la lib ?

Neoprogrhammer
Neoprogrhammer
Niveau 6
04 octobre 2003 à 22:24:23

// Includes

  1. include < windows.h>
  2. include < gl/gl.h>

// 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)

  • hDC = GetDC( hWnd ) ;

// 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)

  • hRC = wglCreateContext( *hDC ) ;

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 ?

freedix
freedix
Niveau 10
04 octobre 2003 à 22:25:52

Projet -> Options du projet ( Alt + P) Et tout en bas tu marques -lopengl32

Neoprogrhammer
Neoprogrhammer
Niveau 6
04 octobre 2003 à 22:27:29

? ?? 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...

Neoprogrhammer
Neoprogrhammer
Niveau 6
04 octobre 2003 à 22:34:25

surtout au début m´enfin les prog en openGl doivent tous commencer pareil ce doit etre ça...

freedix
freedix
Niveau 10
04 octobre 2003 à 22:41:14

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.

Neoprogrhammer
Neoprogrhammer
Niveau 6
05 octobre 2003 à 15:16:10

oui je sais freedix, merci j´étais là...
seulement je savais pas sur quel exemple il l´avait pris, ben maintenant je sais... :)

Sous forums
  • Aide à l'achat Mac
  • Création de Jeux
  • Linux
  • Programmation
  • Création de sites web
  • Internet
  • Steam Deck
  • Macintosh
  • Hardware
La vidéo du moment