]> gitweb.factorcode.org Git - factor.git/commitdiff
un-private some useful words
authorJoe Groff <arcata@gmail.com>
Fri, 8 May 2009 00:46:42 +0000 (19:46 -0500)
committerJoe Groff <arcata@gmail.com>
Fri, 8 May 2009 00:46:42 +0000 (19:46 -0500)
basis/opengl/textures/textures.factor
extra/noise/noise.factor

index d103e90beec923bac0d4d7de4c1e65dadb26975f..49725d22427d2a5dcd494aeab97bb05766e1e460 100755 (executable)
@@ -39,6 +39,8 @@ SLOT: display-list
 
 GENERIC: draw-scaled-texture ( dim texture -- )
 
+DEFER: make-texture
+
 <PRIVATE
 
 TUPLE: single-texture image dim loc texture-coords texture display-list disposed ;
@@ -61,18 +63,6 @@ TUPLE: single-texture image dim loc texture-coords texture display-list disposed
     [ dim>> first2 ] [ component-order>> component-order>format ] [ bitmap>> ] tri
     glTexSubImage2D ;
 
-: make-texture ( image -- id )
-    #! We use glTexSubImage2D to work around the power of 2 texture size
-    #! limitation
-    gen-texture [
-        GL_TEXTURE_BIT [
-            GL_TEXTURE_2D swap glBindTexture
-            non-power-of-2-textures? get
-            [ dup bitmap>> (tex-image) ]
-            [ [ f (tex-image) ] [ (tex-sub-image) ] bi ] if
-        ] do-attribs
-    ] keep ;
-
 : init-texture ( -- )
     GL_TEXTURE_2D GL_TEXTURE_MAG_FILTER GL_NEAREST glTexParameteri
     GL_TEXTURE_2D GL_TEXTURE_MIN_FILTER GL_NEAREST glTexParameteri
@@ -176,6 +166,18 @@ CONSTANT: max-texture-size { 512 512 }
 
 PRIVATE>
 
+: make-texture ( image -- id )
+    #! We use glTexSubImage2D to work around the power of 2 texture size
+    #! limitation
+    gen-texture [
+        GL_TEXTURE_BIT [
+            GL_TEXTURE_2D swap glBindTexture
+            non-power-of-2-textures? get
+            [ dup bitmap>> (tex-image) ]
+            [ [ f (tex-image) ] [ (tex-sub-image) ] bi ] if
+        ] do-attribs
+    ] keep ;
+
 : <texture> ( image loc -- texture )
     over dim>> max-texture-size [ <= ] 2all?
     [ <single-texture> ]
index f2ca8ad59b8c042a61fc339a0f30b7b523784159..c28768283c952dc731464d7aae1f74fbaf11c8e7 100644 (file)
@@ -7,6 +7,9 @@ IN: noise
 : <perlin-noise-table> ( -- table )
     256 iota >byte-array randomize dup append ;
 
+: with-seed ( seed quot -- )
+    [ <mersenne-twister> ] dip with-random ; inline
+
 <PRIVATE
 
 : fade ( point -- point' )
@@ -54,9 +57,6 @@ IN: noise
     v w quot call
     ; inline
 
-: with-seed ( seed quot -- )
-    [ <mersenne-twister> ] dip with-random ; inline
-
 : >byte-map ( floats -- bytes )
     [ 255.0 * >fixnum ] B{ } map-as ;