gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] gzz/gfx/liblines Lines.cxx


From: Matti Katila
Subject: [Gzz-commits] gzz/gfx/liblines Lines.cxx
Date: Sat, 02 Nov 2002 07:47:58 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Matti Katila <address@hidden>   02/11/02 07:47:58

Modified files:
        gfx/liblines   : Lines.cxx 

Log message:
        texture object?

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/liblines/Lines.cxx.diff?tr1=1.3&tr2=1.4&r1=text&r2=text

Patches:
Index: gzz/gfx/liblines/Lines.cxx
diff -u gzz/gfx/liblines/Lines.cxx:1.3 gzz/gfx/liblines/Lines.cxx:1.4
--- gzz/gfx/liblines/Lines.cxx:1.3      Sat Nov  2 07:06:19 2002
+++ gzz/gfx/liblines/Lines.cxx  Sat Nov  2 07:47:58 2002
@@ -3,6 +3,8 @@
 
 #include <GL/gl.h>
 
+#include <cmath>
+
 namespace Lines {
     DBGVAR(dbg, "Lines.general");
 
@@ -16,22 +18,25 @@
     using std::ostream;
 
     const int SIZE = 256;
-    static GLfloat line_image[SIZE][4];
+    const int MIPMAPS = int(sqrt(256));
+
+    static GLfloat line_image[SIZE];
+
+    static GLuint texName[1];
 
 
   // PRIVATE:
     void Lines::init() {
 
-      /*   |__|__|xx|xx|__|__|
+      /*     ___________________
+       *     |__|__|xx|xx|__|__|
        * 
        *  -where x are black pixels
        */
 
+
         for (int i=0; i<SIZE; i++) {
-            line_image[i][0] = 0;
-            line_image[i][1] = 0;
-            line_image[i][2] = 0;
-            line_image[i][3] = 0;
+            line_image[i] = 0;
         } 
 
        int steps = SIZE / 8;
@@ -39,22 +44,22 @@
        int high  = steps * 5;
 
        for (int i=low; i<high; i++) {
-            line_image[i][0] = 0;
-            line_image[i][1] = 0;
-            line_image[i][2] = 0;
-            line_image[i][3] = 1.0;
+            line_image[i] = 1.0;
        }
 
+       glGenTextures(1, texName);
+       glBindTexture(GL_TEXTURE_1D, texName[0]);
 
        glTexImage1D(GL_TEXTURE_1D,  // target
                     0,              // level
-                    GL_RGBA,        // internalformat
+                    GL_ALPHA,       // internalformat
                     SIZE,           // width
                     0,              // border
-                    GL_RGBA,        // format
+                    GL_ALPHA,        // format
                     GL_FLOAT,        // type
                     line_image      // *texels
        );
+
 
         has_not_inited = false;
     }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]