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
|
procedure OnResize(width, height : integer); STDCALL;
begin
glViewPort(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity;
gluPerspective(60, width/height, 1.0, 3000.0);
end;
begin
glfwInit;
glfwOpenWindow(800,600, 0, 0, 0, 0, 0, 0, GLFW_WINDOW );
glClearColor( 0.0, 0.0, 0.0, 0.0 );
glfwSetWindowSizeCallBack(OnResize);
glfwEnable( GLFW_STICKY_KEYS );
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glDepthFunc(GL_LESS);
glClear( GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT );
glMatrixMode(GL_MODELVIEW);
glLoadIdentity;
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
// chargement de chaque boutton
glGenTextures(1, @ta);
glBindTexture(GL_TEXTURE_2D,ta);
glfwLoadTexture2D('Textures/menu/jouer.tga', GLFW_BUILD_MIPMAPS_BIT);
running := 1;
while running <> 0 do begin
gluLookAt(0, 0, 0, 1, 0, 0, 0,0,1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glOrtho(0, 800, 600, 0, 0, 100);
glBindTexture(GL_TEXTURE_2D, ta);
glBegin(GL_QUADS);
glTexCoord2f(0,0); glVertex2i(90, 500);
glTexCoord2f(0,1); glVertex2i(90,90);
glTexCoord2f(1,1); glVertex2i(720,90);
glTexCoord2f(1,0); glVertex2i(720,500);
glEnd;
glfwGetMousePos(MouseX,MouseY);
writeln(inttostr(MouseX)+' ; '+inttostr(MouseY));
if glfwGetKey(GLFW_KEY_ESC) = 1 then running := 0;
end;
glfwTerminate;
end. |
Partager