Refactor GLU usages in basis, and move opengl.glu to extra, and don't like VM with GLU

db4
Slava Pestov 2009-04-11 15:17:08 -05:00
parent b75e6ff445
commit db3818814d
11 changed files with 37 additions and 14 deletions

View File

@ -1,3 +1,4 @@
Slava Pestov
Eduardo Cavazos
Joe Groff
Alex Chapman

View File

@ -1 +1 @@
Slava Pestov
Alex Chapman

View File

@ -1 +0,0 @@
Slava Pestov

View File

@ -3,7 +3,7 @@
! Portions copyright (C) 2008 Joe Groff.
! See http://factorcode.org/license.txt for BSD license.
USING: alien alien.c-types continuations kernel libc math macros
namespaces math.vectors math.parser opengl.gl opengl.glu combinators
namespaces math.vectors math.parser opengl.gl combinators
combinators.smart arrays sequences splitting words byte-arrays assocs
colors colors.constants accessors generalizations locals fry
specialized-arrays.float specialized-arrays.uint ;
@ -16,10 +16,23 @@ IN: opengl
: gl-clear ( color -- )
gl-clear-color GL_COLOR_BUFFER_BIT glClear ;
: error>string ( n -- string )
H{
{ HEX: 0 "No error" }
{ HEX: 0501 "Invalid value" }
{ HEX: 0500 "Invalid enumerant" }
{ HEX: 0502 "Invalid operation" }
{ HEX: 0503 "Stack overflow" }
{ HEX: 0504 "Stack underflow" }
{ HEX: 0505 "Out of memory" }
} at "Unknown error" or ;
TUPLE: gl-error code string ;
: gl-error ( -- )
glGetError dup zero? [
"GL error: " over gluErrorString append throw
] unless drop ;
glGetError dup 0 = [ drop ] [
dup error>string \ gl-error boa throw
] if ;
: do-enabled ( what quot -- )
over glEnable dip glDisable ; inline
@ -151,9 +164,6 @@ MACRO: all-enabled-client-state ( seq quot -- )
MACRO: set-draw-buffers ( buffers -- )
words>values '[ _ (set-draw-buffers) ] ;
: gl-look-at ( eye focus up -- )
[ first3 ] tri@ gluLookAt ;
: gen-dlist ( -- id ) 1 glGenLists ;
: make-dlist ( type quot -- id )

View File

@ -1,7 +1,7 @@
! Copyright (C) 2005, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: math.rectangles math.vectors namespaces kernel accessors
assocs combinators sequences opengl opengl.gl opengl.glu colors
assocs combinators sequences opengl opengl.gl colors
colors.constants ui.gadgets ui.pens ;
IN: ui.render
@ -22,7 +22,7 @@ SYMBOL: viewport-translation
dim>>
[ { 0 1 } v* viewport-translation set ]
[ [ { 0 0 } ] dip gl-viewport ]
[ [ 0 ] dip first2 0 gluOrtho2D ] tri
[ [ 0 ] dip first2 0 1 -1 glOrtho ] tri
]
[ clip set ] bi
do-clip ;

View File

@ -1,4 +1,4 @@
USING: kernel namespaces math.vectors opengl 4DNav.turtle ;
USING: kernel namespaces math.vectors opengl opengl.glu 4DNav.turtle ;
IN: 4DNav.camera

View File

@ -0,0 +1 @@
Alex Chapman

View File

@ -1,8 +1,17 @@
! Copyright (C) 2005 Alex Chapman.
! See http://factorcode.org/license.txt for BSD license.
USING: alien alien.syntax kernel sequences words ;
USING: alien alien.libraries alien.syntax kernel sequences words system
combinators ;
IN: opengl.glu
os {
{ [ dup macosx? ] [ drop ] }
{ [ dup windows? ] [ drop ] }
{ [ dup unix? ] [ drop "glu" "libGLU.so.1" "cdecl" add-library ] }
} cond
LIBRARY: glu
! These are defined as structs in glu.h, but we only ever use pointers to them
TYPEDEF: void* GLUnurbs*
TYPEDEF: void* GLUquadric*
@ -253,3 +262,6 @@ FUNCTION: GLint gluUnProject ( GLdouble winX, GLdouble winY, GLdouble winZ, GLdo
! FUNCTION: GLint gluBuild3DMipmaps ( GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void* data ) ;
! FUNCTION: GLboolean gluCheckExtension ( GLubyte* extName, GLubyte* extString ) ;
! FUNCTION: GLint gluUnProject4 ( GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble clipW, GLdouble* model, GLdouble* proj, GLint* view, GLdouble nearVal, GLdouble farVal, GLdouble* objX, GLdouble* objY, GLdouble* objZ, GLdouble* objW ) ;
: gl-look-at ( eye focus up -- )
[ first3 ] tri@ gluLookAt ;

View File

@ -14,7 +14,7 @@ PLAF_EXE_OBJS += vm/main-unix.o
ifdef NO_UI
X11_UI_LIBS =
else
X11_UI_LIBS = -lpango-1.0 -lpangocairo-1.0 -lcairo -lglib-2.0 -lgobject-2.0 -lGL -lGLU -lX11
X11_UI_LIBS = -lpango-1.0 -lpangocairo-1.0 -lcairo -lglib-2.0 -lgobject-2.0 -lGL -lX11
endif
# CFLAGS += -fPIC