 GENERIC: update-frame-buffer ( frame-buffer -- )
 
 : init-frame-buffer-pixels ( frame-buffer -- )
-  dup dim>> product 4 * uint <c-array> >>pixels
+  dup dim>> [ gl-scale ] map product >integer 4 * uint <c-array> >>pixels
   drop ;
 
 :: draw-pixels ( FRAME-BUFFER -- )
-    FRAME-BUFFER dim>> first2
+    FRAME-BUFFER dim>> first2 [ gl-scale >fixnum ] bi@
     GL_RGBA
     GL_UNSIGNED_INT
     FRAME-BUFFER pixels>>

USING: accessors alien.c-types alien.data combinators grouping
kernel locals math math.vectors opengl.gl sequences
specialized-arrays ui.gadgets ui.render ;
SPECIALIZED-ARRAY: uint
IN: frame-buffer

:: read-pixels ( FRAME-BUFFER -- )
    0
    0
    FRAME-BUFFER dim>> first2 [ gl-scale >fixnum ] bi@
    GL_RGBA
    GL_UNSIGNED_INT
    FRAME-BUFFER pixels>>
