images.viewer can now display some un-normalized images
parent
ff3c5b28bd
commit
2f26d5f3da
basis/opengl/textures
extra/images/viewer
|
@ -11,14 +11,16 @@ IN: opengl.textures
|
|||
|
||||
TUPLE: texture loc dim texture-coords texture display-list disposed ;
|
||||
|
||||
<PRIVATE
|
||||
|
||||
GENERIC: component-order>format ( component-order -- format type )
|
||||
|
||||
M: RGB component-order>format drop GL_RGB GL_UNSIGNED_BYTE ;
|
||||
M: BGR component-order>format drop GL_BGR GL_UNSIGNED_BYTE ;
|
||||
M: RGBA component-order>format drop GL_RGBA GL_UNSIGNED_BYTE ;
|
||||
M: ARGB component-order>format drop GL_BGRA_EXT GL_UNSIGNED_INT_8_8_8_8_REV ;
|
||||
M: BGRA component-order>format drop GL_BGRA_EXT GL_UNSIGNED_BYTE ;
|
||||
|
||||
<PRIVATE
|
||||
|
||||
: repeat-last ( seq n -- seq' )
|
||||
over peek pad-tail concat ;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
! Copyright (C) 2007 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors images images.loader io.pathnames kernel
|
||||
namespaces opengl opengl.gl sequences strings ui ui.gadgets
|
||||
USING: accessors images images.loader io.pathnames kernel namespaces
|
||||
opengl opengl.gl opengl.textures sequences strings ui ui.gadgets
|
||||
ui.gadgets.panes ui.render ;
|
||||
IN: images.viewer
|
||||
|
||||
|
@ -12,8 +12,8 @@ M: image-gadget pref-dim*
|
|||
|
||||
: draw-image ( image -- )
|
||||
0 0 glRasterPos2i 1.0 -1.0 glPixelZoom
|
||||
[ dim>> first2 GL_RGBA GL_UNSIGNED_BYTE ]
|
||||
[ bitmap>> ] bi glDrawPixels ;
|
||||
[ dim>> first2 ] [ component-order>> component-order>format ] [ bitmap>> ] tri
|
||||
glDrawPixels ;
|
||||
|
||||
M: image-gadget draw-gadget* ( gadget -- )
|
||||
image>> draw-image ;
|
||||
|
|
Loading…
Reference in New Issue