Clean up basis.opengl and fix tests
parent
2400e6bc51
commit
f843877d35
|
@ -22,14 +22,14 @@ IN: opengl.textures.tests
|
||||||
{ component-order RGB }
|
{ component-order RGB }
|
||||||
{ bitmap
|
{ bitmap
|
||||||
B{
|
B{
|
||||||
1 2 3 4 5 6 7 8 9 0 0 0
|
1 2 3 4 5 6 7 8 9 7 8 9
|
||||||
10 11 12 13 14 15 16 17 18 0 0 0
|
10 11 12 13 14 15 16 17 18 16 17 18
|
||||||
19 20 21 22 23 24 25 26 27 0 0 0
|
19 20 21 22 23 24 25 26 27 25 26 27
|
||||||
28 29 30 31 32 33 34 35 36 0 0 0
|
28 29 30 31 32 33 34 35 36 34 35 36
|
||||||
37 38 39 40 41 42 43 44 45 0 0 0
|
37 38 39 40 41 42 43 44 45 43 44 45
|
||||||
0 0 0 0 0 0 0 0 0 0 0 0
|
37 38 39 40 41 42 43 44 45 43 44 45
|
||||||
0 0 0 0 0 0 0 0 0 0 0 0
|
37 38 39 40 41 42 43 44 45 43 44 45
|
||||||
0 0 0 0 0 0 0 0 0 0 0 0
|
37 38 39 40 41 42 43 44 45 43 44 45
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,17 +19,21 @@ 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: 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_INT_8_8_8_8 ;
|
M: BGRA component-order>format drop GL_BGRA_EXT GL_UNSIGNED_INT_8_8_8_8 ;
|
||||||
|
|
||||||
|
: repeat-last ( seq n -- seq' )
|
||||||
|
over peek pad-tail concat ;
|
||||||
|
|
||||||
: power-of-2-bitmap ( rows dim size -- bitmap dim )
|
: power-of-2-bitmap ( rows dim size -- bitmap dim )
|
||||||
'[
|
'[
|
||||||
[ [ [ _ group ] map ] dip first '[ _ over peek pad-tail concat ] map ]
|
first2
|
||||||
[ second over peek pad-tail ] bi
|
[ [ _ ] dip '[ _ group _ repeat-last ] map ]
|
||||||
concat
|
[ repeat-last ]
|
||||||
|
bi*
|
||||||
] keep ;
|
] keep ;
|
||||||
|
|
||||||
: image-rows ( image -- rows )
|
: image-rows ( image -- rows )
|
||||||
[ bitmap>> ]
|
[ bitmap>> ]
|
||||||
[ dim>> first ]
|
[ dim>> first ]
|
||||||
[ component-order>> bytes-per-component ]
|
[ component-order>> bytes-per-pixel ]
|
||||||
tri * group ; inline
|
tri * group ; inline
|
||||||
|
|
||||||
: power-of-2-image ( image -- image )
|
: power-of-2-image ( image -- image )
|
||||||
|
@ -37,7 +41,7 @@ M: BGRA component-order>format drop GL_BGRA_EXT GL_UNSIGNED_INT_8_8_8_8 ;
|
||||||
clone dup
|
clone dup
|
||||||
[ image-rows ]
|
[ image-rows ]
|
||||||
[ dim>> [ next-power-of-2 ] map ]
|
[ dim>> [ next-power-of-2 ] map ]
|
||||||
[ component-order>> bytes-per-component ] tri
|
[ component-order>> bytes-per-pixel ] tri
|
||||||
power-of-2-bitmap
|
power-of-2-bitmap
|
||||||
[ >>bitmap ] [ >>dim ] bi*
|
[ >>bitmap ] [ >>dim ] bi*
|
||||||
] unless ;
|
] unless ;
|
||||||
|
|
Loading…
Reference in New Issue