From d40a61406c58f071a77f55e414148d790fc1e64d Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sun, 12 Jan 2014 14:49:52 -0500 Subject: Replace obsolete procedure call with the correct one. * 2d/texture.scm (draw-texture): Use color module. --- 2d/texture.scm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/2d/texture.scm b/2d/texture.scm index ee0490c..ff6c08a 100644 --- a/2d/texture.scm +++ b/2d/texture.scm @@ -25,9 +25,10 @@ (define-module (2d texture) #:use-module (srfi srfi-9) #:use-module (figl gl) + #:use-module (2d color) + #:use-module (2d helpers) #:use-module (2d wrappers gl) #:use-module (2d wrappers freeimage) - #:use-module (2d helpers) #:export (make-texture make-texture-region load-texture @@ -151,6 +152,10 @@ that will be rendered, in pixels." (freeimage-flip-vertical 32bit-bitmap) 32bit-bitmap)) +;; (define b (load-bitmap "images/p1_front.png")) +;; (define t (bitmap->texture b)) +;; (define tid (gl-generate-texture)) + (define (load-texture filename) "Load a texture from an image file at FILENAME." (let* ((bitmap (load-bitmap filename)) @@ -158,11 +163,10 @@ that will be rendered, in pixels." (freeimage-unload bitmap) texture)) -(define* (draw-texture texture x y #:optional (color #xffffffff)) +(define* (draw-texture texture x y #:optional (color white)) "Render a textured quad in GL immediate mode." (let* ((x2 (+ x (texture-width texture))) (y2 (+ y (texture-height texture))) - (color (rgba->gl-color color)) (r (vector-ref color 0)) (g (vector-ref color 1)) (b (vector-ref color 2)) @@ -172,8 +176,8 @@ that will be rendered, in pixels." (s2 (texture-s2 texture)) (t2 (texture-t2 texture))) (with-gl-bind-texture (texture-target texture-2d) (texture-id texture) + (use-color color) (gl-begin (begin-mode quads) - (gl-color r g b a) (gl-texture-coordinates s1 t1) (gl-vertex x y) (gl-texture-coordinates s1 t2) -- cgit v1.2.3