opengl: properly scale viewports.
parent
43d91bcf08
commit
ab3d6b1d13
|
@ -12,13 +12,13 @@ SINGLETON: core-text-renderer
|
|||
<PRIVATE
|
||||
|
||||
: unscale ( m -- n )
|
||||
retina? get-global [ 2.0 / ] when ; inline
|
||||
retina? get-global [ 2 /i ] when ; inline
|
||||
|
||||
: scale ( m -- n )
|
||||
retina? get-global [ 2.0 * ] when ; inline
|
||||
retina? get-global [ 2 * ] when ; inline
|
||||
|
||||
: scale-dim ( dim -- dim' )
|
||||
retina? get-global [ [ 2.0 / ] map ] when ; inline
|
||||
retina? get-global [ [ 2 /i ] map ] when ; inline
|
||||
|
||||
: scale-metrics ( metrics -- metrics' )
|
||||
retina? get-global [
|
||||
|
|
|
@ -310,7 +310,7 @@ PRIVATE>
|
|||
GENERIC: set-gpu-state* ( state -- )
|
||||
|
||||
M: viewport-state set-gpu-state*
|
||||
rect>> [ loc>> first2 ] [ dim>> first2 ] bi glViewport ;
|
||||
rect>> [ loc>> ] [ dim>> ] bi gl-viewport ;
|
||||
|
||||
M: triangle-cull-state set-gpu-state*
|
||||
{
|
||||
|
|
|
@ -307,7 +307,7 @@ TYPED: read-compressed-texture ( tdt: texture-data-target level: integer -- byte
|
|||
[ texture-dim ]
|
||||
[ drop texture-object [ component-order>> ] [ component-type>> ] bi f f ]
|
||||
[ read-texture ] 2tri
|
||||
image boa ; inline
|
||||
f image boa ; inline
|
||||
|
||||
<PRIVATE
|
||||
: bind-texture ( texture -- gl-target )
|
||||
|
|
|
@ -51,7 +51,7 @@ M: demo-world pref-dim* ( gadget -- dim )
|
|||
M: demo-world resize-world
|
||||
GL_PROJECTION glMatrixMode
|
||||
glLoadIdentity
|
||||
[ [ 0 0 ] dip dim>> first2 glViewport ]
|
||||
[ [ { 0 0 } ] dip dim>> gl-viewport ]
|
||||
[ demo-world-frustum glFrustum ] bi ;
|
||||
|
||||
: demo-world-set-matrix ( gadget -- )
|
||||
|
|
|
@ -248,7 +248,7 @@ M: spheres-world end-world
|
|||
|
||||
: (draw-reflection-texture) ( gadget -- )
|
||||
dup reflection-framebuffer>> [ {
|
||||
[ drop 0 0 (reflection-dim) glViewport ]
|
||||
[ drop { 0 0 } (reflection-dim) 2array gl-viewport ]
|
||||
[
|
||||
GL_PROJECTION glMatrixMode
|
||||
glPushMatrix glLoadIdentity
|
||||
|
@ -275,7 +275,7 @@ M: spheres-world end-world
|
|||
glPopMatrix 90.0 1.0 0.0 0.0 glRotatef ]
|
||||
[ sphere-scene ]
|
||||
[
|
||||
[ 0 0 ] dip dim>> first2 glViewport
|
||||
[ { 0 0 } ] dip dim>> gl-viewport
|
||||
GL_PROJECTION glMatrixMode
|
||||
glPopMatrix
|
||||
]
|
||||
|
|
|
@ -266,7 +266,7 @@ M: terrain-world end-game-world
|
|||
M: terrain-world resize-world
|
||||
GL_PROJECTION glMatrixMode
|
||||
glLoadIdentity
|
||||
dim>> [ [ 0 0 ] dip first2 glViewport ]
|
||||
dim>> [ [ { 0 0 } ] dip gl-viewport ]
|
||||
[ frustum glFrustum ] bi ;
|
||||
|
||||
M: terrain-world draw-world*
|
||||
|
|
Loading…
Reference in New Issue