[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz Documentation/newbie-dev-faq gfx/liblines/L...
From: |
Matti Katila |
Subject: |
[Gzz-commits] gzz Documentation/newbie-dev-faq gfx/liblines/L... |
Date: |
Sat, 02 Nov 2002 08:56:34 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Matti Katila <address@hidden> 02/11/02 08:56:32
Modified files:
Documentation : newbie-dev-faq
gfx/liblines : Lines.cxx Lines.hxx
Log message:
enought textures?
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/Documentation/newbie-dev-faq.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/liblines/Lines.cxx.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/liblines/Lines.hxx.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
Patches:
Index: gzz/Documentation/newbie-dev-faq
diff -u gzz/Documentation/newbie-dev-faq:1.5
gzz/Documentation/newbie-dev-faq:1.6
--- gzz/Documentation/newbie-dev-faq:1.5 Fri Nov 1 12:16:15 2002
+++ gzz/Documentation/newbie-dev-faq Sat Nov 2 08:56:32 2002
@@ -61,3 +61,15 @@
made into a large number of small rectangles, so that
it will appear curved when the vertices of the small
rectangles are transformed.
+
+
+Terms
+-----
+
+-Bilinear
+-Trilinear
+
+Close temrs to mipmapping,
+ Trilinear sums 8 texels and counts weighted average factor from two mipmap
levels.
+ Bilinear is same with 4 texels from one mipmap level.
+ Of course trilinear looks much better - it doesn't jump around.
Index: gzz/gfx/liblines/Lines.cxx
diff -u gzz/gfx/liblines/Lines.cxx:1.4 gzz/gfx/liblines/Lines.cxx:1.5
--- gzz/gfx/liblines/Lines.cxx:1.4 Sat Nov 2 07:47:58 2002
+++ gzz/gfx/liblines/Lines.cxx Sat Nov 2 08:56:32 2002
@@ -18,53 +18,55 @@
using std::ostream;
const int SIZE = 256;
- const int MIPMAPS = int(sqrt(256));
+ const int MIPMAPS = 9;
- static GLfloat line_image[SIZE];
-
- static GLuint texName[1];
+ static GLfloat line_image[MIPMAPS][SIZE];
+ static GLuint texName[MIPMAPS];
// PRIVATE:
+
+ /* makes 1D-texture:
+ * ___________________
+ * |__|__|xx|xx|__|__|
+ *
+ * -where x are black pixels
+ */
void Lines::init() {
- /* ___________________
- * |__|__|xx|xx|__|__|
- *
- * -where x are black pixels
- */
-
-
- for (int i=0; i<SIZE; i++) {
- line_image[i] = 0;
- }
-
- int steps = SIZE / 8;
- int low = steps * 3;
- int high = steps * 5;
+ glGenTextures(MIPMAPS, texName);
+
+ int size = SIZE;
+ for (int level=0; level<MIPMAPS; level++) {
- for (int i=low; i<high; i++) {
- line_image[i] = 1.0;
- }
+ if (level != 0) size /= 2;
- glGenTextures(1, texName);
- glBindTexture(GL_TEXTURE_1D, texName[0]);
+ for (int i=0; i<size; i++) {
+ line_image[level][i] = 0;
+ }
- glTexImage1D(GL_TEXTURE_1D, // target
- 0, // level
- GL_ALPHA, // internalformat
- SIZE, // width
- 0, // border
- GL_ALPHA, // format
- GL_FLOAT, // type
- line_image // *texels
- );
+ int steps = size / 8;
+ int low = steps * 3;
+ int high = steps * 5;
+ for (int i=low; i<high; i++) {
+ line_image[level][i] = 1.0;
+ }
- has_not_inited = false;
+ glBindTexture(GL_TEXTURE_1D, texName[level]);
+
+ glTexImage1D(GL_TEXTURE_1D, 0, GL_ALPHA, size,
+ 0, GL_ALPHA, GL_FLOAT, line_image[level]);
+ }
+ has_not_inited = false;
}
// PUBLIC:
+ Lines::~Lines() {
+ glDeleteTextures(MIPMAPS, texName);
+ }
+
+
void Lines::draw(ZPt a, ZPt b) {
if (dbg) cout << linewidth;
if (dbg) cout <<" x: "<< a.x << ", "<< b.x
@@ -78,7 +80,6 @@
glVertex3f(a.x, a.y, a.z);
glVertex3f(b.x, b.y, b.z);
glEnd();
-
}
}
Index: gzz/gfx/liblines/Lines.hxx
diff -u gzz/gfx/liblines/Lines.hxx:1.3 gzz/gfx/liblines/Lines.hxx:1.4
--- gzz/gfx/liblines/Lines.hxx:1.3 Sat Nov 2 07:06:19 2002
+++ gzz/gfx/liblines/Lines.hxx Sat Nov 2 08:56:32 2002
@@ -31,6 +31,8 @@
* You have to transform a and b _before_
*/
void draw(ZPt a, ZPt b);
+
+ ~Lines();
};
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz Documentation/newbie-dev-faq gfx/liblines/L...,
Matti Katila <=