diff --git a/basis/opengl/authors.txt b/basis/opengl/authors.txt index 55ac3c728e..f4e25322b8 100644 --- a/basis/opengl/authors.txt +++ b/basis/opengl/authors.txt @@ -1,3 +1,4 @@ Slava Pestov Eduardo Cavazos Joe Groff +Alex Chapman diff --git a/basis/opengl/gl/authors.txt b/basis/opengl/gl/authors.txt index 1901f27a24..e9c193bac7 100644 --- a/basis/opengl/gl/authors.txt +++ b/basis/opengl/gl/authors.txt @@ -1 +1 @@ -Slava Pestov +Alex Chapman diff --git a/basis/opengl/glu/authors.txt b/basis/opengl/glu/authors.txt deleted file mode 100644 index 1901f27a24..0000000000 --- a/basis/opengl/glu/authors.txt +++ /dev/null @@ -1 +0,0 @@ -Slava Pestov diff --git a/basis/opengl/opengl.factor b/basis/opengl/opengl.factor index c60917b42a..72ca8b8cdb 100644 --- a/basis/opengl/opengl.factor +++ b/basis/opengl/opengl.factor @@ -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 ) diff --git a/basis/ui/render/render.factor b/basis/ui/render/render.factor index 09c26fd271..c4e6f56886 100755 --- a/basis/ui/render/render.factor +++ b/basis/ui/render/render.factor @@ -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 ; diff --git a/extra/4DNav/camera/camera.factor b/extra/4DNav/camera/camera.factor index 1f36a46275..0d46d73f55 100755 --- a/extra/4DNav/camera/camera.factor +++ b/extra/4DNav/camera/camera.factor @@ -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 diff --git a/extra/opengl/glu/authors.txt b/extra/opengl/glu/authors.txt new file mode 100644 index 0000000000..e9c193bac7 --- /dev/null +++ b/extra/opengl/glu/authors.txt @@ -0,0 +1 @@ +Alex Chapman diff --git a/basis/opengl/glu/glu.factor b/extra/opengl/glu/glu.factor similarity index 97% rename from basis/opengl/glu/glu.factor rename to extra/opengl/glu/glu.factor index d603724a55..fe060e3553 100644 --- a/basis/opengl/glu/glu.factor +++ b/extra/opengl/glu/glu.factor @@ -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 ; \ No newline at end of file diff --git a/basis/opengl/glu/summary.txt b/extra/opengl/glu/summary.txt similarity index 100% rename from basis/opengl/glu/summary.txt rename to extra/opengl/glu/summary.txt diff --git a/basis/opengl/glu/tags.txt b/extra/opengl/glu/tags.txt similarity index 100% rename from basis/opengl/glu/tags.txt rename to extra/opengl/glu/tags.txt diff --git a/vm/Config.unix b/vm/Config.unix index 339c3c3ffb..1f48847542 100644 --- a/vm/Config.unix +++ b/vm/Config.unix @@ -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