From 3091f9b20a548ecd0ff54522db0e17a9685728d3 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 15 Nov 2005 08:29:03 +0000 Subject: [PATCH] misc core changes --- library/opengl/opengl-utils.factor | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/library/opengl/opengl-utils.factor b/library/opengl/opengl-utils.factor index 977189a3d3..ead4cfa6c0 100644 --- a/library/opengl/opengl-utils.factor +++ b/library/opengl/opengl-utils.factor @@ -32,7 +32,7 @@ USING: alien errors kernel math namespaces opengl sdl sequences ; dup resize-event-w swap resize-event-h 0 gl-flags init-surface ; -: with-gl-screen ( quot -- ) +: with-gl-screen ( width height quot -- ) >r 0 gl-flags r> with-screen ; inline : gl-error ( -- ) @@ -42,12 +42,14 @@ USING: alien errors kernel math namespaces opengl sdl sequences ; #! Execute a quotation, locking the current surface if it #! is required (eg, hardware surface). [ init-gl call gl-error ] [ SDL_GL_SwapBuffers ] cleanup ; + inline : do-state ( what quot -- ) swap glBegin call glEnd ; inline : do-matrix ( mode quot -- ) - swap glMatrixMode glPushMatrix call glPopMatrix ; inline + swap [ glMatrixMode glPushMatrix call ] keep + glMatrixMode glPopMatrix ; inline : gl-vertex first3 glVertex3d ; inline @@ -82,7 +84,7 @@ USING: alien errors kernel math namespaces opengl sdl sequences ; #! Draw a filled polygon. dup length 2 > GL_POLYGON GL_LINES ? (gl-poly) ; -: gl-poly ( points color -- ) +: gl-poly ( points -- ) #! Draw a polygon. GL_LINE_LOOP (gl-poly) ;