www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 42a3573d89aa857a083e9749f0baa2786d6d3dc4
parent 414a20c196cc222243a24a382039308080fa69d6
Author: Yoann <yoann.b87@voila.fr>
Date:   Mon, 26 Sep 2011 21:17:39 +0200

Code de base permettant d'ouvrir un fenêtre initialisée avec un contexte OpenGL 2.1. (Fenetre générée avec SDL).

Diffstat:
Adisplay.c | 36++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+), 0 deletions(-)

diff --git a/display.c b/display.c @@ -0,0 +1,36 @@ +#include <SDL/SDL.h> +#include <GL/gl.h> +#include <GL/glu.h> + +int main(int argc, char *argv[]) { + SDL_Init(SDL_INIT_VIDEO); + SDL_WM_SetCaption("Mon premier programme OpenGL !",NULL); + SDL_SetVideoMode(640, 480, 32, SDL_OPENGL); + + short continuer = 1; + SDL_Event event; + + while (continuer) { + SDL_WaitEvent(&event); + + switch(event.type) { + case SDL_QUIT: + continuer = 0; + } + + glClear(GL_COLOR_BUFFER_BIT); + + glBegin(GL_TRIANGLES); + glColor3ub(255,0,0); glVertex2d(-0.75,-0.75); + glColor3ub(0,255,0); glVertex2d(0,0.75); + glColor3ub(0,0,255); glVertex2d(0.75,-0.75); + glEnd(); + + glFlush(); + SDL_GL_SwapBuffers(); + } + + SDL_Quit(); + + return 0; +}