diff --git a/basis/opengl/opengl.factor b/basis/opengl/opengl.factor index 72ca8b8cdb..7d79516a2c 100644 --- a/basis/opengl/opengl.factor +++ b/basis/opengl/opengl.factor @@ -25,6 +25,7 @@ IN: opengl { HEX: 0503 "Stack overflow" } { HEX: 0504 "Stack underflow" } { HEX: 0505 "Out of memory" } + { HEX: 0506 "Invalid framebuffer operation" } } at "Unknown error" or ; TUPLE: gl-error code string ; @@ -190,4 +191,4 @@ MACRO: set-draw-buffers ( buffers -- ) GL_PROJECTION glMatrixMode glLoadIdentity GL_MODELVIEW glMatrixMode - glLoadIdentity ; \ No newline at end of file + glLoadIdentity ; diff --git a/basis/opengl/shaders/shaders.factor b/basis/opengl/shaders/shaders.factor index 15fab1aae0..a946fd16f4 100755 --- a/basis/opengl/shaders/shaders.factor +++ b/basis/opengl/shaders/shaders.factor @@ -61,10 +61,21 @@ PREDICATE: fragment-shader < gl-shader (fragment-shader?) ; ! Programs +: ( shaders frag-data-locations -- program ) + glCreateProgram + [ + [ swap [ glAttachShader ] with each ] + [ swap [ first2 swap glBindFragDataLocationEXT ] with each ] bi-curry bi* + ] + [ glLinkProgram ] + [ ] tri + gl-error ; + : ( shaders -- program ) - glCreateProgram swap - [ dupd glAttachShader ] each - [ glLinkProgram ] keep + glCreateProgram + [ swap [ glAttachShader ] with each ] + [ glLinkProgram ] + [ ] tri gl-error ; : (gl-program?) ( object -- ? )