summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2016-02-23 19:57:14 -0500
committerDavid Thompson <dthompson2@worcester.edu>2016-02-23 19:57:14 -0500
commit840139912553ee5045b22f8a218e909991fa79f0 (patch)
tree61abb310c25579e4453e423601163bee00838a66
parentfd877516f85ad8dcbef5f4fa29c91d17d4c19f48 (diff)
render: texture: Remove unused texture vertex code.
* sly/render/texture.scm (texture-vertex, pack-texture-vertices, draw-texture-vertices): Delete.
-rw-r--r--sly/render/texture.scm55
1 files changed, 5 insertions, 50 deletions
diff --git a/sly/render/texture.scm b/sly/render/texture.scm
index 2e77b0f..bda6ed1 100644
--- a/sly/render/texture.scm
+++ b/sly/render/texture.scm
@@ -52,9 +52,6 @@
texture-t2
null-texture
anchor-texture
- texture-vertex
- pack-texture-vertices
- draw-texture-vertices
apply-texture))
;;;
@@ -115,6 +112,11 @@ that will be rendered, in pixels."
(register-finalizer texture? free-texture)
+(define (apply-texture texture)
+ (gl-enable (enable-cap texture-2d))
+ (glBindTexture (texture-target texture-2d)
+ (texture-id texture)))
+
(define* (bytevector->texture pixels width height min-filter mag-filter
#:optional (format (pixel-format rgba)))
"Translate the bytevector PIXELS into an OpenGL texture with
@@ -207,50 +209,3 @@ vector to be returned."
('bottom-center
(vector2 (/ w 2) 0))
(_ (error "Invalid anchor type: " anchor)))))
-
-;;;
-;;; Texture Vertices
-;;;
-
-(define-packed-struct texture-vertex
- ;; Position
- (x float)
- (y float)
- ;; Texture Coordinates
- (s float)
- (t float))
-
-(define texture-vertex-size (packed-struct-size texture-vertex))
-(define x-offset (packed-struct-offset texture-vertex x))
-(define s-offset (packed-struct-offset texture-vertex s))
-
-(define (pack-texture-vertices vertices offset width height s1 t1 s2 t2)
- ;; Vertices go counter clockwise, starting from the top-left
- ;; corner.
- (pack vertices offset texture-vertex 0 0 s1 t1)
- (pack vertices (+ offset 1) texture-vertex 0 height s1 t2)
- (pack vertices (+ offset 2) texture-vertex width height s2 t2)
- (pack vertices (+ offset 3) texture-vertex width 0 s2 t1))
-
-(define (apply-texture texture)
- (gl-enable (enable-cap texture-2d))
- (glBindTexture (texture-target texture-2d)
- (texture-id texture)))
-
-(define (draw-texture-vertices texture vertices size)
- (let ((pointer-type (tex-coord-pointer-type float)))
- (gl-enable-client-state (enable-cap vertex-array))
- (gl-enable-client-state (enable-cap texture-coord-array))
- (with-gl-bind-texture (texture-target texture-2d) (texture-id texture)
- (set-gl-vertex-array pointer-type
- vertices
- 2
- #:stride texture-vertex-size
- #:offset x-offset)
- (set-gl-texture-coordinates-array pointer-type
- vertices
- #:stride texture-vertex-size
- #:offset s-offset)
- (gl-draw-arrays (begin-mode quads) 0 (* size 4)))
- (gl-disable-client-state (enable-cap texture-coord-array))
- (gl-disable-client-state (enable-cap vertex-array))))