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

Probleme avec les open gl

viking63
viking63
Niveau 8
04 mai 2005 à 14:00:29

Voila mon script:

  1. include < windows.h>
  2. include < gl/gl.h>
  3. include < gl/glu.h>
  4. include < gl/glaux.h>

WNDCLASS wc;
MSG msg;
HWND hWnd;
HDC DC;
HGLRC RC;
unsigned texture[1];
int z;

void LoadTexture()
{
AUX_RGBImageRec *texture1;
texture1 = auxDIBImageLoad("machin.bmp");
glGenTextures ( 1, &[0]);
glBindTexture ( GL_TEXTURE_2D, texture[0]);
glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, 3, texture1->sizeX, texture1->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, texture1->data);
};

void RePaint ( )
{
z = -10;
glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode ( GL_MODELVIEW);
glLoadIdentity ( );
glEnable ( GL_TEXTURE_2D);
gluLookAt(0,0,z,0,0,z+10,0,1,0);

glBegin(GL_QUADS);
glTexCoord2i(1,0);glVertex2i(-1,-1);
glTexCoord2i(1,1);glVertex2i(-1,1);
glTexCoord2i(0,1);glVertex2i(1,1);
glTexCoord2i(0,0);glVertex2i(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);
glEnable(GL_TEXTURE_2D);
LoadTexture();
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;
case WM_KEYDOWN:
switch ( wParam) {
case VK_DOWN:
z--;
break;
case VK_UP:
z++;
break;
default:
break;
}
break;
case WM_LBUTTONDOWN:
z--;
break;

case WM_RBUTTONDOWN:
z++;
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;
}
La compilation est correcte mais dev C/C++ me met :"Failed to open DIB file machin.bmp"
Merci de m´aider

jejej
jejej
Niveau 9
04 mai 2005 à 14:03:40

tu as bien une imge bmp dans le meme repertoire que ton projet ? et fait gaffe , si tu l´as appelée Machin , ou si c´est pas un bmp , ca marchera pas . ..

viking63
viking63
Niveau 8
04 mai 2005 à 14:05:25

Dans le meme répertoire il ya un fichier qui s´appele machin.bmp

viking63
viking63
Niveau 8
04 mai 2005 à 14:12:31

alors?

pandamark
pandamark
Niveau 6
04 mai 2005 à 14:13:36

On n´est pas sur un chat ici.

viking63
viking63
Niveau 8
04 mai 2005 à 14:14:06

Pk tu di ca

pandamark
pandamark
Niveau 6
04 mai 2005 à 14:22:05

Je ne sais pas pourquoi moi :sarcastic: .

viking63
viking63
Niveau 8
04 mai 2005 à 15:03:53

Il ny ya personne pr m´aider :snif:

JeanYvesYves
JeanYvesYves
Niveau 10
04 mai 2005 à 18:20:10

passe en débuggage, vérifie les valeurs de retour de tes fonctions, et assure toi que les BMP que tu références dans ton programme sont bien en place, et sans faute de frappe.

gollumkawder
gollumkawder
Niveau 10
04 mai 2005 à 18:36:06

pour une meilleure lisibilité pense a coller ton code sur un wall, ça aide les autres

http://walljv.free.fr par exemple

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