Bonjour,

Voila je cherche un tuto pour initialiser opengl avec sdl.. MAIS JE TROUVE RIEN
Pour le moment j'ai trouver que des tuto qui initialise opengl mais avec glut..

Normalement je crois que j'reussi a init avec sdl mais je suis pas si sur(je debute quoi), voici mon code:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include "SDL/SDL.h"
#include "GL/gl.h"
#include "GL/glu.h"
 
SDL_Surface * mem,*fond,*balle;
SDL_Event event;
void Init_SDL()
{   
    SDL_Init(SDL_INIT_VIDEO);
    mem = SDL_SetVideoMode ( 774,484,32,SDL_HWSURFACE|SDL_DOUBLEBUF/*|SDL_FULLSCREEN*/);
}
 
void Reshape(int width, int height)
{    
     glViewport(0,0,width,height);
     glMatrixMode(GL_PROJECTION);
     glLoadIdentity();
     gluPerspective(45,float(width)/float(height),0,100);
    glMatrixMode(GL_MODELVIEW);
 
}
void attentekey()         
{
   while(1)         
   {
      while(SDL_PollEvent(&event))   
      {
         if (event.type == SDL_KEYDOWN)
         {
            if (event.key.keysym.sym == SDLK_RETURN) return;
         }
      }
   }
}
 
int main(int argc,char **argv)
{
 
 
    SDL_Rect rballe;
    SDL_Rect rfond;
    Init_SDL();
    /*fond = SDL_LoadBMP("sub.bmp");
    balle = SDL_LoadBMP("b18.bmp");
    rballe.x = 0;
    rballe.y = 0;
    rfond.x = 0;
    rfond.y = 0;
    int sx=1,sy=1;
while (1)
{   
    SDL_PollEvent(&event);         
    if (event.type == SDL_KEYDOWN && event.key.keysym.sym == SDLK_RETURN)
   
    break;
 
    rballe.x += 3 * sx;
    rballe.y += 3 * sy;
    if (rballe.x <0) sx = + 1;
    if (rballe.y <0) sy = + 1;
    if (rballe.x > 730) sx = - 1;
    if (rballe.y > 440) sy = -1;
    SDL_SetColorKey(balle,SDL_SRCCOLORKEY,SDL_MapRGBA(balle->format,255,0,255,0));   
    SDL_BlitSurface(fond,NULL,mem,&rfond);
    SDL_BlitSurface(balle,NULL,mem,&rballe);
    SDL_Flip(screen);
}*/
    attentekey();
    SDL_Quit();
    return 0;
}
Si vous avez un lien vers un tuto pour sdl + opengl je suis preneur.

MERCI d'avance