Handbook
Glossary
set-gpu-state* ( state -- )
Vocabulary
gpu
.
state
Inputs
state
a
gpu-state
Outputs
None
Word description
Changes the GPU state using a single
gpu-state
value.
Definition
IN:
gpu.state
GENERIC:
set-gpu-state*
( state -- )
Methods
USING:
accessors
combinators
gpu.state
gpu.state.private
kernel
opengl.gl
sequences
;
M:
blend-state
set-gpu-state*
[
]
[
rgb-mode>>
]
[
alpha-mode>>
]
tri
or
[
GL_BLEND
glEnable
[
constant-color>>
[
first4
glBlendColor
]
when*
]
[
[
rgb-mode>>
]
[
alpha-mode>>
]
bi
{
[
[
equation>>
gl-blend-equation
]
bi@
glBlendEquationSeparate
]
[
[
~quotation~ ~quotation~
bi
]
bi@
glBlendFuncSeparate
]
}
2cleave
]
bi
]
[
drop
GL_BLEND
glDisable
]
if
;
USING:
accessors
gpu.state
kernel
opengl.gl
;
M:
depth-range-state
set-gpu-state*
[
near>>
]
[
far>>
]
bi
glDepthRange
;
USING:
accessors
gpu.state
gpu.state.private
kernel
opengl.gl
;
M:
depth-state
set-gpu-state*
GL_DEPTH_TEST
swap
comparison>>
[
gl-comparison
glDepthFunc
glEnable
]
[
glDisable
]
if*
;
USING:
accessors
combinators
gpu.state
kernel
opengl.gl
;
M:
line-state
set-gpu-state*
{
[
width>>
glLineWidth
]
[
GL_LINE_SMOOTH
swap
antialias?>>
[
glEnable
]
[
glDisable
]
if
]
}
cleave
;
USING:
accessors
alien.c-types
combinators
gpu.state
kernel
opengl.gl
sequences
;
M:
mask-state
set-gpu-state*
{
[
color>>
[
>c-bool
]
map
first4
glColorMask
]
[
depth>>
>c-bool
glDepthMask
]
[
GL_FRONT
swap
stencil-front>>
glStencilMaskSeparate
]
[
GL_BACK
swap
stencil-back>>
glStencilMaskSeparate
]
}
cleave
;
USING:
accessors
alien.c-types
combinators
gpu.state
kernel
opengl.gl
;
M:
multisample-state
set-gpu-state*
dup
multisample?>>
[
GL_MULTISAMPLE
glEnable
{
[
GL_SAMPLE_ALPHA_TO_COVERAGE
swap
sample-alpha-to-coverage?>>
[
glEnable
]
[
glDisable
]
if
]
[
GL_SAMPLE_ALPHA_TO_ONE
swap
sample-alpha-to-one?>>
[
glEnable
]
[
glDisable
]
if
]
[
GL_SAMPLE_COVERAGE
swap
[
invert-sample-coverage?>>
>c-bool
]
[
sample-coverage>>
]
bi
[
swap
glSampleCoverage
glEnable
]
[
drop
glDisable
]
if*
]
}
cleave
]
[
drop
GL_MULTISAMPLE
glDisable
]
if
;
USING:
accessors
combinators
gpu.state
gpu.state.private
kernel
opengl.gl
;
M:
point-state
set-gpu-state*
{
[
GL_VERTEX_PROGRAM_POINT_SIZE
swap
size>>
[
glPointSize
glDisable
]
[
glEnable
]
if*
]
[
GL_POINT_SPRITE_COORD_ORIGIN
swap
sprite-origin>>
gl-point-sprite-origin
glPointParameteri
]
[
GL_POINT_FADE_THRESHOLD_SIZE
swap
fade-threshold>>
glPointParameterf
]
}
cleave
;
USING:
accessors
gpu.state
kernel
opengl.gl
sequences
;
M:
scissor-state
set-gpu-state*
GL_SCISSOR_TEST
swap
rect>>
[
[
loc>>
first2
]
[
dim>>
first2
]
bi
glViewport
glEnable
]
[
glDisable
]
if*
;
USING:
accessors
combinators.short-circuit
gpu.state
gpu.state.private
kernel
opengl.gl
;
M:
stencil-state
set-gpu-state*
dup
{
[
front-mode>>
]
[
back-mode>>
]
}
1||
[
GL_STENCIL_TEST
glEnable
[
front-mode>>
GL_FRONT
swap
(set-stencil-mode)
]
[
back-mode>>
GL_BACK
swap
(set-stencil-mode)
]
bi
]
[
drop
GL_STENCIL_TEST
glDisable
]
if
;
USING:
accessors
combinators
gpu.state
gpu.state.private
kernel
opengl.gl
;
M:
triangle-cull-state
set-gpu-state*
{
[
front-face>>
gl-triangle-face
glFrontFace
]
[
GL_CULL_FACE
swap
cull>>
[
gl-triangle-cull
glCullFace
glEnable
]
[
glDisable
]
if*
]
}
cleave
;
USING:
accessors
combinators
gpu.state
gpu.state.private
kernel
opengl.gl
;
M:
triangle-state
set-gpu-state*
{
[
GL_FRONT
swap
front-mode>>
gl-triangle-mode
glPolygonMode
]
[
GL_BACK
swap
back-mode>>
gl-triangle-mode
glPolygonMode
]
[
GL_POLYGON_SMOOTH
swap
antialias?>>
[
glEnable
]
[
glDisable
]
if
]
}
cleave
;
USING:
accessors
gpu.state
kernel
opengl
;
M:
viewport-state
set-gpu-state*
rect>>
[
loc>>
]
[
dim>>
]
bi
gl-viewport
;