opengl.gl sequences typed variants specialized-arrays ;
QUALIFIED-WITH: alien.c-types c
FROM: math => float ;
-SPECIALIZED-ARRAY: int
+SPECIALIZED-ARRAY: c:int
SPECIALIZED-ARRAY: c:float
IN: gpu.state
-UNION: ?rect rect POSTPONE: f ;
-UNION: ?float float POSTPONE: f ;
-
TUPLE: viewport-state
{ rect rect read-only } ;
C: <viewport-state> viewport-state
TUPLE: scissor-state
- { rect ?rect read-only } ;
+ { rect maybe: rect read-only } ;
C: <scissor-state> scissor-state
TUPLE: multisample-state
{ multisample? boolean read-only }
{ sample-alpha-to-coverage? boolean read-only }
{ sample-alpha-to-one? boolean read-only }
- { sample-coverage ?float read-only }
+ { sample-coverage maybe: float read-only }
{ invert-sample-coverage? boolean read-only } ;
C: <multisample-state> multisample-state
op-inc-sat op-dec-sat
op-inc-wrap op-dec-wrap ;
-UNION: ?comparison comparison POSTPONE: f ;
-
TUPLE: stencil-mode
{ value integer initial: 0 read-only }
- { mask integer initial: HEX: FFFFFFFF read-only }
+ { mask integer initial: 0xFFFFFFFF read-only }
{ comparison comparison initial: cmp-always read-only }
{ stencil-fail-op stencil-op initial: op-keep read-only }
{ depth-fail-op stencil-op initial: op-keep read-only }
{ depth-pass-op stencil-op initial: op-keep read-only } ;
C: <stencil-mode> stencil-mode
-UNION: ?stencil-mode stencil-mode POSTPONE: f ;
-
TUPLE: stencil-state
- { front-mode ?stencil-mode initial: f read-only }
- { back-mode ?stencil-mode initial: f read-only } ;
+ { front-mode maybe: stencil-mode initial: f read-only }
+ { back-mode maybe: stencil-mode initial: f read-only } ;
C: <stencil-state> stencil-state
TUPLE: depth-range-state
C: <depth-range-state> depth-range-state
TUPLE: depth-state
- { comparison ?comparison initial: f read-only } ;
+ { comparison maybe: comparison initial: f read-only } ;
C: <depth-state> depth-state
VARIANT: blend-equation
{ dest-function blend-function initial: func-one-minus-source-alpha read-only } ;
C: <blend-mode> blend-mode
-UNION: ?blend-mode blend-mode POSTPONE: f ;
-
TUPLE: blend-state
{ constant-color sequence initial: f read-only }
- { rgb-mode ?blend-mode read-only }
- { alpha-mode ?blend-mode read-only } ;
+ { rgb-mode maybe: blend-mode read-only }
+ { alpha-mode maybe: blend-mode read-only } ;
C: <blend-state> blend-state
TUPLE: mask-state
{ color sequence initial: { t t t t } read-only }
{ depth boolean initial: t read-only }
- { stencil-front integer initial: HEX: FFFFFFFF read-only }
- { stencil-back integer initial: HEX: FFFFFFFF read-only } ;
+ { stencil-front integer initial: 0xFFFFFFFF read-only }
+ { stencil-back integer initial: 0xFFFFFFFF read-only } ;
C: <mask-state> mask-state
VARIANT: triangle-face
VARIANT: triangle-mode
triangle-points triangle-lines triangle-fill ;
-UNION: ?triangle-cull triangle-cull POSTPONE: f ;
-
TUPLE: triangle-cull-state
{ front-face triangle-face initial: face-ccw read-only }
- { cull ?triangle-cull initial: f read-only } ;
+ { cull maybe: triangle-cull initial: f read-only } ;
C: <triangle-cull-state> triangle-cull-state
TUPLE: triangle-state
origin-upper-left origin-lower-left ;
TUPLE: point-state
- { size ?float initial: 1.0 read-only }
+ { size maybe: float initial: 1.0 read-only }
{ sprite-origin point-sprite-origin initial: origin-upper-left read-only }
{ fade-threshold float initial: 1.0 read-only } ;
C: <point-state> point-state
[ set-gpu-state* ] if ; inline
: get-gl-bool ( enum -- value )
- 0 uchar <ref> [ glGetBooleanv ] keep uchar deref c-bool> ;
+ 0 c:uchar <ref> [ glGetBooleanv ] keep c:uchar deref c-bool> ;
: get-gl-int ( enum -- value )
- 0 int <ref> [ glGetIntegerv ] keep int deref ;
+ 0 c:int <ref> [ glGetIntegerv ] keep c:int deref ;
: get-gl-float ( enum -- value )
0 c:float <ref> [ glGetFloatv ] keep c:float deref ;
: get-gl-bools ( enum count -- value )
<byte-array> [ glGetBooleanv ] keep [ c-bool> ] { } map-as ;
: get-gl-ints ( enum count -- value )
- <int-array> [ glGetIntegerv ] keep ;
+ c:int <c-array> [ glGetIntegerv ] keep ;
: get-gl-floats ( enum count -- value )
- <float-array> [ glGetFloatv ] keep ;
+ c:float <c-array> [ glGetFloatv ] keep ;
: get-gl-rect ( enum -- value )
4 get-gl-ints first4 [ 2array ] 2bi@ <rect> ;