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
|
program Template;
uses
Windows,
Messages,
glut,
OpenGL;
const
WND_TITLE = 'Mes premiers en pas OpenGL';
var
spin : integer;
{$R *.RES}
procedure init();
begin
glclearcolor(0,0,0,0);
glshademodel(gl_flat);
end;
procedure display ;cdecl;
begin
glclear(GL_color_buffer_bit);
glpushmatrix();
glrotate(45,0,0,1);
glcolor3f(1,1,1);
glrectf(-25,-25,25,25);
glpopmatrix();
glutswapbuffers();
end;
procedure reshape(Width, Height : Integer);cdecl;
begin
glViewport(0, 0, Width, Height);
glmatrixmode(gl_projection);
glloadidentity();
glortho(-50,50,-50,50,-1,1);
glmatrixmode(gl_modelview);
glloadidentity();
end;
begin
glutinit(MS_LIB);
glutinitdisplaymode(GLUT_DOUBLE or GLUT_RGB);
glutinitwindowsize(250,250);
glutinitwindowposition(100,100);
glutcreatewindow(WND_TITLE);
init();
glutdisplayfunc(display);
glutreshapefunc(reshape);
glutmainloop();
end. |
Partager