]> gitweb.factorcode.org Git - factor.git/blob - basis/opengl/opengl-docs.factor
mason: show git SHA1 and timestamp of last completed build
[factor.git] / basis / opengl / opengl-docs.factor
1 USING: alien help.markup help.syntax io kernel math quotations
2 opengl.gl assocs vocabs.loader sequences accessors colors words ;
3 IN: opengl
4
5 HELP: gl-color
6 { $values { "color" color } }
7 { $description "Wrapper for " { $link glColor4d } " taking an instance of " { $link color } "." }
8 { $notes "See " { $link "colors" } "." } ;
9
10 HELP: gl-error
11 { $description "If the most recent OpenGL call resulted in an error, throw a " { $snippet "gl-error" } " instance reporting the error." } ;
12
13 HELP: do-enabled
14 { $values { "what" integer } { "quot" quotation } }
15 { $description "Wraps a quotation in " { $link glEnable } "/" { $link glDisable } " calls." } ;
16
17 HELP: do-matrix
18 { $values { "quot" quotation } }
19 { $description "Saves and restores the current matrix before and after calling the quotation." } ;
20
21 HELP: gl-line
22 { $values { "a" "a pair of integers" } { "b" "a pair of integers" } }
23 { $description "Draws a line between two points." } ;
24
25 HELP: gl-fill-rect
26 { $values { "loc" "a pair of integers" } { "dim" "a pair of integers" } }
27 { $description "Draws a filled rectangle with the top-left corner at the origin and the given dimensions." } ;
28
29 HELP: gl-rect
30 { $values { "loc" "a pair of integers" } { "dim" "a pair of integers" } }
31 { $description "Draws the outline of a rectangle with the top-left corner at the origin and the given dimensions." } ;
32
33 HELP: gen-gl-buffer
34 { $values { "id" integer } }
35 { $description "Wrapper for " { $link glGenBuffers } " to handle the common case of generating a single buffer ID." } ;
36
37 HELP: delete-gl-buffer
38 { $values { "id" integer } }
39 { $description "Wrapper for " { $link glDeleteBuffers } " to handle the common case of deleting a single buffer ID." } ;
40
41 { gen-gl-buffer delete-gl-buffer } related-words
42
43 HELP: bind-texture-unit
44 { $values { "id" "The id of a texture object." } { "target" "The texture target (e.g., " { $snippet "GL_TEXTURE_2D" } ")" } { "unit" "The texture unit to bind (e.g., " { $snippet "GL_TEXTURE0" } ")" } }
45 { $description "Binds texture " { $snippet "id" } " to texture target " { $snippet "target" } " of texture unit " { $snippet "unit" } ". Equivalent to " { $snippet "unit glActiveTexture target id glBindTexture" } "." } ;
46
47 HELP: set-draw-buffers
48 { $values { "buffers" "A sequence of buffer words (e.g. " { $snippet "GL_BACK" } ", " { $snippet "GL_COLOR_ATTACHMENT0" } ")" } }
49 { $description "Wrapper for " { $link glDrawBuffers } ". Sets up the buffers named in the sequence for simultaneous drawing." } ;
50
51 HELP: do-attribs
52 { $values { "bits" integer } { "quot" quotation } }
53 { $description "Wraps a quotation in " { $link glPushAttrib } "/" { $link glPopAttrib } " calls." } ;
54
55 HELP: gen-dlist
56 { $values { "id" integer } }
57 { $description "Wrapper for " { $link glGenLists } " to handle the common case of generating a single display list ID." } ;
58
59 HELP: make-dlist
60 { $values { "type" "one of " { $link GL_COMPILE } " or " { $link GL_COMPILE_AND_EXECUTE } } { "quot" quotation } { "id" "an OpenGL texture ID" } }
61 { $description "Compiles the results of calling the quotation into a new OpenGL display list." } ;
62
63 HELP: gl-translate
64 { $values { "point" "a pair of integers" } }
65 { $description "Wrapper for " { $link glTranslated } " taking a point object." } ;
66
67 HELP: with-translation
68 { $values { "loc" "a pair of integers" } { "quot" quotation } }
69 { $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." } ;
70
71 ARTICLE: "gl-utilities" "OpenGL utility words"
72 "The " { $vocab-link "opengl" } " vocabulary implements some utility words to give OpenGL a more Factor-like feel."
73 $nl
74 "The " { $vocab-link "opengl.gl" } " and " { $vocab-link "opengl.glu" } " vocabularies have the actual OpenGL bindings."
75 { $subsections "opengl-low-level" }
76 "Error reporting:"
77 { $subsections gl-error }
78 "Wrappers:"
79 { $subsections
80     gl-color
81     gl-translate
82     bind-texture-unit
83 }
84 "Combinators:"
85 { $subsections
86     do-enabled
87     do-attribs
88     do-matrix
89     with-translation
90     make-dlist
91 }
92 "Rendering geometric shapes:"
93 { $subsections
94     gl-line
95     gl-fill-rect
96     gl-rect
97 } ;
98
99 ABOUT: "gl-utilities"