opengl: adding support for a gl-scale-factor.
parent
f2ce2a0b61
commit
44b7bbc76d
|
@ -13,6 +13,8 @@ SPECIALIZED-ARRAY: float
|
||||||
SPECIALIZED-ARRAY: uint
|
SPECIALIZED-ARRAY: uint
|
||||||
IN: opengl
|
IN: opengl
|
||||||
|
|
||||||
|
SYMBOL: gl-scale-factor
|
||||||
|
|
||||||
: gl-color ( color -- ) >rgba-components glColor4d ; inline
|
: gl-color ( color -- ) >rgba-components glColor4d ; inline
|
||||||
|
|
||||||
: gl-clear-color ( color -- ) >rgba-components glClearColor ;
|
: gl-clear-color ( color -- ) >rgba-components glClearColor ;
|
||||||
|
@ -200,8 +202,14 @@ MACRO: set-draw-buffers ( buffers -- )
|
||||||
: with-translation ( loc quot -- )
|
: with-translation ( loc quot -- )
|
||||||
[ [ gl-translate ] dip call ] do-matrix ; inline
|
[ [ gl-translate ] dip call ] do-matrix ; inline
|
||||||
|
|
||||||
|
: gl-scale ( m -- n )
|
||||||
|
gl-scale-factor get-global [ * ] when* ; inline
|
||||||
|
|
||||||
|
: gl-unscale ( m -- n )
|
||||||
|
gl-scale-factor get-global [ / ] when* ; inline
|
||||||
|
|
||||||
: fix-coordinates ( point1 point2 -- x1 y1 x2 y2 )
|
: fix-coordinates ( point1 point2 -- x1 y1 x2 y2 )
|
||||||
[ first2 [ >fixnum ] bi@ ] bi@ ;
|
[ first2 [ gl-scale >fixnum ] bi@ ] bi@ ;
|
||||||
|
|
||||||
: gl-set-clip ( loc dim -- )
|
: gl-set-clip ( loc dim -- )
|
||||||
fix-coordinates glScissor ;
|
fix-coordinates glScissor ;
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
! Copyright (C) 2006, 2010 Slava Pestov
|
! Copyright (C) 2006, 2010 Slava Pestov
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors alien alien.c-types alien.data alien.strings
|
USING: accessors alien alien.c-types alien.data alien.strings
|
||||||
arrays assocs cocoa kernel math cocoa.messages cocoa.subclassing
|
arrays assocs cocoa cocoa.application cocoa.classes
|
||||||
cocoa.classes cocoa.views cocoa.application cocoa.pasteboard
|
cocoa.pasteboard cocoa.runtime cocoa.subclassing cocoa.types
|
||||||
cocoa.runtime cocoa.types cocoa.windows sequences
|
cocoa.views combinators core-foundation.strings core-graphics
|
||||||
io.encodings.utf8 locals ui ui.private ui.gadgets
|
core-graphics.types io.encodings.utf8 kernel locals math
|
||||||
ui.gadgets.private ui.gadgets.worlds ui.gestures
|
math.rectangles namespaces opengl sequences threads ui.gadgets
|
||||||
core-foundation.strings core-graphics core-graphics.types
|
ui.gadgets.private ui.gadgets.worlds ui.gestures ui.private ;
|
||||||
threads combinators math.rectangles ;
|
|
||||||
IN: ui.backend.cocoa.views
|
IN: ui.backend.cocoa.views
|
||||||
|
|
||||||
: send-mouse-moved ( view event -- )
|
: send-mouse-moved ( view event -- )
|
||||||
|
@ -307,6 +306,7 @@ CLASS: FactorView < NSOpenGLView NSTextInput
|
||||||
|
|
||||||
METHOD: void prepareOpenGL [
|
METHOD: void prepareOpenGL [
|
||||||
self 1 -> setWantsBestResolutionOpenGLSurface:
|
self 1 -> setWantsBestResolutionOpenGLSurface:
|
||||||
|
self -> backingScaleFactor gl-scale-factor set-global
|
||||||
]
|
]
|
||||||
|
|
||||||
! Initialization
|
! Initialization
|
||||||
|
|
Loading…
Reference in New Issue