diff --git a/Makefile b/Makefile index 1042731065..e02b6a672b 100755 --- a/Makefile +++ b/Makefile @@ -140,7 +140,7 @@ factor: $(DLL_OBJS) $(EXE_OBJS) clean: rm -f vm/*.o - rm -f libfactor.a + rm -f factor*.dll libfactor*.* vm/resources.o: windres vm/factor.rs vm/resources.o diff --git a/core/alien/c-types/c-types.factor b/core/alien/c-types/c-types.factor index b665300bee..6d9c2cec14 100755 --- a/core/alien/c-types/c-types.factor +++ b/core/alien/c-types/c-types.factor @@ -358,4 +358,7 @@ M: long-long-type box-return ( type -- ) "ushort*" define-primitive-type [ string>u16-alien ] "ushort*" c-type set-c-type-prep + + win64? "longlong" "long" ? "ptrdiff_t" typedef + ] with-compilation-unit diff --git a/core/alien/syntax/syntax-docs.factor b/core/alien/syntax/syntax-docs.factor index d87b67eb59..858c3f145e 100755 --- a/core/alien/syntax/syntax-docs.factor +++ b/core/alien/syntax/syntax-docs.factor @@ -50,7 +50,13 @@ $nl HELP: TYPEDEF: { $syntax "TYPEDEF: old new" } { $values { "old" "a C type" } { "new" "a C type" } } -{ $description "Alises the C type " { $snippet "old" } " under the name " { $snippet "new" } "." } +{ $description "Aliases the C type " { $snippet "old" } " under the name " { $snippet "new" } " if ." } +{ $notes "This word differs from " { $link typedef } " in that it runs at parse time, to ensure correct ordering of operations when loading source files. Words defined in source files are compiled before top-level forms are run, so if a source file defines C binding words and uses " { $link typedef } ", the type alias won't be available at compile time." } ; + +HELP: TYPEDEF-IF: +{ $syntax "TYPEDEF-IF: word old new" } +{ $values { "word" "a word with stack effect " { $snippet "( -- ? )" } } { "old" "a C type" } { "new" "a C type" } } +{ $description "Aliases the C type " { $snippet "old" } " under the name " { $snippet "new" } " if " { $snippet "word" } " evaluates to a true value." } { $notes "This word differs from " { $link typedef } " in that it runs at parse time, to ensure correct ordering of operations when loading source files. Words defined in source files are compiled before top-level forms are run, so if a source file defines C binding words and uses " { $link typedef } ", the type alias won't be available at compile time." } ; HELP: C-STRUCT: @@ -81,7 +87,9 @@ HELP: typedef { $description "Alises the C type " { $snippet "old" } " under the name " { $snippet "new" } "." } { $notes "Using this word in the same source file which defines C bindings can cause problems, because words are compiled before top-level forms are run. Use the " { $link POSTPONE: TYPEDEF: } " word instead." } ; -{ typedef POSTPONE: TYPEDEF: } related-words +{ typedef POSTPONE: TYPEDEF: POSTPONE: TYPEDEF-IF: } related-words +{ POSTPONE: TYPEDEF: typedef POSTPONE: TYPEDEF-IF: } related-words +{ POSTPONE: TYPEDEF-IF: POSTPONE: TYPEDEF: typedef } related-words HELP: c-struct? { $values { "type" "a string" } { "?" "a boolean" } } diff --git a/core/alien/syntax/syntax.factor b/core/alien/syntax/syntax.factor index 99275d02bf..b81a91efcb 100755 --- a/core/alien/syntax/syntax.factor +++ b/core/alien/syntax/syntax.factor @@ -23,6 +23,15 @@ IN: alien.syntax PRIVATE> +: indirect-quot ( function-ptr-quot return types abi -- quot ) + [ alien-indirect ] 3curry compose ; + +: define-indirect ( abi return function-ptr-quot function-name parameters -- ) + >r pick r> parse-arglist + rot create-in dup reset-generic + >r >r swapd roll indirect-quot r> r> + -rot define-declared ; + : DLL" skip-blank parse-string dlopen parsed ; parsing : ALIEN: scan string>number parsed ; parsing @@ -37,6 +46,9 @@ PRIVATE> : TYPEDEF: scan scan typedef ; parsing +: TYPEDEF-IF: + scan-word execute scan scan rot [ typedef ] [ 2drop ] if ; parsing + : C-STRUCT: scan in get parse-definition diff --git a/core/strings/strings-docs.factor b/core/strings/strings-docs.factor old mode 100644 new mode 100755 diff --git a/extra/cel-shading/authors.txt b/extra/cel-shading/authors.txt new file mode 100644 index 0000000000..6a0dc7293a --- /dev/null +++ b/extra/cel-shading/authors.txt @@ -0,0 +1 @@ +Joe Groff \ No newline at end of file diff --git a/extra/cel-shading/cel-shading.factor b/extra/cel-shading/cel-shading.factor new file mode 100644 index 0000000000..20b392195a --- /dev/null +++ b/extra/cel-shading/cel-shading.factor @@ -0,0 +1,152 @@ +USING: arrays bunny io io.files kernel + math math.functions math.vectors multiline + namespaces + opengl opengl.gl + prettyprint + sequences ui ui.gadgets ui.gestures ui.render ; +IN: cel-shading + +: NEAR-PLANE 1.0 64.0 / ; inline +: FAR-PLANE 4.0 ; inline +: FOV 2.0 sqrt 1+ ; inline +: MOUSE-MOTION-SCALE 0.5 ; inline +: MOUSE-DISTANCE-SCALE 1.0 64.0 / ; inline +: KEY-ROTATE-STEP 1.0 ; inline +: KEY-DISTANCE-STEP 1.0 64.0 / ; inline +: DIMS { 640 480 } ; inline + +: FOV-RATIO ( -- fov ) DIMS dup first2 min v/n ; + +SYMBOL: last-drag-loc + +TUPLE: cel-shading-gadget yaw pitch distance model program ; + +: ( -- cel-shading-gadget ) + cel-shading-gadget construct-gadget + 0.0 over set-cel-shading-gadget-yaw + 0.0 over set-cel-shading-gadget-pitch + 0.375 over set-cel-shading-gadget-distance + maybe-download read-model over set-cel-shading-gadget-model ; + +: yaw-cel-shading-gadget ( yaw gadget -- ) + [ [ cel-shading-gadget-yaw + ] keep set-cel-shading-gadget-yaw ] keep relayout-1 ; + +: pitch-cel-shading-gadget ( pitch gadget -- ) + [ [ cel-shading-gadget-pitch + ] keep set-cel-shading-gadget-pitch ] keep relayout-1 ; + +: zoom-cel-shading-gadget ( distance gadget -- ) + [ [ cel-shading-gadget-distance + ] keep set-cel-shading-gadget-distance ] keep relayout-1 ; + +M: cel-shading-gadget pref-dim* ( gadget -- dim ) + drop DIMS ; + +: -+ ( x -- -x x ) + dup neg swap ; + +: cel-shading-frustum ( -- -x x -y y near far ) + FOV-RATIO NEAR-PLANE FOV / v*n + first2 [ -+ ] 2apply NEAR-PLANE FAR-PLANE ; + +STRING: cel-shading-vertex-shader-source +varying vec3 position, normal; + +void +main() +{ + gl_Position = ftransform(); + + position = gl_Vertex.xyz; + normal = gl_Normal; +} + +; + +STRING: cel-shading-fragment-shader-source +varying vec3 position, normal; +uniform vec3 light_direction; +uniform vec4 color; +uniform vec4 ambient, diffuse; + +float +smooth_modulate(vec3 direction, vec3 normal) +{ + return clamp(dot(direction, normal), 0.0, 1.0); +} + +float +modulate(vec3 direction, vec3 normal) +{ + float m = smooth_modulate(direction, normal); + return smoothstep(0.0, 0.01, m) * 0.4 + smoothstep(0.49, 0.5, m) * 0.5; +} + +void +main() +{ + vec3 direction = normalize(light_direction - position); + gl_FragColor = ambient + diffuse * color * vec4(vec3(modulate(direction, normal)), 1); +} + +; + +: cel-shading-program ( -- program ) + cel-shading-vertex-shader-source check-gl-shader + cel-shading-fragment-shader-source check-gl-shader + 2array check-gl-program ; + +M: cel-shading-gadget graft* ( gadget -- ) + 0.0 0.0 0.0 1.0 glClearColor + GL_CULL_FACE glEnable + GL_DEPTH_TEST glEnable + cel-shading-program swap set-cel-shading-gadget-program ; + +M: cel-shading-gadget ungraft* ( gadget -- ) + cel-shading-gadget-program delete-gl-program ; + +: cel-shading-draw-setup ( gadget -- gadget ) + GL_PROJECTION glMatrixMode + glLoadIdentity + cel-shading-frustum glFrustum + GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT bitor glClear + GL_MODELVIEW glMatrixMode + glLoadIdentity + [ >r 0.0 0.0 r> cel-shading-gadget-distance neg glTranslatef ] keep + [ cel-shading-gadget-pitch 1.0 0.0 0.0 glRotatef ] keep + [ cel-shading-gadget-yaw 0.0 1.0 0.0 glRotatef ] keep + [ cel-shading-gadget-program [ "light_direction" glGetUniformLocation -25.0 45.0 80.0 glUniform3f ] keep + [ "color" glGetUniformLocation 0.6 0.5 0.5 1.0 glUniform4f ] keep + [ "ambient" glGetUniformLocation 0.2 0.2 0.2 0.2 glUniform4f ] keep + "diffuse" glGetUniformLocation 0.8 0.8 0.8 0.8 glUniform4f ] keep ; + +M: cel-shading-gadget draw-gadget* ( gadget -- ) + dup cel-shading-gadget-program [ + cel-shading-draw-setup + 0.0 -0.12 0.0 glTranslatef + cel-shading-gadget-model first3 draw-bunny + ] with-gl-program ; + +: reset-last-drag-rel ( -- ) + { 0 0 } last-drag-loc set ; +: last-drag-rel ( -- rel ) + drag-loc [ last-drag-loc get v- ] keep last-drag-loc set ; + +: drag-yaw-pitch ( -- yaw pitch ) + last-drag-rel MOUSE-MOTION-SCALE v*n first2 ; + +cel-shading-gadget H{ + { T{ key-down f f "LEFT" } [ KEY-ROTATE-STEP neg swap yaw-cel-shading-gadget ] } + { T{ key-down f f "RIGHT" } [ KEY-ROTATE-STEP swap yaw-cel-shading-gadget ] } + { T{ key-down f f "DOWN" } [ KEY-ROTATE-STEP neg swap pitch-cel-shading-gadget ] } + { T{ key-down f f "UP" } [ KEY-ROTATE-STEP swap pitch-cel-shading-gadget ] } + { T{ key-down f f "=" } [ KEY-DISTANCE-STEP neg swap zoom-cel-shading-gadget ] } + { T{ key-down f f "-" } [ KEY-DISTANCE-STEP swap zoom-cel-shading-gadget ] } + + { T{ button-down f f 1 } [ drop reset-last-drag-rel ] } + { T{ drag f 1 } [ drag-yaw-pitch rot [ pitch-cel-shading-gadget ] keep yaw-cel-shading-gadget ] } + { T{ mouse-scroll } [ scroll-direction get second MOUSE-DISTANCE-SCALE * swap zoom-cel-shading-gadget ] } +} set-gestures + +: cel-shading-window ( -- ) + [ "Cel Shading" open-window ] with-ui ; + +MAIN: cel-shading-window diff --git a/extra/cel-shading/summary.txt b/extra/cel-shading/summary.txt new file mode 100644 index 0000000000..60da092f6d --- /dev/null +++ b/extra/cel-shading/summary.txt @@ -0,0 +1 @@ +Stanford Bunny rendered with a cel-shading GLSL program \ No newline at end of file diff --git a/extra/cel-shading/tags.txt b/extra/cel-shading/tags.txt new file mode 100644 index 0000000000..0db7e8e629 --- /dev/null +++ b/extra/cel-shading/tags.txt @@ -0,0 +1,3 @@ +demos +opengl +glsl \ No newline at end of file diff --git a/extra/multiline/multiline-docs.factor b/extra/multiline/multiline-docs.factor index c48ee16490..0c0eb5e9dd 100644 --- a/extra/multiline/multiline-docs.factor +++ b/extra/multiline/multiline-docs.factor @@ -1,5 +1,4 @@ USING: help.markup help.syntax ; - IN: multiline HELP: STRING: diff --git a/extra/opengl/gl/gl.factor b/extra/opengl/gl/gl.factor index 40ead55ddd..071fbc45e7 100644 --- a/extra/opengl/gl/gl.factor +++ b/extra/opengl/gl/gl.factor @@ -3,7 +3,9 @@ ! This file is based on the gl.h that comes with xorg-x11 6.8.2 -USING: alien alien.syntax kernel sequences words ; +USING: alien alien.syntax kernel parser sequences system words ; +<< windows? "opengl.gl.windows" "opengl.gl.unix" ? use+ >> + IN: opengl.gl TYPEDEF: uint GLenum @@ -1118,195 +1120,688 @@ FUNCTION: void glPushName ( GLuint name ) ; FUNCTION: void glPopName ( ) ; +! OpenGL extension functions + + + + + ! OpenGL 1.2 -: GL_PACK_SKIP_IMAGES HEX: 806B ; inline -: GL_PACK_IMAGE_HEIGHT HEX: 806C ; inline -: GL_UNPACK_SKIP_IMAGES HEX: 806D ; inline -: GL_UNPACK_IMAGE_HEIGHT HEX: 806E ; inline -: GL_TEXTURE_3D HEX: 806F ; inline -: GL_PROXY_TEXTURE_3D HEX: 8070 ; inline -: GL_TEXTURE_DEPTH HEX: 8071 ; inline -: GL_TEXTURE_WRAP_R HEX: 8072 ; inline -: GL_MAX_3D_TEXTURE_SIZE HEX: 8073 ; inline -: GL_BGR HEX: 80E0 ; inline -: GL_BGRA HEX: 80E1 ; inline -: GL_UNSIGNED_BYTE_3_3_2 HEX: 8032 ; inline -: GL_UNSIGNED_BYTE_2_3_3_REV HEX: 8362 ; inline -: GL_UNSIGNED_SHORT_5_6_5 HEX: 8363 ; inline -: GL_UNSIGNED_SHORT_5_6_5_REV HEX: 8364 ; inline -: GL_UNSIGNED_SHORT_4_4_4_4 HEX: 8033 ; inline -: GL_UNSIGNED_SHORT_4_4_4_4_REV HEX: 8365 ; inline -: GL_UNSIGNED_SHORT_5_5_5_1 HEX: 8034 ; inline -: GL_UNSIGNED_SHORT_1_5_5_5_REV HEX: 8366 ; inline -: GL_UNSIGNED_INT_8_8_8_8 HEX: 8035 ; inline -: GL_UNSIGNED_INT_8_8_8_8_REV HEX: 8367 ; inline -: GL_UNSIGNED_INT_10_10_10_2 HEX: 8036 ; inline -: GL_UNSIGNED_INT_2_10_10_10_REV HEX: 8368 ; inline -: GL_RESCALE_NORMAL HEX: 803A ; inline -: GL_LIGHT_MODEL_COLOR_CONTROL HEX: 81F8 ; inline -: GL_SINGLE_COLOR HEX: 81F9 ; inline -: GL_SEPARATE_SPECULAR_COLOR HEX: 81FA ; inline -: GL_CLAMP_TO_EDGE HEX: 812F ; inline -: GL_TEXTURE_MIN_LOD HEX: 813A ; inline -: GL_TEXTURE_MAX_LOD HEX: 813B ; inline -: GL_TEXTURE_BASE_LEVEL HEX: 813C ; inline -: GL_TEXTURE_MAX_LEVEL HEX: 813D ; inline -: GL_MAX_ELEMENTS_VERTICES HEX: 80E8 ; inline -: GL_MAX_ELEMENTS_INDICES HEX: 80E9 ; inline -: GL_ALIASED_POINT_SIZE_RANGE HEX: 846D ; inline -: GL_ALIASED_LINE_WIDTH_RANGE HEX: 846E ; inline +: GL_SMOOTH_POINT_SIZE_RANGE HEX: 0B12 ; inline +: GL_SMOOTH_POINT_SIZE_GRANULARITY HEX: 0B13 ; inline +: GL_SMOOTH_LINE_WIDTH_RANGE HEX: 0B22 ; inline +: GL_SMOOTH_LINE_WIDTH_GRANULARITY HEX: 0B23 ; inline +: GL_UNSIGNED_BYTE_3_3_2 HEX: 8032 ; inline +: GL_UNSIGNED_SHORT_4_4_4_4 HEX: 8033 ; inline +: GL_UNSIGNED_SHORT_5_5_5_1 HEX: 8034 ; inline +: GL_UNSIGNED_INT_8_8_8_8 HEX: 8035 ; inline +: GL_UNSIGNED_INT_10_10_10_2 HEX: 8036 ; inline +: GL_RESCALE_NORMAL HEX: 803A ; inline +: GL_TEXTURE_BINDING_3D HEX: 806A ; inline +: GL_PACK_SKIP_IMAGES HEX: 806B ; inline +: GL_PACK_IMAGE_HEIGHT HEX: 806C ; inline +: GL_UNPACK_SKIP_IMAGES HEX: 806D ; inline +: GL_UNPACK_IMAGE_HEIGHT HEX: 806E ; inline +: GL_TEXTURE_3D HEX: 806F ; inline +: GL_PROXY_TEXTURE_3D HEX: 8070 ; inline +: GL_TEXTURE_DEPTH HEX: 8071 ; inline +: GL_TEXTURE_WRAP_R HEX: 8072 ; inline +: GL_MAX_3D_TEXTURE_SIZE HEX: 8073 ; inline +: GL_BGR HEX: 80E0 ; inline +: GL_BGRA HEX: 80E1 ; inline +: GL_MAX_ELEMENTS_VERTICES HEX: 80E8 ; inline +: GL_MAX_ELEMENTS_INDICES HEX: 80E9 ; inline +: GL_CLAMP_TO_EDGE HEX: 812F ; inline +: GL_TEXTURE_MIN_LOD HEX: 813A ; inline +: GL_TEXTURE_MAX_LOD HEX: 813B ; inline +: GL_TEXTURE_BASE_LEVEL HEX: 813C ; inline +: GL_TEXTURE_MAX_LEVEL HEX: 813D ; inline +: GL_LIGHT_MODEL_COLOR_CONTROL HEX: 81F8 ; inline +: GL_SINGLE_COLOR HEX: 81F9 ; inline +: GL_SEPARATE_SPECULAR_COLOR HEX: 81FA ; inline +: GL_UNSIGNED_BYTE_2_3_3_REV HEX: 8362 ; inline +: GL_UNSIGNED_SHORT_5_6_5 HEX: 8363 ; inline +: GL_UNSIGNED_SHORT_5_6_5_REV HEX: 8364 ; inline +: GL_UNSIGNED_SHORT_4_4_4_4_REV HEX: 8365 ; inline +: GL_UNSIGNED_SHORT_1_5_5_5_REV HEX: 8366 ; inline +: GL_UNSIGNED_INT_8_8_8_8_REV HEX: 8367 ; inline +: GL_UNSIGNED_INT_2_10_10_10_REV HEX: 8368 ; inline +: GL_ALIASED_POINT_SIZE_RANGE HEX: 846D ; inline +: GL_ALIASED_LINE_WIDTH_RANGE HEX: 846E ; inline -! Not present on Windows -! FUNCTION: void glDrawRangeElements ( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLvoid* indices ) ; +GL-FUNCTION: void glCopyTexSubImage3D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ) ; +GL-FUNCTION: void glDrawRangeElements ( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLvoid* indices ) ; +GL-FUNCTION: void glTexImage3D ( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLvoid* pixels ) ; +GL-FUNCTION: void glTexSubImage3D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid* pixels ) ; -! FUNCTION: void glTexImage3D ( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLvoid* pixels ) ; - -! FUNCTION: void glTexSubImage3D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid* pixels ) ; - -! FUNCTION: void glCopyTexSubImage3D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ) ; - -! TODO: the rest. looks fiddly ! OpenGL 1.3 -: GL_ACTIVE_TEXTURE HEX: 84E0 ; inline -: GL_CLIENT_ACTIVE_TEXTURE HEX: 84E1 ; inline -: GL_MAX_TEXTURE_UNITS HEX: 84E2 ; inline -: GL_TEXTURE0 HEX: 84C0 ; inline -: GL_TEXTURE1 HEX: 84C1 ; inline -: GL_TEXTURE2 HEX: 84C2 ; inline -: GL_TEXTURE3 HEX: 84C3 ; inline -: GL_TEXTURE4 HEX: 84C4 ; inline -: GL_TEXTURE5 HEX: 84C5 ; inline -: GL_TEXTURE6 HEX: 84C6 ; inline -: GL_TEXTURE7 HEX: 84C7 ; inline -: GL_TEXTURE8 HEX: 84C8 ; inline -: GL_TEXTURE9 HEX: 84C9 ; inline -: GL_TEXTURE10 HEX: 84CA ; inline -: GL_TEXTURE11 HEX: 84CB ; inline -: GL_TEXTURE12 HEX: 84CC ; inline -: GL_TEXTURE13 HEX: 84CD ; inline -: GL_TEXTURE14 HEX: 84CE ; inline -: GL_TEXTURE15 HEX: 84CF ; inline -: GL_TEXTURE16 HEX: 84D0 ; inline -: GL_TEXTURE17 HEX: 84D1 ; inline -: GL_TEXTURE18 HEX: 84D2 ; inline -: GL_TEXTURE19 HEX: 84D3 ; inline -: GL_TEXTURE20 HEX: 84D4 ; inline -: GL_TEXTURE21 HEX: 84D5 ; inline -: GL_TEXTURE22 HEX: 84D6 ; inline -: GL_TEXTURE23 HEX: 84D7 ; inline -: GL_TEXTURE24 HEX: 84D8 ; inline -: GL_TEXTURE25 HEX: 84D9 ; inline -: GL_TEXTURE26 HEX: 84DA ; inline -: GL_TEXTURE27 HEX: 84DB ; inline -: GL_TEXTURE28 HEX: 84DC ; inline -: GL_TEXTURE29 HEX: 84DD ; inline -: GL_TEXTURE30 HEX: 84DE ; inline -: GL_TEXTURE31 HEX: 84DF ; inline -: GL_NORMAL_MAP HEX: 8511 ; inline -: GL_REFLECTION_MAP HEX: 8512 ; inline -: GL_TEXTURE_CUBE_MAP HEX: 8513 ; inline -: GL_TEXTURE_BINDING_CUBE_MAP HEX: 8514 ; inline -: GL_TEXTURE_CUBE_MAP_POSITIVE_X HEX: 8515 ; inline -: GL_TEXTURE_CUBE_MAP_NEGATIVE_X HEX: 8516 ; inline -: GL_TEXTURE_CUBE_MAP_POSITIVE_Y HEX: 8517 ; inline -: GL_TEXTURE_CUBE_MAP_NEGATIVE_Y HEX: 8518 ; inline -: GL_TEXTURE_CUBE_MAP_POSITIVE_Z HEX: 8519 ; inline -: GL_TEXTURE_CUBE_MAP_NEGATIVE_Z HEX: 851A ; inline -: GL_PROXY_TEXTURE_CUBE_MAP HEX: 851B ; inline -: GL_MAX_CUBE_MAP_TEXTURE_SIZE HEX: 851C ; inline -: GL_COMBINE HEX: 8570 ; inline -: GL_COMBINE_RGB HEX: 8571 ; inline -: GL_COMBINE_ALPHA HEX: 8572 ; inline -: GL_RGB_SCALE HEX: 8573 ; inline -: GL_ADD_SIGNED HEX: 8574 ; inline -: GL_INTERPOLATE HEX: 8575 ; inline -: GL_CONSTANT HEX: 8576 ; inline -: GL_PRIMARY_COLOR HEX: 8577 ; inline -: GL_PREVIOUS HEX: 8578 ; inline -: GL_SOURCE0_RGB HEX: 8580 ; inline -: GL_SOURCE1_RGB HEX: 8581 ; inline -: GL_SOURCE2_RGB HEX: 8582 ; inline -: GL_SOURCE0_ALPHA HEX: 8588 ; inline -: GL_SOURCE1_ALPHA HEX: 8589 ; inline -: GL_SOURCE2_ALPHA HEX: 858A ; inline -: GL_OPERAND0_RGB HEX: 8590 ; inline -: GL_OPERAND1_RGB HEX: 8591 ; inline -: GL_OPERAND2_RGB HEX: 8592 ; inline -: GL_OPERAND0_ALPHA HEX: 8598 ; inline -: GL_OPERAND1_ALPHA HEX: 8599 ; inline -: GL_OPERAND2_ALPHA HEX: 859A ; inline -: GL_SUBTRACT HEX: 84E7 ; inline -: GL_TRANSPOSE_MODELVIEW_MATRIX HEX: 84E3 ; inline -: GL_TRANSPOSE_PROJECTION_MATRIX HEX: 84E4 ; inline -: GL_TRANSPOSE_TEXTURE_MATRIX HEX: 84E5 ; inline -: GL_TRANSPOSE_COLOR_MATRIX HEX: 84E6 ; inline -: GL_COMPRESSED_ALPHA HEX: 84E9 ; inline -: GL_COMPRESSED_LUMINANCE HEX: 84EA ; inline -: GL_COMPRESSED_LUMINANCE_ALPHA HEX: 84EB ; inline -: GL_COMPRESSED_INTENSITY HEX: 84EC ; inline -: GL_COMPRESSED_RGB HEX: 84ED ; inline -: GL_COMPRESSED_RGBA HEX: 84EE ; inline -: GL_TEXTURE_COMPRESSION_HINT HEX: 84EF ; inline -: GL_TEXTURE_COMPRESSED_IMAGE_SIZE HEX: 86A0 ; inline -: GL_TEXTURE_COMPRESSED HEX: 86A1 ; inline + +: GL_MULTISAMPLE HEX: 809D ; inline +: GL_SAMPLE_ALPHA_TO_COVERAGE HEX: 809E ; inline +: GL_SAMPLE_ALPHA_TO_ONE HEX: 809F ; inline +: GL_SAMPLE_COVERAGE HEX: 80A0 ; inline +: GL_SAMPLE_BUFFERS HEX: 80A8 ; inline +: GL_SAMPLES HEX: 80A9 ; inline +: GL_SAMPLE_COVERAGE_VALUE HEX: 80AA ; inline +: GL_SAMPLE_COVERAGE_INVERT HEX: 80AB ; inline +: GL_CLAMP_TO_BORDER HEX: 812D ; inline +: GL_TEXTURE0 HEX: 84C0 ; inline +: GL_TEXTURE1 HEX: 84C1 ; inline +: GL_TEXTURE2 HEX: 84C2 ; inline +: GL_TEXTURE3 HEX: 84C3 ; inline +: GL_TEXTURE4 HEX: 84C4 ; inline +: GL_TEXTURE5 HEX: 84C5 ; inline +: GL_TEXTURE6 HEX: 84C6 ; inline +: GL_TEXTURE7 HEX: 84C7 ; inline +: GL_TEXTURE8 HEX: 84C8 ; inline +: GL_TEXTURE9 HEX: 84C9 ; inline +: GL_TEXTURE10 HEX: 84CA ; inline +: GL_TEXTURE11 HEX: 84CB ; inline +: GL_TEXTURE12 HEX: 84CC ; inline +: GL_TEXTURE13 HEX: 84CD ; inline +: GL_TEXTURE14 HEX: 84CE ; inline +: GL_TEXTURE15 HEX: 84CF ; inline +: GL_TEXTURE16 HEX: 84D0 ; inline +: GL_TEXTURE17 HEX: 84D1 ; inline +: GL_TEXTURE18 HEX: 84D2 ; inline +: GL_TEXTURE19 HEX: 84D3 ; inline +: GL_TEXTURE20 HEX: 84D4 ; inline +: GL_TEXTURE21 HEX: 84D5 ; inline +: GL_TEXTURE22 HEX: 84D6 ; inline +: GL_TEXTURE23 HEX: 84D7 ; inline +: GL_TEXTURE24 HEX: 84D8 ; inline +: GL_TEXTURE25 HEX: 84D9 ; inline +: GL_TEXTURE26 HEX: 84DA ; inline +: GL_TEXTURE27 HEX: 84DB ; inline +: GL_TEXTURE28 HEX: 84DC ; inline +: GL_TEXTURE29 HEX: 84DD ; inline +: GL_TEXTURE30 HEX: 84DE ; inline +: GL_TEXTURE31 HEX: 84DF ; inline +: GL_ACTIVE_TEXTURE HEX: 84E0 ; inline +: GL_CLIENT_ACTIVE_TEXTURE HEX: 84E1 ; inline +: GL_MAX_TEXTURE_UNITS HEX: 84E2 ; inline +: GL_TRANSPOSE_MODELVIEW_MATRIX HEX: 84E3 ; inline +: GL_TRANSPOSE_PROJECTION_MATRIX HEX: 84E4 ; inline +: GL_TRANSPOSE_TEXTURE_MATRIX HEX: 84E5 ; inline +: GL_TRANSPOSE_COLOR_MATRIX HEX: 84E6 ; inline +: GL_SUBTRACT HEX: 84E7 ; inline +: GL_COMPRESSED_ALPHA HEX: 84E9 ; inline +: GL_COMPRESSED_LUMINANCE HEX: 84EA ; inline +: GL_COMPRESSED_LUMINANCE_ALPHA HEX: 84EB ; inline +: GL_COMPRESSED_INTENSITY HEX: 84EC ; inline +: GL_COMPRESSED_RGB HEX: 84ED ; inline +: GL_COMPRESSED_RGBA HEX: 84EE ; inline +: GL_TEXTURE_COMPRESSION_HINT HEX: 84EF ; inline +: GL_NORMAL_MAP HEX: 8511 ; inline +: GL_REFLECTION_MAP HEX: 8512 ; inline +: GL_TEXTURE_CUBE_MAP HEX: 8513 ; inline +: GL_TEXTURE_BINDING_CUBE_MAP HEX: 8514 ; inline +: GL_TEXTURE_CUBE_MAP_POSITIVE_X HEX: 8515 ; inline +: GL_TEXTURE_CUBE_MAP_NEGATIVE_X HEX: 8516 ; inline +: GL_TEXTURE_CUBE_MAP_POSITIVE_Y HEX: 8517 ; inline +: GL_TEXTURE_CUBE_MAP_NEGATIVE_Y HEX: 8518 ; inline +: GL_TEXTURE_CUBE_MAP_POSITIVE_Z HEX: 8519 ; inline +: GL_TEXTURE_CUBE_MAP_NEGATIVE_Z HEX: 851A ; inline +: GL_PROXY_TEXTURE_CUBE_MAP HEX: 851B ; inline +: GL_MAX_CUBE_MAP_TEXTURE_SIZE HEX: 851C ; inline +: GL_COMBINE HEX: 8570 ; inline +: GL_COMBINE_RGB HEX: 8571 ; inline +: GL_COMBINE_ALPHA HEX: 8572 ; inline +: GL_RGB_SCALE HEX: 8573 ; inline +: GL_ADD_SIGNED HEX: 8574 ; inline +: GL_INTERPOLATE HEX: 8575 ; inline +: GL_CONSTANT HEX: 8576 ; inline +: GL_PRIMARY_COLOR HEX: 8577 ; inline +: GL_PREVIOUS HEX: 8578 ; inline +: GL_SOURCE0_RGB HEX: 8580 ; inline +: GL_SOURCE1_RGB HEX: 8581 ; inline +: GL_SOURCE2_RGB HEX: 8582 ; inline +: GL_SOURCE0_ALPHA HEX: 8588 ; inline +: GL_SOURCE1_ALPHA HEX: 8589 ; inline +: GL_SOURCE2_ALPHA HEX: 858A ; inline +: GL_OPERAND0_RGB HEX: 8590 ; inline +: GL_OPERAND1_RGB HEX: 8591 ; inline +: GL_OPERAND2_RGB HEX: 8592 ; inline +: GL_OPERAND0_ALPHA HEX: 8598 ; inline +: GL_OPERAND1_ALPHA HEX: 8599 ; inline +: GL_OPERAND2_ALPHA HEX: 859A ; inline +: GL_TEXTURE_COMPRESSED_IMAGE_SIZE HEX: 86A0 ; inline +: GL_TEXTURE_COMPRESSED HEX: 86A1 ; inline : GL_NUM_COMPRESSED_TEXTURE_FORMATS HEX: 86A2 ; inline -: GL_COMPRESSED_TEXTURE_FORMATS HEX: 86A3 ; inline -: GL_DOT3_RGB HEX: 86AE ; inline -: GL_DOT3_RGBA HEX: 86AF ; inline -: GL_CLAMP_TO_BORDER HEX: 812D ; inline -: GL_MULTISAMPLE HEX: 809D ; inline -: GL_SAMPLE_ALPHA_TO_COVERAGE HEX: 809E ; inline -: GL_SAMPLE_ALPHA_TO_ONE HEX: 809F ; inline -: GL_SAMPLE_COVERAGE HEX: 80A0 ; inline -: GL_SAMPLE_BUFFERS HEX: 80A8 ; inline -: GL_SAMPLES HEX: 80A9 ; inline -: GL_SAMPLE_COVERAGE_VALUE HEX: 80AA ; inline -: GL_SAMPLE_COVERAGE_INVERT HEX: 80AB ; inline -: GL_MULTISAMPLE_BIT HEX: 20000000 ; inline +: GL_COMPRESSED_TEXTURE_FORMATS HEX: 86A3 ; inline +: GL_DOT3_RGB HEX: 86AE ; inline +: GL_DOT3_RGBA HEX: 86AF ; inline +: GL_MULTISAMPLE_BIT HEX: 20000000 ; inline + +GL-FUNCTION: void glActiveTexture ( GLenum texture ) ; +GL-FUNCTION: void glClientActiveTexture ( GLenum texture ) ; +GL-FUNCTION: void glCompressedTexImage1D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, GLvoid* data ) ; +GL-FUNCTION: void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, GLvoid* data ) ; +GL-FUNCTION: void glCompressedTexImage3D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLvoid* data ) ; +GL-FUNCTION: void glCompressedTexSubImage1D ( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, GLvoid* data ) ; +GL-FUNCTION: void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLvoid* data ) ; +GL-FUNCTION: void glCompressedTexSubImage3D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, GLvoid* data ) ; +GL-FUNCTION: void glGetCompressedTexImage ( GLenum target, GLint lod, GLvoid* img ) ; +GL-FUNCTION: void glLoadTransposeMatrixd ( GLdouble m[16] ) ; +GL-FUNCTION: void glLoadTransposeMatrixf ( GLfloat m[16] ) ; +GL-FUNCTION: void glMultTransposeMatrixd ( GLdouble m[16] ) ; +GL-FUNCTION: void glMultTransposeMatrixf ( GLfloat m[16] ) ; +GL-FUNCTION: void glMultiTexCoord1d ( GLenum target, GLdouble s ) ; +GL-FUNCTION: void glMultiTexCoord1dv ( GLenum target, GLdouble* v ) ; +GL-FUNCTION: void glMultiTexCoord1f ( GLenum target, GLfloat s ) ; +GL-FUNCTION: void glMultiTexCoord1fv ( GLenum target, GLfloat* v ) ; +GL-FUNCTION: void glMultiTexCoord1i ( GLenum target, GLint s ) ; +GL-FUNCTION: void glMultiTexCoord1iv ( GLenum target, GLint* v ) ; +GL-FUNCTION: void glMultiTexCoord1s ( GLenum target, GLshort s ) ; +GL-FUNCTION: void glMultiTexCoord1sv ( GLenum target, GLshort* v ) ; +GL-FUNCTION: void glMultiTexCoord2d ( GLenum target, GLdouble s, GLdouble t ) ; +GL-FUNCTION: void glMultiTexCoord2dv ( GLenum target, GLdouble* v ) ; +GL-FUNCTION: void glMultiTexCoord2f ( GLenum target, GLfloat s, GLfloat t ) ; +GL-FUNCTION: void glMultiTexCoord2fv ( GLenum target, GLfloat* v ) ; +GL-FUNCTION: void glMultiTexCoord2i ( GLenum target, GLint s, GLint t ) ; +GL-FUNCTION: void glMultiTexCoord2iv ( GLenum target, GLint* v ) ; +GL-FUNCTION: void glMultiTexCoord2s ( GLenum target, GLshort s, GLshort t ) ; +GL-FUNCTION: void glMultiTexCoord2sv ( GLenum target, GLshort* v ) ; +GL-FUNCTION: void glMultiTexCoord3d ( GLenum target, GLdouble s, GLdouble t, GLdouble r ) ; +GL-FUNCTION: void glMultiTexCoord3dv ( GLenum target, GLdouble* v ) ; +GL-FUNCTION: void glMultiTexCoord3f ( GLenum target, GLfloat s, GLfloat t, GLfloat r ) ; +GL-FUNCTION: void glMultiTexCoord3fv ( GLenum target, GLfloat* v ) ; +GL-FUNCTION: void glMultiTexCoord3i ( GLenum target, GLint s, GLint t, GLint r ) ; +GL-FUNCTION: void glMultiTexCoord3iv ( GLenum target, GLint* v ) ; +GL-FUNCTION: void glMultiTexCoord3s ( GLenum target, GLshort s, GLshort t, GLshort r ) ; +GL-FUNCTION: void glMultiTexCoord3sv ( GLenum target, GLshort* v ) ; +GL-FUNCTION: void glMultiTexCoord4d ( GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q ) ; +GL-FUNCTION: void glMultiTexCoord4dv ( GLenum target, GLdouble* v ) ; +GL-FUNCTION: void glMultiTexCoord4f ( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q ) ; +GL-FUNCTION: void glMultiTexCoord4fv ( GLenum target, GLfloat* v ) ; +GL-FUNCTION: void glMultiTexCoord4i ( GLenum target, GLint s, GLint t, GLint r, GLint q ) ; +GL-FUNCTION: void glMultiTexCoord4iv ( GLenum target, GLint* v ) ; +GL-FUNCTION: void glMultiTexCoord4s ( GLenum target, GLshort s, GLshort t, GLshort r, GLshort q ) ; +GL-FUNCTION: void glMultiTexCoord4sv ( GLenum target, GLshort* v ) ; +GL-FUNCTION: void glSampleCoverage ( GLclampf value, GLboolean invert ) ; ! OpenGL 1.4 -: GL_POINT_SIZE_MIN HEX: 8126 ; inline -: GL_POINT_SIZE_MAX HEX: 8127 ; inline -: GL_POINT_FADE_THRESHOLD_SIZE HEX: 8128 ; inline -: GL_POINT_DISTANCE_ATTENUATION HEX: 8129 ; inline -: GL_FOG_COORDINATE_SOURCE HEX: 8450 ; inline -: GL_FOG_COORDINATE HEX: 8451 ; inline -: GL_FRAGMENT_DEPTH HEX: 8452 ; inline -: GL_CURRENT_FOG_COORDINATE HEX: 8453 ; inline -: GL_FOG_COORDINATE_ARRAY_TYPE HEX: 8454 ; inline -: GL_FOG_COORDINATE_ARRAY_STRIDE HEX: 8455 ; inline -: GL_FOG_COORDINATE_ARRAY_POINTER HEX: 8456 ; inline -: GL_FOG_COORDINATE_ARRAY HEX: 8457 ; inline -: GL_COLOR_SUM HEX: 8458 ; inline -: GL_CURRENT_SECONDARY_COLOR HEX: 8459 ; inline -: GL_SECONDARY_COLOR_ARRAY_SIZE HEX: 845A ; inline -: GL_SECONDARY_COLOR_ARRAY_TYPE HEX: 845B ; inline -: GL_SECONDARY_COLOR_ARRAY_STRIDE HEX: 845C ; inline -: GL_SECONDARY_COLOR_ARRAY_POINTER HEX: 845D ; inline -: GL_SECONDARY_COLOR_ARRAY HEX: 845E ; inline -: GL_INCR_WRAP HEX: 8507 ; inline -: GL_DECR_WRAP HEX: 8508 ; inline -: GL_MAX_TEXTURE_LOD_BIAS HEX: 84FD ; inline -: GL_TEXTURE_FILTER_CONTROL HEX: 8500 ; inline -: GL_TEXTURE_LOD_BIAS HEX: 8501 ; inline -: GL_GENERATE_MIPMAP HEX: 8191 ; inline -: GL_GENERATE_MIPMAP_HINT HEX: 8192 ; inline -: GL_BLEND_DST_RGB HEX: 80C8 ; inline -: GL_BLEND_SRC_RGB HEX: 80C9 ; inline -: GL_BLEND_DST_ALPHA HEX: 80CA ; inline -: GL_BLEND_SRC_ALPHA HEX: 80CB ; inline -: GL_MIRRORED_REPEAT HEX: 8370 ; inline -: GL_DEPTH_COMPONENT16 HEX: 81A5 ; inline -: GL_DEPTH_COMPONENT24 HEX: 81A6 ; inline -: GL_DEPTH_COMPONENT32 HEX: 81A7 ; inline -: GL_TEXTURE_DEPTH_SIZE HEX: 884A ; inline -: GL_DEPTH_TEXTURE_MODE HEX: 884B ; inline -: GL_TEXTURE_COMPARE_MODE HEX: 884C ; inline -: GL_TEXTURE_COMPARE_FUNC HEX: 884D ; inline -: GL_COMPARE_R_TO_TEXTURE HEX: 884E ; inline + +: GL_BLEND_DST_RGB HEX: 80C8 ; inline +: GL_BLEND_SRC_RGB HEX: 80C9 ; inline +: GL_BLEND_DST_ALPHA HEX: 80CA ; inline +: GL_BLEND_SRC_ALPHA HEX: 80CB ; inline +: GL_POINT_SIZE_MIN HEX: 8126 ; inline +: GL_POINT_SIZE_MAX HEX: 8127 ; inline +: GL_POINT_FADE_THRESHOLD_SIZE HEX: 8128 ; inline +: GL_POINT_DISTANCE_ATTENUATION HEX: 8129 ; inline +: GL_GENERATE_MIPMAP HEX: 8191 ; inline +: GL_GENERATE_MIPMAP_HINT HEX: 8192 ; inline +: GL_DEPTH_COMPONENT16 HEX: 81A5 ; inline +: GL_DEPTH_COMPONENT24 HEX: 81A6 ; inline +: GL_DEPTH_COMPONENT32 HEX: 81A7 ; inline +: GL_MIRRORED_REPEAT HEX: 8370 ; inline +: GL_FOG_COORDINATE_SOURCE HEX: 8450 ; inline +: GL_FOG_COORDINATE HEX: 8451 ; inline +: GL_FRAGMENT_DEPTH HEX: 8452 ; inline +: GL_CURRENT_FOG_COORDINATE HEX: 8453 ; inline +: GL_FOG_COORDINATE_ARRAY_TYPE HEX: 8454 ; inline +: GL_FOG_COORDINATE_ARRAY_STRIDE HEX: 8455 ; inline +: GL_FOG_COORDINATE_ARRAY_POINTER HEX: 8456 ; inline +: GL_FOG_COORDINATE_ARRAY HEX: 8457 ; inline +: GL_COLOR_SUM HEX: 8458 ; inline +: GL_CURRENT_SECONDARY_COLOR HEX: 8459 ; inline +: GL_SECONDARY_COLOR_ARRAY_SIZE HEX: 845A ; inline +: GL_SECONDARY_COLOR_ARRAY_TYPE HEX: 845B ; inline +: GL_SECONDARY_COLOR_ARRAY_STRIDE HEX: 845C ; inline +: GL_SECONDARY_COLOR_ARRAY_POINTER HEX: 845D ; inline +: GL_SECONDARY_COLOR_ARRAY HEX: 845E ; inline +: GL_MAX_TEXTURE_LOD_BIAS HEX: 84FD ; inline +: GL_TEXTURE_FILTER_CONTROL HEX: 8500 ; inline +: GL_TEXTURE_LOD_BIAS HEX: 8501 ; inline +: GL_INCR_WRAP HEX: 8507 ; inline +: GL_DECR_WRAP HEX: 8508 ; inline +: GL_TEXTURE_DEPTH_SIZE HEX: 884A ; inline +: GL_DEPTH_TEXTURE_MODE HEX: 884B ; inline +: GL_TEXTURE_COMPARE_MODE HEX: 884C ; inline +: GL_TEXTURE_COMPARE_FUNC HEX: 884D ; inline +: GL_COMPARE_R_TO_TEXTURE HEX: 884E ; inline + +GL-FUNCTION: void glBlendColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) ; +GL-FUNCTION: void glBlendEquation ( GLenum mode ) ; +GL-FUNCTION: void glBlendFuncSeparate ( GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha ) ; +GL-FUNCTION: void glFogCoordPointer ( GLenum type, GLsizei stride, GLvoid* pointer ) ; +GL-FUNCTION: void glFogCoordd ( GLdouble coord ) ; +GL-FUNCTION: void glFogCoorddv ( GLdouble* coord ) ; +GL-FUNCTION: void glFogCoordf ( GLfloat coord ) ; +GL-FUNCTION: void glFogCoordfv ( GLfloat* coord ) ; +GL-FUNCTION: void glMultiDrawArrays ( GLenum mode, GLint* first, GLsizei* count, GLsizei primcount ) ; +GL-FUNCTION: void glMultiDrawElements ( GLenum mode, GLsizei* count, GLenum type, GLvoid** indices, GLsizei primcount ) ; +GL-FUNCTION: void glPointParameterf ( GLenum pname, GLfloat param ) ; +GL-FUNCTION: void glPointParameterfv ( GLenum pname, GLfloat* params ) ; +GL-FUNCTION: void glSecondaryColor3b ( GLbyte red, GLbyte green, GLbyte blue ) ; +GL-FUNCTION: void glSecondaryColor3bv ( GLbyte* v ) ; +GL-FUNCTION: void glSecondaryColor3d ( GLdouble red, GLdouble green, GLdouble blue ) ; +GL-FUNCTION: void glSecondaryColor3dv ( GLdouble* v ) ; +GL-FUNCTION: void glSecondaryColor3f ( GLfloat red, GLfloat green, GLfloat blue ) ; +GL-FUNCTION: void glSecondaryColor3fv ( GLfloat* v ) ; +GL-FUNCTION: void glSecondaryColor3i ( GLint red, GLint green, GLint blue ) ; +GL-FUNCTION: void glSecondaryColor3iv ( GLint* v ) ; +GL-FUNCTION: void glSecondaryColor3s ( GLshort red, GLshort green, GLshort blue ) ; +GL-FUNCTION: void glSecondaryColor3sv ( GLshort* v ) ; +GL-FUNCTION: void glSecondaryColor3ub ( GLubyte red, GLubyte green, GLubyte blue ) ; +GL-FUNCTION: void glSecondaryColor3ubv ( GLubyte* v ) ; +GL-FUNCTION: void glSecondaryColor3ui ( GLuint red, GLuint green, GLuint blue ) ; +GL-FUNCTION: void glSecondaryColor3uiv ( GLuint* v ) ; +GL-FUNCTION: void glSecondaryColor3us ( GLushort red, GLushort green, GLushort blue ) ; +GL-FUNCTION: void glSecondaryColor3usv ( GLushort* v ) ; +GL-FUNCTION: void glSecondaryColorPointer ( GLint size, GLenum type, GLsizei stride, GLvoid* pointer ) ; +GL-FUNCTION: void glWindowPos2d ( GLdouble x, GLdouble y ) ; +GL-FUNCTION: void glWindowPos2dv ( GLdouble* p ) ; +GL-FUNCTION: void glWindowPos2f ( GLfloat x, GLfloat y ) ; +GL-FUNCTION: void glWindowPos2fv ( GLfloat* p ) ; +GL-FUNCTION: void glWindowPos2i ( GLint x, GLint y ) ; +GL-FUNCTION: void glWindowPos2iv ( GLint* p ) ; +GL-FUNCTION: void glWindowPos2s ( GLshort x, GLshort y ) ; +GL-FUNCTION: void glWindowPos2sv ( GLshort* p ) ; +GL-FUNCTION: void glWindowPos3d ( GLdouble x, GLdouble y, GLdouble z ) ; +GL-FUNCTION: void glWindowPos3dv ( GLdouble* p ) ; +GL-FUNCTION: void glWindowPos3f ( GLfloat x, GLfloat y, GLfloat z ) ; +GL-FUNCTION: void glWindowPos3fv ( GLfloat* p ) ; +GL-FUNCTION: void glWindowPos3i ( GLint x, GLint y, GLint z ) ; +GL-FUNCTION: void glWindowPos3iv ( GLint* p ) ; +GL-FUNCTION: void glWindowPos3s ( GLshort x, GLshort y, GLshort z ) ; +GL-FUNCTION: void glWindowPos3sv ( GLshort* p ) ; + + +! OpenGL 1.5 + +: GL_BUFFER_SIZE HEX: 8764 ; inline +: GL_BUFFER_USAGE HEX: 8765 ; inline +: GL_QUERY_COUNTER_BITS HEX: 8864 ; inline +: GL_CURRENT_QUERY HEX: 8865 ; inline +: GL_QUERY_RESULT HEX: 8866 ; inline +: GL_QUERY_RESULT_AVAILABLE HEX: 8867 ; inline +: GL_ARRAY_BUFFER HEX: 8892 ; inline +: GL_ELEMENT_ARRAY_BUFFER HEX: 8893 ; inline +: GL_ARRAY_BUFFER_BINDING HEX: 8894 ; inline +: GL_ELEMENT_ARRAY_BUFFER_BINDING HEX: 8895 ; inline +: GL_VERTEX_ARRAY_BUFFER_BINDING HEX: 8896 ; inline +: GL_NORMAL_ARRAY_BUFFER_BINDING HEX: 8897 ; inline +: GL_COLOR_ARRAY_BUFFER_BINDING HEX: 8898 ; inline +: GL_INDEX_ARRAY_BUFFER_BINDING HEX: 8899 ; inline +: GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING HEX: 889A ; inline +: GL_EDGE_FLAG_ARRAY_BUFFER_BINDING HEX: 889B ; inline +: GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING HEX: 889C ; inline +: GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING HEX: 889D ; inline +: GL_WEIGHT_ARRAY_BUFFER_BINDING HEX: 889E ; inline +: GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING HEX: 889F ; inline +: GL_READ_ONLY HEX: 88B8 ; inline +: GL_WRITE_ONLY HEX: 88B9 ; inline +: GL_READ_WRITE HEX: 88BA ; inline +: GL_BUFFER_ACCESS HEX: 88BB ; inline +: GL_BUFFER_MAPPED HEX: 88BC ; inline +: GL_BUFFER_MAP_POINTER HEX: 88BD ; inline +: GL_STREAM_DRAW HEX: 88E0 ; inline +: GL_STREAM_READ HEX: 88E1 ; inline +: GL_STREAM_COPY HEX: 88E2 ; inline +: GL_STATIC_DRAW HEX: 88E4 ; inline +: GL_STATIC_READ HEX: 88E5 ; inline +: GL_STATIC_COPY HEX: 88E6 ; inline +: GL_DYNAMIC_DRAW HEX: 88E8 ; inline +: GL_DYNAMIC_READ HEX: 88E9 ; inline +: GL_DYNAMIC_COPY HEX: 88EA ; inline +: GL_SAMPLES_PASSED HEX: 8914 ; inline +: GL_FOG_COORD_SRC GL_FOG_COORDINATE_SOURCE ; inline +: GL_FOG_COORD GL_FOG_COORDINATE ; inline +: GL_FOG_COORD_ARRAY GL_FOG_COORDINATE_ARRAY ; inline +: GL_SRC0_RGB GL_SOURCE0_RGB ; inline +: GL_FOG_COORD_ARRAY_POINTER GL_FOG_COORDINATE_ARRAY_POINTER ; inline +: GL_FOG_COORD_ARRAY_TYPE GL_FOG_COORDINATE_ARRAY_TYPE ; inline +: GL_SRC1_ALPHA GL_SOURCE1_ALPHA ; inline +: GL_CURRENT_FOG_COORD GL_CURRENT_FOG_COORDINATE ; inline +: GL_FOG_COORD_ARRAY_STRIDE GL_FOG_COORDINATE_ARRAY_STRIDE ; inline +: GL_SRC0_ALPHA GL_SOURCE0_ALPHA ; inline +: GL_SRC1_RGB GL_SOURCE1_RGB ; inline +: GL_FOG_COORD_ARRAY_BUFFER_BINDING GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING ; inline +: GL_SRC2_ALPHA GL_SOURCE2_ALPHA ; inline +: GL_SRC2_RGB GL_SOURCE2_RGB ; inline + +TYPEDEF: ptrdiff_t GLsizeiptr +TYPEDEF: ptrdiff_t GLintptr + +GL-FUNCTION: void glBeginQuery ( GLenum target, GLuint id ) ; +GL-FUNCTION: void glBindBuffer ( GLenum target, GLuint buffer ) ; +GL-FUNCTION: void glBufferData ( GLenum target, GLsizeiptr size, GLvoid* data, GLenum usage ) ; +GL-FUNCTION: void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, GLvoid* data ) ; +GL-FUNCTION: void glDeleteBuffers ( GLsizei n, GLuint* buffers ) ; +GL-FUNCTION: void glDeleteQueries ( GLsizei n, GLuint* ids ) ; +GL-FUNCTION: void glEndQuery ( GLenum target ) ; +GL-FUNCTION: void glGenBuffers ( GLsizei n, GLuint* buffers ) ; +GL-FUNCTION: void glGenQueries ( GLsizei n, GLuint* ids ) ; +GL-FUNCTION: void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint* params ) ; +GL-FUNCTION: void glGetBufferPointerv ( GLenum target, GLenum pname, GLvoid** params ) ; +GL-FUNCTION: void glGetBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, GLvoid* data ) ; +GL-FUNCTION: void glGetQueryObjectiv ( GLuint id, GLenum pname, GLint* params ) ; +GL-FUNCTION: void glGetQueryObjectuiv ( GLuint id, GLenum pname, GLuint* params ) ; +GL-FUNCTION: void glGetQueryiv ( GLenum target, GLenum pname, GLint* params ) ; +GL-FUNCTION: GLboolean glIsBuffer ( GLuint buffer ) ; +GL-FUNCTION: GLboolean glIsQuery ( GLuint id ) ; +GL-FUNCTION: GLvoid* glMapBuffer ( GLenum target, GLenum access ) ; +GL-FUNCTION: GLboolean glUnmapBuffer ( GLenum target ) ; + + +! OpenGL 2.0 + + +: GL_VERTEX_ATTRIB_ARRAY_ENABLED HEX: 8622 ; inline +: GL_VERTEX_ATTRIB_ARRAY_SIZE HEX: 8623 ; inline +: GL_VERTEX_ATTRIB_ARRAY_STRIDE HEX: 8624 ; inline +: GL_VERTEX_ATTRIB_ARRAY_TYPE HEX: 8625 ; inline +: GL_CURRENT_VERTEX_ATTRIB HEX: 8626 ; inline +: GL_VERTEX_PROGRAM_POINT_SIZE HEX: 8642 ; inline +: GL_VERTEX_PROGRAM_TWO_SIDE HEX: 8643 ; inline +: GL_VERTEX_ATTRIB_ARRAY_POINTER HEX: 8645 ; inline +: GL_STENCIL_BACK_FUNC HEX: 8800 ; inline +: GL_STENCIL_BACK_FAIL HEX: 8801 ; inline +: GL_STENCIL_BACK_PASS_DEPTH_FAIL HEX: 8802 ; inline +: GL_STENCIL_BACK_PASS_DEPTH_PASS HEX: 8803 ; inline +: GL_MAX_DRAW_BUFFERS HEX: 8824 ; inline +: GL_DRAW_BUFFER0 HEX: 8825 ; inline +: GL_DRAW_BUFFER1 HEX: 8826 ; inline +: GL_DRAW_BUFFER2 HEX: 8827 ; inline +: GL_DRAW_BUFFER3 HEX: 8828 ; inline +: GL_DRAW_BUFFER4 HEX: 8829 ; inline +: GL_DRAW_BUFFER5 HEX: 882A ; inline +: GL_DRAW_BUFFER6 HEX: 882B ; inline +: GL_DRAW_BUFFER7 HEX: 882C ; inline +: GL_DRAW_BUFFER8 HEX: 882D ; inline +: GL_DRAW_BUFFER9 HEX: 882E ; inline +: GL_DRAW_BUFFER10 HEX: 882F ; inline +: GL_DRAW_BUFFER11 HEX: 8830 ; inline +: GL_DRAW_BUFFER12 HEX: 8831 ; inline +: GL_DRAW_BUFFER13 HEX: 8832 ; inline +: GL_DRAW_BUFFER14 HEX: 8833 ; inline +: GL_DRAW_BUFFER15 HEX: 8834 ; inline +: GL_BLEND_EQUATION_ALPHA HEX: 883D ; inline +: GL_POINT_SPRITE HEX: 8861 ; inline +: GL_COORD_REPLACE HEX: 8862 ; inline +: GL_MAX_VERTEX_ATTRIBS HEX: 8869 ; inline +: GL_VERTEX_ATTRIB_ARRAY_NORMALIZED HEX: 886A ; inline +: GL_MAX_TEXTURE_COORDS HEX: 8871 ; inline +: GL_MAX_TEXTURE_IMAGE_UNITS HEX: 8872 ; inline +: GL_FRAGMENT_SHADER HEX: 8B30 ; inline +: GL_VERTEX_SHADER HEX: 8B31 ; inline +: GL_MAX_FRAGMENT_UNIFORM_COMPONENTS HEX: 8B49 ; inline +: GL_MAX_VERTEX_UNIFORM_COMPONENTS HEX: 8B4A ; inline +: GL_MAX_VARYING_FLOATS HEX: 8B4B ; inline +: GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS HEX: 8B4C ; inline +: GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS HEX: 8B4D ; inline +: GL_SHADER_TYPE HEX: 8B4F ; inline +: GL_FLOAT_VEC2 HEX: 8B50 ; inline +: GL_FLOAT_VEC3 HEX: 8B51 ; inline +: GL_FLOAT_VEC4 HEX: 8B52 ; inline +: GL_INT_VEC2 HEX: 8B53 ; inline +: GL_INT_VEC3 HEX: 8B54 ; inline +: GL_INT_VEC4 HEX: 8B55 ; inline +: GL_BOOL HEX: 8B56 ; inline +: GL_BOOL_VEC2 HEX: 8B57 ; inline +: GL_BOOL_VEC3 HEX: 8B58 ; inline +: GL_BOOL_VEC4 HEX: 8B59 ; inline +: GL_FLOAT_MAT2 HEX: 8B5A ; inline +: GL_FLOAT_MAT3 HEX: 8B5B ; inline +: GL_FLOAT_MAT4 HEX: 8B5C ; inline +: GL_SAMPLER_1D HEX: 8B5D ; inline +: GL_SAMPLER_2D HEX: 8B5E ; inline +: GL_SAMPLER_3D HEX: 8B5F ; inline +: GL_SAMPLER_CUBE HEX: 8B60 ; inline +: GL_SAMPLER_1D_SHADOW HEX: 8B61 ; inline +: GL_SAMPLER_2D_SHADOW HEX: 8B62 ; inline +: GL_DELETE_STATUS HEX: 8B80 ; inline +: GL_COMPILE_STATUS HEX: 8B81 ; inline +: GL_LINK_STATUS HEX: 8B82 ; inline +: GL_VALIDATE_STATUS HEX: 8B83 ; inline +: GL_INFO_LOG_LENGTH HEX: 8B84 ; inline +: GL_ATTACHED_SHADERS HEX: 8B85 ; inline +: GL_ACTIVE_UNIFORMS HEX: 8B86 ; inline +: GL_ACTIVE_UNIFORM_MAX_LENGTH HEX: 8B87 ; inline +: GL_SHADER_SOURCE_LENGTH HEX: 8B88 ; inline +: GL_ACTIVE_ATTRIBUTES HEX: 8B89 ; inline +: GL_ACTIVE_ATTRIBUTE_MAX_LENGTH HEX: 8B8A ; inline +: GL_FRAGMENT_SHADER_DERIVATIVE_HINT HEX: 8B8B ; inline +: GL_SHADING_LANGUAGE_VERSION HEX: 8B8C ; inline +: GL_CURRENT_PROGRAM HEX: 8B8D ; inline +: GL_POINT_SPRITE_COORD_ORIGIN HEX: 8CA0 ; inline +: GL_LOWER_LEFT HEX: 8CA1 ; inline +: GL_UPPER_LEFT HEX: 8CA2 ; inline +: GL_STENCIL_BACK_REF HEX: 8CA3 ; inline +: GL_STENCIL_BACK_VALUE_MASK HEX: 8CA4 ; inline +: GL_STENCIL_BACK_WRITEMASK HEX: 8CA5 ; inline +: GL_BLEND_EQUATION HEX: 8009 ; inline +: GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION ; inline + +TYPEDEF: char GLchar + +GL-FUNCTION: void glAttachShader ( GLuint program, GLuint shader ) ; +GL-FUNCTION: void glBindAttribLocation ( GLuint program, GLuint index, GLchar* name ) ; +GL-FUNCTION: void glBlendEquationSeparate ( GLenum modeRGB, GLenum modeAlpha ) ; +GL-FUNCTION: void glCompileShader ( GLuint shader ) ; +GL-FUNCTION: GLuint glCreateProgram ( ) ; +GL-FUNCTION: GLuint glCreateShader ( GLenum type ) ; +GL-FUNCTION: void glDeleteProgram ( GLuint program ) ; +GL-FUNCTION: void glDeleteShader ( GLuint shader ) ; +GL-FUNCTION: void glDetachShader ( GLuint program, GLuint shader ) ; +GL-FUNCTION: void glDisableVertexAttribArray ( GLuint index ) ; +GL-FUNCTION: void glDrawBuffers ( GLsizei n, GLenum* bufs ) ; +GL-FUNCTION: void glEnableVertexAttribArray ( GLuint index ) ; +GL-FUNCTION: void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei maxLength, GLsizei* length, GLint* size, GLenum* type, GLchar* name ) ; +GL-FUNCTION: void glGetActiveUniform ( GLuint program, GLuint index, GLsizei maxLength, GLsizei* length, GLint* size, GLenum* type, GLchar* name ) ; +GL-FUNCTION: void glGetAttachedShaders ( GLuint program, GLsizei maxCount, GLsizei* count, GLuint* shaders ) ; +GL-FUNCTION: GLint glGetAttribLocation ( GLuint program, GLchar* name ) ; +GL-FUNCTION: void glGetProgramInfoLog ( GLuint program, GLsizei bufSize, GLsizei* length, GLchar* infoLog ) ; +GL-FUNCTION: void glGetProgramiv ( GLuint program, GLenum pname, GLint* param ) ; +GL-FUNCTION: void glGetShaderInfoLog ( GLuint shader, GLsizei bufSize, GLsizei* length, GLchar* infoLog ) ; +GL-FUNCTION: void glGetShaderSource ( GLint obj, GLsizei maxLength, GLsizei* length, GLchar* source ) ; +GL-FUNCTION: void glGetShaderiv ( GLuint shader, GLenum pname, GLint* param ) ; +GL-FUNCTION: GLint glGetUniformLocation ( GLint programObj, GLchar* name ) ; +GL-FUNCTION: void glGetUniformfv ( GLuint program, GLint location, GLfloat* params ) ; +GL-FUNCTION: void glGetUniformiv ( GLuint program, GLint location, GLint* params ) ; +GL-FUNCTION: void glGetVertexAttribPointerv ( GLuint index, GLenum pname, GLvoid** pointer ) ; +GL-FUNCTION: void glGetVertexAttribdv ( GLuint index, GLenum pname, GLdouble* params ) ; +GL-FUNCTION: void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat* params ) ; +GL-FUNCTION: void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint* params ) ; +GL-FUNCTION: GLboolean glIsProgram ( GLuint program ) ; +GL-FUNCTION: GLboolean glIsShader ( GLuint shader ) ; +GL-FUNCTION: void glLinkProgram ( GLuint program ) ; +GL-FUNCTION: void glShaderSource ( GLuint shader, GLsizei count, GLchar** strings, GLint* lengths ) ; +GL-FUNCTION: void glStencilFuncSeparate ( GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask ) ; +GL-FUNCTION: void glStencilMaskSeparate ( GLenum face, GLuint mask ) ; +GL-FUNCTION: void glStencilOpSeparate ( GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass ) ; +GL-FUNCTION: void glUniform1f ( GLint location, GLfloat v0 ) ; +GL-FUNCTION: void glUniform1fv ( GLint location, GLsizei count, GLfloat* value ) ; +GL-FUNCTION: void glUniform1i ( GLint location, GLint v0 ) ; +GL-FUNCTION: void glUniform1iv ( GLint location, GLsizei count, GLint* value ) ; +GL-FUNCTION: void glUniform2f ( GLint location, GLfloat v0, GLfloat v1 ) ; +GL-FUNCTION: void glUniform2fv ( GLint location, GLsizei count, GLfloat* value ) ; +GL-FUNCTION: void glUniform2i ( GLint location, GLint v0, GLint v1 ) ; +GL-FUNCTION: void glUniform2iv ( GLint location, GLsizei count, GLint* value ) ; +GL-FUNCTION: void glUniform3f ( GLint location, GLfloat v0, GLfloat v1, GLfloat v2 ) ; +GL-FUNCTION: void glUniform3fv ( GLint location, GLsizei count, GLfloat* value ) ; +GL-FUNCTION: void glUniform3i ( GLint location, GLint v0, GLint v1, GLint v2 ) ; +GL-FUNCTION: void glUniform3iv ( GLint location, GLsizei count, GLint* value ) ; +GL-FUNCTION: void glUniform4f ( GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3 ) ; +GL-FUNCTION: void glUniform4fv ( GLint location, GLsizei count, GLfloat* value ) ; +GL-FUNCTION: void glUniform4i ( GLint location, GLint v0, GLint v1, GLint v2, GLint v3 ) ; +GL-FUNCTION: void glUniform4iv ( GLint location, GLsizei count, GLint* value ) ; +GL-FUNCTION: void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, GLfloat* value ) ; +GL-FUNCTION: void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, GLfloat* value ) ; +GL-FUNCTION: void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, GLfloat* value ) ; +GL-FUNCTION: void glUseProgram ( GLuint program ) ; +GL-FUNCTION: void glValidateProgram ( GLuint program ) ; +GL-FUNCTION: void glVertexAttrib1d ( GLuint index, GLdouble x ) ; +GL-FUNCTION: void glVertexAttrib1dv ( GLuint index, GLdouble* v ) ; +GL-FUNCTION: void glVertexAttrib1f ( GLuint index, GLfloat x ) ; +GL-FUNCTION: void glVertexAttrib1fv ( GLuint index, GLfloat* v ) ; +GL-FUNCTION: void glVertexAttrib1s ( GLuint index, GLshort x ) ; +GL-FUNCTION: void glVertexAttrib1sv ( GLuint index, GLshort* v ) ; +GL-FUNCTION: void glVertexAttrib2d ( GLuint index, GLdouble x, GLdouble y ) ; +GL-FUNCTION: void glVertexAttrib2dv ( GLuint index, GLdouble* v ) ; +GL-FUNCTION: void glVertexAttrib2f ( GLuint index, GLfloat x, GLfloat y ) ; +GL-FUNCTION: void glVertexAttrib2fv ( GLuint index, GLfloat* v ) ; +GL-FUNCTION: void glVertexAttrib2s ( GLuint index, GLshort x, GLshort y ) ; +GL-FUNCTION: void glVertexAttrib2sv ( GLuint index, GLshort* v ) ; +GL-FUNCTION: void glVertexAttrib3d ( GLuint index, GLdouble x, GLdouble y, GLdouble z ) ; +GL-FUNCTION: void glVertexAttrib3dv ( GLuint index, GLdouble* v ) ; +GL-FUNCTION: void glVertexAttrib3f ( GLuint index, GLfloat x, GLfloat y, GLfloat z ) ; +GL-FUNCTION: void glVertexAttrib3fv ( GLuint index, GLfloat* v ) ; +GL-FUNCTION: void glVertexAttrib3s ( GLuint index, GLshort x, GLshort y, GLshort z ) ; +GL-FUNCTION: void glVertexAttrib3sv ( GLuint index, GLshort* v ) ; +GL-FUNCTION: void glVertexAttrib4Nbv ( GLuint index, GLbyte* v ) ; +GL-FUNCTION: void glVertexAttrib4Niv ( GLuint index, GLint* v ) ; +GL-FUNCTION: void glVertexAttrib4Nsv ( GLuint index, GLshort* v ) ; +GL-FUNCTION: void glVertexAttrib4Nub ( GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w ) ; +GL-FUNCTION: void glVertexAttrib4Nubv ( GLuint index, GLubyte* v ) ; +GL-FUNCTION: void glVertexAttrib4Nuiv ( GLuint index, GLuint* v ) ; +GL-FUNCTION: void glVertexAttrib4Nusv ( GLuint index, GLushort* v ) ; +GL-FUNCTION: void glVertexAttrib4bv ( GLuint index, GLbyte* v ) ; +GL-FUNCTION: void glVertexAttrib4d ( GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w ) ; +GL-FUNCTION: void glVertexAttrib4dv ( GLuint index, GLdouble* v ) ; +GL-FUNCTION: void glVertexAttrib4f ( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) ; +GL-FUNCTION: void glVertexAttrib4fv ( GLuint index, GLfloat* v ) ; +GL-FUNCTION: void glVertexAttrib4iv ( GLuint index, GLint* v ) ; +GL-FUNCTION: void glVertexAttrib4s ( GLuint index, GLshort x, GLshort y, GLshort z, GLshort w ) ; +GL-FUNCTION: void glVertexAttrib4sv ( GLuint index, GLshort* v ) ; +GL-FUNCTION: void glVertexAttrib4ubv ( GLuint index, GLubyte* v ) ; +GL-FUNCTION: void glVertexAttrib4uiv ( GLuint index, GLuint* v ) ; +GL-FUNCTION: void glVertexAttrib4usv ( GLuint index, GLushort* v ) ; +GL-FUNCTION: void glVertexAttribPointer ( GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLvoid* pointer ) ; + + +! OpenGL 2.1 + + +: GL_CURRENT_RASTER_SECONDARY_COLOR HEX: 845F ; inline +: GL_PIXEL_PACK_BUFFER HEX: 88EB ; inline +: GL_PIXEL_UNPACK_BUFFER HEX: 88EC ; inline +: GL_PIXEL_PACK_BUFFER_BINDING HEX: 88ED ; inline +: GL_PIXEL_UNPACK_BUFFER_BINDING HEX: 88EF ; inline +: GL_SRGB HEX: 8C40 ; inline +: GL_SRGB8 HEX: 8C41 ; inline +: GL_SRGB_ALPHA HEX: 8C42 ; inline +: GL_SRGB8_ALPHA8 HEX: 8C43 ; inline +: GL_SLUMINANCE_ALPHA HEX: 8C44 ; inline +: GL_SLUMINANCE8_ALPHA8 HEX: 8C45 ; inline +: GL_SLUMINANCE HEX: 8C46 ; inline +: GL_SLUMINANCE8 HEX: 8C47 ; inline +: GL_COMPRESSED_SRGB HEX: 8C48 ; inline +: GL_COMPRESSED_SRGB_ALPHA HEX: 8C49 ; inline +: GL_COMPRESSED_SLUMINANCE HEX: 8C4A ; inline +: GL_COMPRESSED_SLUMINANCE_ALPHA HEX: 8C4B ; inline + +GL-FUNCTION: void glUniformMatrix2x3fv ( GLint location, GLsizei count, GLboolean transpose, GLfloat* value ) ; +GL-FUNCTION: void glUniformMatrix2x4fv ( GLint location, GLsizei count, GLboolean transpose, GLfloat* value ) ; +GL-FUNCTION: void glUniformMatrix3x2fv ( GLint location, GLsizei count, GLboolean transpose, GLfloat* value ) ; +GL-FUNCTION: void glUniformMatrix3x4fv ( GLint location, GLsizei count, GLboolean transpose, GLfloat* value ) ; +GL-FUNCTION: void glUniformMatrix4x2fv ( GLint location, GLsizei count, GLboolean transpose, GLfloat* value ) ; +GL-FUNCTION: void glUniformMatrix4x3fv ( GLint location, GLsizei count, GLboolean transpose, GLfloat* value ) ; + + +! GL_EXT_framebuffer_object + + +: GL_INVALID_FRAMEBUFFER_OPERATION_EXT HEX: 0506 ; inline +: GL_MAX_RENDERBUFFER_SIZE_EXT HEX: 84E8 ; inline +: GL_FRAMEBUFFER_BINDING_EXT HEX: 8CA6 ; inline +: GL_RENDERBUFFER_BINDING_EXT HEX: 8CA7 ; inline +: GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT HEX: 8CD0 ; inline +: GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT HEX: 8CD1 ; inline +: GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT HEX: 8CD2 ; inline +: GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT HEX: 8CD3 ; inline +: GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT HEX: 8CD4 ; inline +: GL_FRAMEBUFFER_COMPLETE_EXT HEX: 8CD5 ; inline +: GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT HEX: 8CD6 ; inline +: GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT HEX: 8CD7 ; inline +: GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT HEX: 8CD9 ; inline +: GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT HEX: 8CDA ; inline +: GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT HEX: 8CDB ; inline +: GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT HEX: 8CDC ; inline +: GL_FRAMEBUFFER_UNSUPPORTED_EXT HEX: 8CDD ; inline +: GL_MAX_COLOR_ATTACHMENTS_EXT HEX: 8CDF ; inline +: GL_COLOR_ATTACHMENT0_EXT HEX: 8CE0 ; inline +: GL_COLOR_ATTACHMENT1_EXT HEX: 8CE1 ; inline +: GL_COLOR_ATTACHMENT2_EXT HEX: 8CE2 ; inline +: GL_COLOR_ATTACHMENT3_EXT HEX: 8CE3 ; inline +: GL_COLOR_ATTACHMENT4_EXT HEX: 8CE4 ; inline +: GL_COLOR_ATTACHMENT5_EXT HEX: 8CE5 ; inline +: GL_COLOR_ATTACHMENT6_EXT HEX: 8CE6 ; inline +: GL_COLOR_ATTACHMENT7_EXT HEX: 8CE7 ; inline +: GL_COLOR_ATTACHMENT8_EXT HEX: 8CE8 ; inline +: GL_COLOR_ATTACHMENT9_EXT HEX: 8CE9 ; inline +: GL_COLOR_ATTACHMENT10_EXT HEX: 8CEA ; inline +: GL_COLOR_ATTACHMENT11_EXT HEX: 8CEB ; inline +: GL_COLOR_ATTACHMENT12_EXT HEX: 8CEC ; inline +: GL_COLOR_ATTACHMENT13_EXT HEX: 8CED ; inline +: GL_COLOR_ATTACHMENT14_EXT HEX: 8CEE ; inline +: GL_COLOR_ATTACHMENT15_EXT HEX: 8CEF ; inline +: GL_DEPTH_ATTACHMENT_EXT HEX: 8D00 ; inline +: GL_STENCIL_ATTACHMENT_EXT HEX: 8D20 ; inline +: GL_FRAMEBUFFER_EXT HEX: 8D40 ; inline +: GL_RENDERBUFFER_EXT HEX: 8D41 ; inline +: GL_RENDERBUFFER_WIDTH_EXT HEX: 8D42 ; inline +: GL_RENDERBUFFER_HEIGHT_EXT HEX: 8D43 ; inline +: GL_RENDERBUFFER_INTERNAL_FORMAT_EXT HEX: 8D44 ; inline +: GL_STENCIL_INDEX1_EXT HEX: 8D46 ; inline +: GL_STENCIL_INDEX4_EXT HEX: 8D47 ; inline +: GL_STENCIL_INDEX8_EXT HEX: 8D48 ; inline +: GL_STENCIL_INDEX16_EXT HEX: 8D49 ; inline +: GL_RENDERBUFFER_RED_SIZE_EXT HEX: 8D50 ; inline +: GL_RENDERBUFFER_GREEN_SIZE_EXT HEX: 8D51 ; inline +: GL_RENDERBUFFER_BLUE_SIZE_EXT HEX: 8D52 ; inline +: GL_RENDERBUFFER_ALPHA_SIZE_EXT HEX: 8D53 ; inline +: GL_RENDERBUFFER_DEPTH_SIZE_EXT HEX: 8D54 ; inline +: GL_RENDERBUFFER_STENCIL_SIZE_EXT HEX: 8D55 ; inline + +GL-FUNCTION: void glBindFramebufferEXT ( GLenum target, GLuint framebuffer ) ; +GL-FUNCTION: void glBindRenderbufferEXT ( GLenum target, GLuint renderbuffer ) ; +GL-FUNCTION: GLenum glCheckFramebufferStatusEXT ( GLenum target ) ; +GL-FUNCTION: void glDeleteFramebuffersEXT ( GLsizei n, GLuint* framebuffers ) ; +GL-FUNCTION: void glDeleteRenderbuffersEXT ( GLsizei n, GLuint* renderbuffers ) ; +GL-FUNCTION: void glFramebufferRenderbufferEXT ( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer ) ; +GL-FUNCTION: void glFramebufferTexture1DEXT ( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ) ; +GL-FUNCTION: void glFramebufferTexture2DEXT ( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ) ; +GL-FUNCTION: void glFramebufferTexture3DEXT ( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset ) ; +GL-FUNCTION: void glGenFramebuffersEXT ( GLsizei n, GLuint* framebuffers ) ; +GL-FUNCTION: void glGenRenderbuffersEXT ( GLsizei n, GLuint* renderbuffers ) ; +GL-FUNCTION: void glGenerateMipmapEXT ( GLenum target ) ; +GL-FUNCTION: void glGetFramebufferAttachmentParameterivEXT ( GLenum target, GLenum attachment, GLenum pname, GLint* params ) ; +GL-FUNCTION: void glGetRenderbufferParameterivEXT ( GLenum target, GLenum pname, GLint* params ) ; +GL-FUNCTION: GLboolean glIsFramebufferEXT ( GLuint framebuffer ) ; +GL-FUNCTION: GLboolean glIsRenderbufferEXT ( GLuint renderbuffer ) ; +GL-FUNCTION: void glRenderbufferStorageEXT ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height ) ; + + +! GL_ARB_texture_float + + +: GL_RGBA32F_ARB HEX: 8814 ; inline +: GL_RGB32F_ARB HEX: 8815 ; inline +: GL_ALPHA32F_ARB HEX: 8816 ; inline +: GL_INTENSITY32F_ARB HEX: 8817 ; inline +: GL_LUMINANCE32F_ARB HEX: 8818 ; inline +: GL_LUMINANCE_ALPHA32F_ARB HEX: 8819 ; inline +: GL_RGBA16F_ARB HEX: 881A ; inline +: GL_RGB16F_ARB HEX: 881B ; inline +: GL_ALPHA16F_ARB HEX: 881C ; inline +: GL_INTENSITY16F_ARB HEX: 881D ; inline +: GL_LUMINANCE16F_ARB HEX: 881E ; inline +: GL_LUMINANCE_ALPHA16F_ARB HEX: 881F ; inline +: GL_TEXTURE_RED_TYPE_ARB HEX: 8C10 ; inline +: GL_TEXTURE_GREEN_TYPE_ARB HEX: 8C11 ; inline +: GL_TEXTURE_BLUE_TYPE_ARB HEX: 8C12 ; inline +: GL_TEXTURE_ALPHA_TYPE_ARB HEX: 8C13 ; inline +: GL_TEXTURE_LUMINANCE_TYPE_ARB HEX: 8C14 ; inline +: GL_TEXTURE_INTENSITY_TYPE_ARB HEX: 8C15 ; inline +: GL_TEXTURE_DEPTH_TYPE_ARB HEX: 8C16 ; inline +: GL_UNSIGNED_NORMALIZED_ARB HEX: 8C17 ; inline + diff --git a/extra/opengl/gl/unix/unix.factor b/extra/opengl/gl/unix/unix.factor new file mode 100644 index 0000000000..16cd38f92f --- /dev/null +++ b/extra/opengl/gl/unix/unix.factor @@ -0,0 +1,5 @@ +USING: alien.syntax kernel syntax words ; + +IN: opengl.gl.unix + +: GL-FUNCTION: POSTPONE: FUNCTION: ; parsing diff --git a/extra/opengl/gl/windows/windows.factor b/extra/opengl/gl/windows/windows.factor new file mode 100755 index 0000000000..186f17206c --- /dev/null +++ b/extra/opengl/gl/windows/windows.factor @@ -0,0 +1,34 @@ +USING: alien alien.syntax arrays assocs hashtables init kernel + libc math namespaces parser sequences syntax system vectors + windows.opengl32 ; + +IN: opengl.gl.windows + + gl-function-pointers set ] "opengl.gl.windows init hook" add-init-hook + +: gl-function-number ( -- n ) + gl-function-number-counter get + dup 1+ gl-function-number-counter set ; + +: gl-function-pointer ( name n -- funptr ) + wglGetCurrentContext 2array dup gl-function-pointers get at + [ -rot 2drop ] + [ >r wglGetProcAddress dup r> gl-function-pointers get set-at ] + if* ; + +PRIVATE> + +: GL-FUNCTION: + "stdcall" + scan + scan + dup gl-function-number [ gl-function-pointer ] 2curry swap + ";" parse-tokens [ "()" subseq? not ] subset + define-indirect + ; parsing diff --git a/extra/opengl/opengl-docs.factor b/extra/opengl/opengl-docs.factor index f9a491aba6..58b86f09b3 100644 --- a/extra/opengl/opengl-docs.factor +++ b/extra/opengl/opengl-docs.factor @@ -92,6 +92,96 @@ HELP: with-translation { $values { "loc" "a pair of integers" } { "quot" quotation } } { $description "Calls the quotation with a translation by " { $snippet "loc" } " pixels applied to the current " { $link GL_MODELVIEW } " matrix, restoring the matrix when the quotation is done." } ; +HELP: gl-shader +{ $class-description { $snippet "gl-shader" } " is a predicate class comprising values returned by OpenGL to represent shader objects. The following words are provided for creating and manipulating these objects:" + { $list + { { $link } " - Compile GLSL code into a shader object" } + { { $link gl-shader-ok? } " - Check whether a shader object compiled successfully" } + { { $link check-gl-shader } " - Throw an error unless a shader object compiled successfully" } + { { $link gl-shader-info-log } " - Retrieve the info log of messages generated by the GLSL compiler" } + { { $link delete-gl-shader } " - Invalidate a shader object" } + } + "The derived predicate classes " { $link vertex-shader } " and " { $link fragment-shader } " are also defined for the two standard kinds of shader defined by the OpenGL specification." } ; + +HELP: vertex-shader +{ $class-description { $snippet "vertex-shader" } " is the predicate class of " { $link gl-shader } " objects that refer to shaders of type " { $snippet "GL_VERTEX_SHADER" } ". In addition to the " { $snippet "gl-shader" } " words, the following vertex shader-specific functions are defined:" + { $list + { { $link } " - Compile GLSL code into a vertex shader object "} + } +} ; + +HELP: fragment-shader +{ $class-description { $snippet "fragment-shader" } " is the predicate class of " { $link gl-shader } " objects that refer to shaders of type " { $snippet "GL_FRAGMENT_SHADER" } ". In addition to the " { $snippet "gl-shader" } " words, the following fragment shader-specific functions are defined:" + { $list + { { $link } " - Compile GLSL code into a fragment shader object "} + } +} ; + +HELP: +{ $values { "source" "The GLSL source code to compile" } { "kind" "The kind of shader to compile, such as " { $snippet "GL_VERTEX_SHADER" } " or " { $snippet "GL_FRAGMENT_SHADER" } } } +{ $description "Tries to compile the given GLSL source into a shader object. The returned object can be checked for validity by " { $link check-gl-shader } " or " { $link gl-shader-ok? } ". Errors and warnings generated by the GLSL compiler will be collected in the info log, available from " { $link gl-shader-info-log } ".\n\nWhen the shader object is no longer needed, it should be deleted using " { $link delete-gl-shader } " or else be attached to a " { $link gl-program } " object deleted using " { $link delete-gl-program } "." } ; + +HELP: +{ $values { "source" "The GLSL source code to compile" } } +{ $description "Tries to compile the given GLSL source into a vertex shader object. Equivalent to " { $snippet "GL_VERTEX_SHADER " } "." } ; + +HELP: +{ $values { "source" "The GLSL source code to compile" } } +{ $description "Tries to compile the given GLSL source into a fragment shader object. Equivalent to " { $snippet "GL_FRAGMENT_SHADER " } "." } ; + +HELP: gl-shader-ok? +{ $values { "shader" "A " { $link gl-shader } " object" } } +{ $description "Returns a boolean value indicating whether the given shader object compiled successfully. Compilation errors and warnings are available in the shader's info log, which can be gotten using " { $link gl-shader-info-log } "." } ; + +HELP: check-gl-shader +{ $values { "shader" "A " { $link gl-shader } " object" } } +{ $description "Throws an error containing the " { $link gl-shader-info-log } " for the shader object if it failed to compile. Otherwise, the shader object is left on the stack." } ; + +HELP: delete-gl-shader +{ $values { "shader" "A " { $link gl-shader } " object" } } +{ $description "Deletes the shader object, invalidating it and releasing any resources allocated for it by the OpenGL implementation." } ; + +HELP: gl-shader-info-log +{ $values { "shader" "A " { $link gl-shader } " object" } } +{ $description "Retrieves the info log for " { $snippet "shader" } ", including any errors or warnings generated in compiling the shader object." } ; + +HELP: gl-program +{ $class-description { $snippet "gl-program" } " is a predicate class comprising values returned by OpenGL to represent proram objects. The following words are provided for creating and manipulating these objects:" + { $list + { { $link } " - Link a set of shaders into a GLSL program" } + { { $link gl-program-ok? } " - Check whether a program object linked successfully" } + { { $link check-gl-program } " - Throw an error unless a program object linked successfully" } + { { $link gl-program-info-log } " - Retrieve the info log of messages generated by the GLSL linker" } + { { $link gl-program-shaders } " - Retrieve the set of shader objects composing the GLSL linker" } + { { $link delete-gl-program } " - Invalidate a program object and all its attached shaders" } + { { $link with-gl-program } " - Use a program object" } + } +} ; + +HELP: +{ $values { "shaders" "A sequence of " { $link gl-shader } " objects." } } +{ $description "Creates a new GLSL program object, attaches all the shader objects in the " { $snippet "shaders" } " sequence, and attempts to link them. The returned object can be checked for validity by " { $link check-gl-program } " or " { $link gl-program-ok? } ". Errors and warnings generated by the GLSL linker will be collected in the info log, available from " { $link gl-program-info-log } ".\n\nWhen the program object and its attached shaders are no longer needed, it should be deleted using " { $link delete-gl-program } "." } ; + +HELP: gl-program-ok? +{ $values { "program" "A " { $link gl-program } " object" } } +{ $description "Returns a boolean value indicating whether the given program object linked successfully. Link errors and warnings are available in the program's info log, which can be gotten using " { $link gl-program-info-log } "." } ; + +HELP: check-gl-program +{ $values { "program" "A " { $link gl-program } " object" } } +{ $description "Throws an error containing the " { $link gl-program-info-log } " for the program object if it failed to link. Otherwise, the program object is left on the stack." } ; + +HELP: gl-program-info-log +{ $values { "program" "A " { $link gl-program } " object" } } +{ $description "Retrieves the info log for " { $snippet "program" } ", including any errors or warnings generated in linking the program object." } ; + +HELP: delete-gl-program +{ $values { "program" "A " { $link gl-program } " object" } } +{ $description "Deletes the program object, invalidating it and releasing any resources allocated for it by the OpenGL implementation. Any attached " { $link gl-shader } "s are also deleted.\n\nIf the shader objects should be preserved, they should each be detached using " { $link detach-gl-program-shader } ". The program object can then be destroyed alone using " { $link delete-gl-program-only } "." } ; + +HELP: with-gl-program +{ $values { "program" "A " { $link gl-program } " object" } { "quot" "A quotation" } } +{ $description "Enables " { $snippet "program" } " for all OpenGL calls made in " { $snippet "quot" } ". The fixed-function pipeline is restored at the end of " { $snippet "quot" } "." } ; + ARTICLE: "gl-utilities" "OpenGL utility words" "In addition to the full OpenGL API, the " { $vocab-link "opengl" } " vocabulary includes some utility words to give OpenGL a more Factor-like feel." $nl @@ -112,6 +202,10 @@ $nl { $subsection gl-rect } { $subsection gl-fill-poly } { $subsection gl-poly } -{ $subsection gl-gradient } ; +{ $subsection gl-gradient } +"Compiling, linking, and using GLSL programs:" +{ $subsection gl-shader } +{ $subsection gl-program } +; ABOUT: "gl-utilities" diff --git a/extra/opengl/opengl.factor b/extra/opengl/opengl.factor index f611c97209..80c9b80ea7 100644 --- a/extra/opengl/opengl.factor +++ b/extra/opengl/opengl.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2005, 2007 Slava Pestov. ! Portions copyright (C) 2007 Eduardo Cavazos. ! See http://factorcode.org/license.txt for BSD license. -USING: alien alien.c-types kernel math namespaces sequences +USING: alien alien.c-types kernel libc math namespaces sequences math.vectors math.constants math.functions opengl.gl opengl.glu combinators arrays ; IN: opengl @@ -20,7 +20,7 @@ IN: opengl : gl-error ( -- ) glGetError dup zero? [ - "GL error: " dup gluErrorString append throw + "GL error: " over gluErrorString append throw ] unless drop ; : do-state ( what quot -- ) @@ -185,3 +185,100 @@ TUPLE: sprite loc dim dim2 dlist texture ; glLoadIdentity GL_MODELVIEW glMatrixMode glLoadIdentity ; + +! Shaders + +: c-true? ( int -- ? ) zero? not ; inline + +: with-gl-shader-source-ptr ( string quot -- ) + swap dup length 1+ [ tuck string>memory swap call ] with-malloc ; inline + +: ( source kind -- shader ) + glCreateShader dup rot [ 1 swap f glShaderSource ] with-gl-shader-source-ptr + [ glCompileShader ] keep + gl-error ; + +: (gl-shader?) ( object -- ? ) + dup integer? [ glIsShader c-true? ] [ drop f ] if ; + +: gl-shader-get-int ( shader enum -- value ) + 0 [ glGetShaderiv ] keep *int ; + +: gl-shader-ok? ( shader -- ? ) + GL_COMPILE_STATUS gl-shader-get-int c-true? ; + +: ( source -- vertex-shader ) + GL_VERTEX_SHADER ; inline + +: (vertex-shader?) ( object -- ? ) + dup (gl-shader?) [ GL_SHADER_TYPE gl-shader-get-int GL_VERTEX_SHADER = ] [ drop f ] if ; + +: ( source -- fragment-shader ) + GL_FRAGMENT_SHADER ; inline + +: (fragment-shader?) ( object -- ? ) + dup (gl-shader?) [ GL_SHADER_TYPE gl-shader-get-int GL_FRAGMENT_SHADER = ] [ drop f ] if ; + +: gl-shader-info-log-length ( shader -- log-length ) + GL_INFO_LOG_LENGTH gl-shader-get-int ; inline + +: gl-shader-info-log ( shader -- log ) + dup gl-shader-info-log-length dup [ [ 0 swap glGetShaderInfoLog ] keep alien>char-string ] with-malloc ; + +: check-gl-shader ( shader -- shader* ) + dup gl-shader-ok? [ dup gl-shader-info-log throw ] unless ; + +: delete-gl-shader ( shader -- ) glDeleteShader ; inline + +PREDICATE: integer gl-shader (gl-shader?) ; +PREDICATE: gl-shader vertex-shader (vertex-shader?) ; +PREDICATE: gl-shader fragment-shader (fragment-shader?) ; + +! Programs + +: ( shaders -- program ) + glCreateProgram swap + [ dupd glAttachShader ] each + [ glLinkProgram ] keep + gl-error ; + +: (gl-program?) ( object -- ? ) + dup integer? [ glIsProgram c-true? ] [ drop f ] if ; + +: gl-program-get-int ( program enum -- value ) + 0 [ glGetProgramiv ] keep *int ; + +: gl-program-ok? ( program -- ? ) + GL_LINK_STATUS gl-program-get-int c-true? ; + +: gl-program-info-log-length ( program -- log-length ) + GL_INFO_LOG_LENGTH gl-program-get-int ; inline + +: gl-program-info-log ( program -- log ) + dup gl-program-info-log-length + dup [ [ 0 swap glGetProgramInfoLog ] keep + alien>char-string ] with-malloc ; + +: check-gl-program ( program -- program* ) + dup gl-program-ok? [ dup gl-program-info-log throw ] unless ; + +: gl-program-shaders-length ( program -- shaders-length ) + GL_ATTACHED_SHADERS gl-program-get-int ; inline + +: gl-program-shaders ( program -- shaders ) + dup gl-program-shaders-length + [ dup "GLuint" [ 0 swap glGetAttachedShaders ] keep ] keep + c-uint-array> ; + +: delete-gl-program-only ( program -- ) glDeleteProgram ; inline + +: detach-gl-program-shader ( program shader -- ) glDetachShader ; inline + +: delete-gl-program ( program -- ) + dup gl-program-shaders [ 2dup detach-gl-program-shader delete-gl-shader ] each + delete-gl-program-only ; + +: with-gl-program ( program quot -- ) + swap glUseProgram call 0 glUseProgram ; inline + +PREDICATE: integer gl-program (gl-program?) ; diff --git a/extra/windows/opengl32/opengl32.factor b/extra/windows/opengl32/opengl32.factor old mode 100644 new mode 100755 index 2d58d34083..a8d8ad8153 --- a/extra/windows/opengl32/opengl32.factor +++ b/extra/windows/opengl32/opengl32.factor @@ -1,8 +1,7 @@ ! Copyright (C) 2005, 2006 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: alien alien.c-types alien.syntax parser namespaces kernel -math windows.types windows.types init assocs sequences opengl.gl -libc ; +math windows.types windows.types init assocs sequences libc ; IN: windows.opengl32 ! PIXELFORMATDESCRIPTOR flags @@ -100,4 +99,5 @@ LIBRARY: gl FUNCTION: HGLRC wglCreateContext ( HDC hDC ) ; FUNCTION: BOOL wglDeleteContext ( HGLRC hRC ) ; FUNCTION: BOOL wglMakeCurrent ( HDC hDC, HGLRC hglrc ) ; +FUNCTION: HGLRC wglGetCurrentContext ( ) ; FUNCTION: void* wglGetProcAddress ( char* name ) ; diff --git a/misc/Factor.tmbundle/Commands/Eval Selection:Line.tmCommand b/misc/Factor.tmbundle/Commands/Eval Selection:Line.tmCommand new file mode 100644 index 0000000000..37867a2737 --- /dev/null +++ b/misc/Factor.tmbundle/Commands/Eval Selection:Line.tmCommand @@ -0,0 +1,27 @@ + + + + + beforeRunningCommand + nop + command + #!/usr/bin/env ruby + +require "#{ENV["TM_BUNDLE_SUPPORT"]}/lib/tm_factor" +puts factor_eval(STDIN.read) + fallbackInput + line + input + selection + keyEquivalent + ^E + name + Eval Selection/Line + output + replaceSelectedText + scope + source.factor + uuid + 8E01DDAF-959B-4237-ADB9-C133A4ACCE90 + + diff --git a/misc/Factor.tmbundle/Commands/Help for Word.tmCommand b/misc/Factor.tmbundle/Commands/Help for Word.tmCommand new file mode 100644 index 0000000000..350c01d344 --- /dev/null +++ b/misc/Factor.tmbundle/Commands/Help for Word.tmCommand @@ -0,0 +1,30 @@ + + + + + beforeRunningCommand + nop + command + #!/usr/bin/env ruby + +require "#{ENV["TM_BUNDLE_SUPPORT"]}/lib/tm_factor" + +doc = STDIN.read +word = line_current_word(ENV["TM_CURRENT_LINE"], ENV["TM_LINE_INDEX"].to_i) +factor_run(%Q(#{doc_using_statements(doc)} USE: help\n \\ #{word} help)) + fallbackInput + word + input + document + keyEquivalent + ^H + name + Help for Word + output + showAsTooltip + scope + source.factor + uuid + BC5BE120-734B-40DF-8B6B-5D3243614B27 + + diff --git a/misc/Factor.tmbundle/Commands/Infer Effect of Selection.tmCommand b/misc/Factor.tmbundle/Commands/Infer Effect of Selection.tmCommand new file mode 100644 index 0000000000..378294e6c1 --- /dev/null +++ b/misc/Factor.tmbundle/Commands/Infer Effect of Selection.tmCommand @@ -0,0 +1,27 @@ + + + + + beforeRunningCommand + nop + command + #!/usr/bin/env ruby + +require "#{ENV["TM_BUNDLE_SUPPORT"]}/lib/tm_factor" + +doc = STDIN.read +puts factor_eval(%Q(#{doc_using_statements(doc)} USE: inference\n [ #{ENV["TM_SELECTED_TEXT"]} ] infer.)) + fallbackInput + word + input + document + name + Infer Effect of Selection + output + showAsTooltip + scope + source.factor + uuid + B619FCC0-2DF2-4657-82A8-0E5676A10254 + + diff --git a/misc/Factor.tmbundle/Commands/Run File in Listener.tmCommand b/misc/Factor.tmbundle/Commands/Run File in Listener.tmCommand new file mode 100644 index 0000000000..f28e062541 --- /dev/null +++ b/misc/Factor.tmbundle/Commands/Run File in Listener.tmCommand @@ -0,0 +1,25 @@ + + + + + beforeRunningCommand + nop + command + #!/usr/bin/env ruby + +require "#{ENV["TM_BUNDLE_SUPPORT"]}/lib/tm_factor" +factor_run(%Q(USE: parser\n "#{ENV["TM_FILEPATH"]}" run-file)) + input + none + keyEquivalent + @r + name + Run File in Listener + output + discard + scope + source.factor + uuid + CAD3BB10-C480-4C0E-9518-94D61F7A0C0B + + diff --git a/misc/Factor.tmbundle/Commands/Run Selection:Line in Listener.tmCommand b/misc/Factor.tmbundle/Commands/Run Selection:Line in Listener.tmCommand new file mode 100644 index 0000000000..5028bd8db3 --- /dev/null +++ b/misc/Factor.tmbundle/Commands/Run Selection:Line in Listener.tmCommand @@ -0,0 +1,27 @@ + + + + + beforeRunningCommand + nop + command + #!/usr/bin/env ruby + +require "#{ENV["TM_BUNDLE_SUPPORT"]}/lib/tm_factor" +factor_run(STDIN.read) + fallbackInput + line + input + selection + keyEquivalent + ^~e + name + Run Selection/Line in Listener + output + discard + scope + source.factor + uuid + 15A984BD-BC65-43E8-878A-267788C8DA70 + + diff --git a/misc/Factor.tmbundle/Commands/See Word.tmCommand b/misc/Factor.tmbundle/Commands/See Word.tmCommand new file mode 100644 index 0000000000..4502e235be --- /dev/null +++ b/misc/Factor.tmbundle/Commands/See Word.tmCommand @@ -0,0 +1,30 @@ + + + + + beforeRunningCommand + nop + command + #!/usr/bin/env ruby + +require "#{ENV["TM_BUNDLE_SUPPORT"]}/lib/tm_factor" + +doc = STDIN.read +word = line_current_word(ENV["TM_CURRENT_LINE"], ENV["TM_LINE_INDEX"].to_i) +puts factor_eval(%Q(#{doc_using_statements(doc)} USE: prettyprint\n \\ #{word} see)) + fallbackInput + word + input + document + keyEquivalent + ^h + name + See Word + output + showAsTooltip + scope + source.factor + uuid + 35484754-DBF9-4381-BB25-00CAB64DF4A1 + + diff --git a/misc/Factor.tmbundle/Support/lib/tm_factor.rb b/misc/Factor.tmbundle/Support/lib/tm_factor.rb new file mode 100644 index 0000000000..54272e5e36 --- /dev/null +++ b/misc/Factor.tmbundle/Support/lib/tm_factor.rb @@ -0,0 +1,38 @@ +require 'osx/cocoa' + +def _wait_for_return_value(pb) + origCount = pb.changeCount + sleep 0.125 while pb.changeCount == origCount +end + +def perform_service(service, in_string, wait_for_return_value=false) + p = OSX::NSPasteboard.pasteboardWithUniqueName + p.declareTypes_owner([OSX::NSStringPboardType], nil) + p.setString_forType(in_string, OSX::NSStringPboardType) + raise "Unable to call service #{service}" unless OSX::NSPerformService(service, p) + _wait_for_return_value(p) if wait_for_return_value + p.stringForType(OSX::NSStringPboardType) +end + +def textmate_front() + system %Q{osascript -e 'tell app "TextMate" to activate'}; +end + +def factor_run(code) + perform_service("Factor/Evaluate in Listener", code) +end + +def factor_eval(code) + r = perform_service("Factor/Evaluate Selection", code, true) + textmate_front + r +end + +def doc_using_statements(document) + document.scan(/\b(USING:\s[^;]*\s;|USE:\s+\S+|IN:\s\S+)/).join("\n") << "\n" +end + +def line_current_word(line, point) + left = line.rindex(/\s|^/, point - 1) + 1; right = line.index(/\s|$/, point) - 1 + line[left..right] +end diff --git a/misc/Factor.tmbundle/Syntaxes/Factor.tmLanguage b/misc/Factor.tmbundle/Syntaxes/Factor.tmLanguage index ec4961f312..8df0179fd1 100644 --- a/misc/Factor.tmbundle/Syntaxes/Factor.tmLanguage +++ b/misc/Factor.tmbundle/Syntaxes/Factor.tmLanguage @@ -1,5 +1,5 @@ - + fileTypes @@ -240,6 +240,44 @@ + + begin + <" + end + "> + name + string.quoted.double.multiline.factor + patterns + + + include + #escaped_characters + + + + + begin + (^|(?<=\s))(STRING:)\s+(\S+) + captures + + 2 + + name + keyword.colon.factor + + 3 + + name + entity.name.heredoc.factor + + + contentName + string.unquoted.heredoc.factor + end + ^;$ + name + definition.word.heredoc.factor + match inline|foldable @@ -254,9 +292,9 @@ begin - \(\s + \((?=\s) end - \s\) + (^|(?<=\s))\) name comment.parens.factor diff --git a/misc/Factor.tmbundle/Syntaxes/HTML (Factor).tmLanguage b/misc/Factor.tmbundle/Syntaxes/HTML (Factor).tmLanguage index 89c0f191b9..03394b933c 100644 --- a/misc/Factor.tmbundle/Syntaxes/HTML (Factor).tmLanguage +++ b/misc/Factor.tmbundle/Syntaxes/HTML (Factor).tmLanguage @@ -1,5 +1,5 @@ - + fileTypes diff --git a/misc/Factor.tmbundle/info.plist b/misc/Factor.tmbundle/info.plist index 8def3807d7..1ea756a1a5 100644 --- a/misc/Factor.tmbundle/info.plist +++ b/misc/Factor.tmbundle/info.plist @@ -1,9 +1,20 @@ - + name Factor + ordering + + 3C9C9C2A-314A-475B-A4E4-A68BAAF3F36E + 141517D7-73E0-4475-A481-71102575A175 + CAD3BB10-C480-4C0E-9518-94D61F7A0C0B + 15A984BD-BC65-43E8-878A-267788C8DA70 + 8E01DDAF-959B-4237-ADB9-C133A4ACCE90 + 35484754-DBF9-4381-BB25-00CAB64DF4A1 + BC5BE120-734B-40DF-8B6B-5D3243614B27 + B619FCC0-2DF2-4657-82A8-0E5676A10254 + uuid 8061D2F3-B603-411D-AFFE-61784A07906D