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

Il faut m'aider avec un code d'open gl

viking63
viking63
Niveau 8
02 mai 2005 à 17:51:30
  1. include < windows.h>
  2. include < gl/gl.h>
  3. include < gl/glu.h>

WNDCLASS wc;
MSG msg;
HWND hWnd;
HDC DC;
HGLRC RC;

void RePaint ( )
{
glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode ( GL_MODELVIEW);
glLoadIdentity ( );

gluLookAt ( 7,7,-10,0,0,0,0,1,0);

glEnable(GL_DEPTH_TEST);

glBegin ( GL_QUADS);
glColor3d ( 0,1,1);glVertex3i ( -1,-1,1);
glColor3d ( 1,0,0);glVertex3i ( -1,1,1);
glColor3d ( 0,1,0);glVertex3i ( 1,1,1);
glColor3d ( 1,0,1);glVertex3i ( 1,-1,1);

glColor3d ( 0,0,1);glVertex3i ( -1,-1,-1);
glColor3d ( 1,1,0);glVertex3i ( -1,1,-1);
glColor3d ( 1,1,1);glVertex3i ( 1,1,-1);
glColor3d ( .5,.5,.5);glVertex3i ( 1,-1,-1);

glColor3d ( 1,1,0);glVertex3i ( -1,1,-1);
glColor3d ( 1,1,1);glVertex3i ( 1,1,-1);
glColor3d ( 0,1,0);glVertex3i ( 1,1,1);
glColor3d ( 1,0,0);glVertex3i ( -1,1,1);

glColor3d ( 0,0,1);glVertex3i ( -1,-1,-1);
glColor3d ( .5,.5,.5);glVertex3i ( 1,-1,-1);
glColor3d ( 1,0,1);glVertex3i ( 1,-1,1);
glColor3d ( 0,1,1);glVertex3i ( -1,-1,1);

glColor3d ( 0,0,1);glVertex3i ( -1,-1,-1);
glColor3d ( 0,1,1);glVertex3i ( -1,-1,1);
glColor3d ( 1,0,0);glVertex3i ( -1,1,1);
glColor3d ( 1,1,0);glVertex3i ( -1,1,-1);

glColor3d ( .5,.5,.5);glVertex3i ( 1,-1,-1);
glColor3d ( 1,0,1);glVertex3i ( 1,-1,1);
glColor3d ( 0,1,0);glVertex3i ( 1,1,1);
glColor3d ( 1,1,1);glVertex3i ( 1,1,-1);
glEnd();

glBegin ( GL_QUADS);
glColor3d ( 1,0,0);
glVertex3i ( -6,-1,1);
glVertex3i ( -6,1,1);
glVertex3i ( -4,1,1);
glVertex3i ( -4,-1,1);
glColor3d ( 0,1,0);
glVertex3i ( -6,-1,-1);
glVertex3i ( -6,1,-1);
glVertex3i ( -4,1,-1);
glVertex3i ( -4,-1,-1);
glColor3d ( 1,1,0);
glVertex3i ( -6,1,-1);
glVertex3i ( -4,1,-1);
glVertex3i ( -4,1,1);
glVertex3i ( -6,1,1);
glColor3d ( 0,0,0);
glVertex3i ( -6,-1,-1);
glVertex3i ( -4,-1,-1);
glVertex3i ( -4,-1,1);
glVertex3i ( -6,-1,1);
glColor3d ( 0,1,1);
glVertex3i ( -6,-1,-1);
glVertex3i ( -6,-1,1);
glVertex3i ( -6,1,1);
glVertex3i ( -6,1,-1);
glColor3d ( 1,0,1);
glVertex3i ( -4,-1,-1);
glVertex3i ( -4,-1,1);
glVertex3i ( -4,1,1);
glVertex3i ( -4,1,-1);
glEnd();

glDisable(GL_DEPTH_TEST);

glBegin ( GL_QUADS);
glColor3d ( 0,1,1);glVertex3i ( 4,-1,1);
glColor3d ( 1,0,0);glVertex3i ( 4,1,1);
glColor3d ( 0,1,0);glVertex3i ( 6,1,1);
glColor3d ( 1,0,1);glVertex3i ( 6,-1,1);

glColor3d ( 0,0,1);glVertex3i ( 4,-1,-1);
glColor3d ( 1,1,0);glVertex3i ( 4,1,-1);
glColor3d ( 1,1,1);glVertex3i ( 6,1,-1);
glColor3d ( .5,.5,.5);glVertex3i ( 6,-1,-1);

glColor3d ( 1,1,0);glVertex3i ( 4,1,-1);
glColor3d ( 1,1,1);glVertex3i ( 6,1,-1);
glColor3d ( 0,1,0);glVertex3i ( 6,1,1);
glColor3d ( 1,0,0);glVertex3i ( 4,1,1);

glColor3d ( 0,0,1);glVertex3i ( 4,-1,-1);
glColor3d ( .5,.5,.5);glVertex3i ( 6,-1,-1);
glColor3d ( 1,0,1);glVertex3i ( 6,-1,1);
glColor3d ( 0,1,1);glVertex3i ( 4,-1,1);

glColor3d ( 0,0,1);glVertex3i ( 4,-1,-1);
glColor3d ( 0,1,1);glVertex3i ( 4,-1,1);
glColor3d ( 1,0,0);glVertex3i ( 4,1,1);
glColor3d ( 1,1,0);glVertex3i ( 4,1,-1);

glColor3d ( .5,.5,.5);glVertex3i ( 6,-1,-1);
glColor3d ( 1,0,1);glVertex3i ( 6,-1,1);
glColor3d ( 0,1,0);glVertex3i ( 6,1,1);
glColor3d ( 1,1,1);glVertex3i ( 6,1,-1);
glEnd();

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

LRESULT CALLBACK WindowProc ( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch ( uMsg)
{
case WM_CREATE:
DC=GetDC ( hwnd);
InitPixelFormat ( DC);
RC = wglCreateContext ( DC);
wglMakeCurrent ( DC, RC);
glEnable ( GL_DEPTH_TEST);
glClearColor ( 0,0,1,0);
break;
case WM_CLOSE:
wglMakeCurrent ( NULL, NULL);
wglDeleteContext ( RC);
ReleaseDC ( hwnd,DC);
PostQuitMessage ( 0);
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;
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(&);

hWnd = CreateWindow
("OGL", " Fenetre OpenGL",
WS_CAPTION | WS_POPUPWINDOW | WS_VISIBLE,
0, 0, 640, 480, NULL, NULL, hInstance, NULL
);

while ( GetMessage(&, NULL, 0, 0)) {
TranslateMessage(&);
DispatchMessage(&);
}

return 0;
}
Et quang je compile(g dev C/C++ il me met aucune faut mais dans complier and liker output il ya un 50aine de faute vous pourriez m´aider a résoudre ce probleme

JeanYvesYves
JeanYvesYves
Niveau 10
02 mai 2005 à 18:00:11

précise les fautes : mais a mon avis, tu as simplement oublié de linker les libs de OpenGL...

viking63
viking63
Niveau 8
02 mai 2005 à 18:02:24

Ah oui merci j´avais oublier je vais essayer

viking63
viking63
Niveau 8
02 mai 2005 à 18:08:18

merci JeanYvesYves c super cool

JeanYvesYves
JeanYvesYves
Niveau 10
02 mai 2005 à 18:14:14

ça marche alors ? :)

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