bonjour bonjour...
voila mon prob.. j'essaye d'afficher une simple ligne nooire ds ma fenetre ( créé avec SDL)
et ca ne marche pas ..
je vous laisse le code..
svp help , dites moi ce qui va pas.. j'ai essayé énormement de choses, sans succès
------>
#include <windows.h>
#include <stdlib.h>
#include <SDL.h>
#include <GL/gl.h>
#include <GL/glu.h>
SDL_Surface *Screen;
int Init( void )
{
if ( SDL_Init( SDL_INIT_VIDEO ) == -1 )
{
fprintf(stderr,"Echec lors du chargement de la vidéo : %s", SDL_GetError() );
SDL_Quit();
}
SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 32);
if ( Screen = SDL_SetVideoMode( 640, 480, 32, SDL_OPENGL ) )
{
SDL_WM_SetCaption ("Test", "Test");
glShadeModel(GL_SMOOTH);
glClearColor (1.0f, 1.0f, 1.0f, 1.0f);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
return 1;
}
return 0;
}
void Afficher(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(-1.5f, 0.0f, -10.0f);
glBegin(GL_LINES);
glColor3f(0.0, 0.0, 0.0);
glVertex2i(100,0);
glVertex2i(100,480);
glEnd();
glFlush();
SDL_GL_SwapBuffers ();
}
int main(int argc, char* argv[])
{
//si l'initialisation se passe normalement on pousuit
if (Init())
{
//on afficher notre forme
Afficher();
while (1)
{
SDL_Event event;
SDL_WaitEvent(&event);
//on attend un evenement .. click sur la croix pour sortir par exemple
switch (event.type)
{
case SDL_QUIT:
SDL_Quit();
return 0;
}
}
}
return 0;
}
---->
merci d'avance