[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz gzz/gfx/gl/GL.java gzz/gfx/gl/GLSpans.java ...
From: |
Tuomas J. Lukka |
Subject: |
[Gzz-commits] gzz gzz/gfx/gl/GL.java gzz/gfx/gl/GLSpans.java ... |
Date: |
Fri, 13 Dec 2002 07:16:07 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Tuomas J. Lukka <address@hidden> 02/12/13 07:16:06
Modified files:
gzz/gfx/gl : GL.java GLSpans.java
gfx : rules.mk
gfx/jni : GzzGL-jni.cxx
gfx/libos : Os-GLX.cxx Os.hxx
gfx/librenderables: Renderables.hxx renderables.py
gfx/libutil : Debug.hxx effects.py
Log message:
LoadIntoTexture should allow subregion; fix 4-alignment of compressed
textures
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/gfx/gl/GL.java.diff?tr1=1.30&tr2=1.31&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/gfx/gl/GLSpans.java.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/rules.mk.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/jni/GzzGL-jni.cxx.diff?tr1=1.71&tr2=1.72&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libos/Os-GLX.cxx.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libos/Os.hxx.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/Renderables.hxx.diff?tr1=1.25&tr2=1.26&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/renderables.py.diff?tr1=1.163&tr2=1.164&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libutil/Debug.hxx.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libutil/effects.py.diff?tr1=1.26&tr2=1.27&r1=text&r2=text
Patches:
Index: gzz/gfx/jni/GzzGL-jni.cxx
diff -u gzz/gfx/jni/GzzGL-jni.cxx:1.71 gzz/gfx/jni/GzzGL-jni.cxx:1.72
--- gzz/gfx/jni/GzzGL-jni.cxx:1.71 Thu Dec 12 13:40:30 2002
+++ gzz/gfx/jni/GzzGL-jni.cxx Fri Dec 13 07:16:06 2002
@@ -516,13 +516,17 @@
}
JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1Texture_1loadSubImage
- (JNIEnv *env, jclass, jint id, jint level, jint imageId, jint xoffs, jint
yoffs) {
+ (JNIEnv *env, jclass, jint id, jint level, jint imageId, jint x, jint y,
+ jint xoffs, jint yoffs, jint w, jint h) {
glBindTexture(GL_TEXTURE_2D, id);
+ GLERR
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
+ GLERR
Image *img = images.get(imageId);
- img->loadIntoTexture(level, xoffs, yoffs);
+ img->loadIntoTexture(level, x, y, xoffs, yoffs, w, h);
+ GLERR
glBindTexture(GL_TEXTURE_2D, 0);
GLERR
}
Index: gzz/gfx/libos/Os-GLX.cxx
diff -u gzz/gfx/libos/Os-GLX.cxx:1.18 gzz/gfx/libos/Os-GLX.cxx:1.19
--- gzz/gfx/libos/Os-GLX.cxx:1.18 Wed Dec 11 07:47:35 2002
+++ gzz/gfx/libos/Os-GLX.cxx Fri Dec 13 07:16:06 2002
@@ -57,6 +57,7 @@
ImageRaster loadImage(const char *filename) ;
DBGVAR(dbg, "GLX.general");
+ DBGVAR(dbg_image, "GLX.image");
/** Attributes for db visual.
*/
@@ -130,11 +131,23 @@
tile.loadImage(r);
}
}
- void loadIntoTexture(GLint level, GLint xoffset, GLint yoffset) {
+ void loadIntoTexture(GLint level, GLint x, GLint y, GLint xoffset,
GLint yoffset,
+ GLint wid, GLint hei) {
+ DBG(dbg_image) << "LoadIntoTexture "<<level<<" "<<xoffset<<"
"<<yoffset<<" "
+ << x << " " << y << " "
+ << w << " " << h << " "
+ << wid << " " << hei << " "
+ << r.getGLFormat() << " "<<r.getGLType() << "\n";
+ glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
r.setGLPixelModes();
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, x);
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, y);
+ GLERR
glTexSubImage2D(GL_TEXTURE_2D, level, xoffset, yoffset,
- w, h, r.getGLFormat(), r.getGLType(), r.getPointer()
+ wid, hei, r.getGLFormat(), r.getGLType(), r.getPointer()
);
+ GLERR
+ glPopClientAttrib();
}
};
Index: gzz/gfx/libos/Os.hxx
diff -u gzz/gfx/libos/Os.hxx:1.15 gzz/gfx/libos/Os.hxx:1.16
--- gzz/gfx/libos/Os.hxx:1.15 Thu Dec 5 03:32:57 2002
+++ gzz/gfx/libos/Os.hxx Fri Dec 13 07:16:06 2002
@@ -51,8 +51,8 @@
int x, int y, int w, int h) = 0;
/** Load this image into the current texture_2D.
*/
- virtual void loadIntoTexture(GLint level, GLint xoffset,
- GLint yoffset) = 0;
+ virtual void loadIntoTexture(GLint level, GLint x, GLint y, GLint
xoffset,
+ GLint yoffset, GLint w, GLint h) = 0;
};
Index: gzz/gfx/librenderables/Renderables.hxx
diff -u gzz/gfx/librenderables/Renderables.hxx:1.25
gzz/gfx/librenderables/Renderables.hxx:1.26
--- gzz/gfx/librenderables/Renderables.hxx:1.25 Thu Dec 12 13:40:30 2002
+++ gzz/gfx/librenderables/Renderables.hxx Fri Dec 13 07:16:06 2002
@@ -21,41 +21,6 @@
#include "libutil/Irregu.hxx"
-#define GLERR { int er = glGetError(); if(er != GL_NO_ERROR) \
- cout << "===== OPENGL ERROR "<<__FILE__<<" "<<__LINE__ \
- <<" "<<gluErrorString(er)<<"\n"; \
- }
-
-
-#define STKS { if(dbg) {int sa, sm; glGetIntegerv(GL_ATTRIB_STACK_DEPTH, &sa);
\
- glGetIntegerv(GL_MODELVIEW_STACK_DEPTH, &sm); \
- cout << __FILE__<<" "<<__LINE__<<" STACKS: "<<sa<<"
"<<sm<<"\n";} }
-
-
-#if 0
-
-#define STKS
-
-#endif
-
-
-#if 0
-
-#define MATR { GLfloat mat[16]; glGetFloatv(GL_MODELVIEW_MATRIX, mat); \
- cout <<"Matrix: \n"; \
- for(int x = 0; x < 4; x++) { \
- for(int y = 0 ; y < 4; y++) { \
- cout << "\t"<< mat[y + x*4]; \
- } \
- cout << "\n"; \
- } \
- }
-#else
-
-#define MATR
-
-#endif
-
namespace CurrentFPS {
// bool showFPS;
extern double current_fps;
Index: gzz/gfx/librenderables/renderables.py
diff -u gzz/gfx/librenderables/renderables.py:1.163
gzz/gfx/librenderables/renderables.py:1.164
--- gzz/gfx/librenderables/renderables.py:1.163 Thu Dec 12 13:40:30 2002
+++ gzz/gfx/librenderables/renderables.py Fri Dec 13 07:16:06 2002
@@ -1385,14 +1385,15 @@
ZPt(+x2,my1,0), ZPt(+x1,my2,0), ZPt(+x1,+y2,0) };
int dice[] = { diceb, dicex, diceb, dicey, diceb, dicex, diceb, dicey
};
- #if 1
ZPt poly2[9];
for (int i = 0; i < 9; i++) poly2[i] = coords2.transform(poly[i]);
// Disable the effect of TEXTURE1 as the clipping is done explicitly
glMultiTexCoord2f(1, .5, .5);
- vector<ZPt> pts;
+ static vector<ZPt> pts;
+ pts.clear();
+ pts.reserve(int(1.5 * (4*diceb + 2*dicex + 2*dicey)));
ZPt prev = poly2[0];
for (int i = 0; i < 8; i++) {
@@ -1406,19 +1407,6 @@
drawStarPoly(coords1, pts);
- #else
-
- glBegin(GL_TRIANGLE_FAN);
- vert(coords1, coords2, ZPt(0,0,0));
- for (int i = 0; i < 8; i++) {
- for (int d = 0; d <= dice[i]; d++) {
- float t = (float)d / dice[i];
- vert(coords1, coords2, lerp(poly[i], poly[i+1], t));
- }
- }
- glEnd();
- #endif
-
if (flags & IRREGU_SHIFTS) glPopMatrix();
}
@@ -1429,6 +1417,8 @@
""",
} ,
+
+
# coords1: paper => window
# coords2: frame => paper (assumed to be affine)
Index: gzz/gfx/libutil/Debug.hxx
diff -u gzz/gfx/libutil/Debug.hxx:1.6 gzz/gfx/libutil/Debug.hxx:1.7
--- gzz/gfx/libutil/Debug.hxx:1.6 Wed Aug 21 05:12:25 2002
+++ gzz/gfx/libutil/Debug.hxx Fri Dec 13 07:16:06 2002
@@ -4,6 +4,42 @@
#include <vector>
+#define GLERR { int er = glGetError(); if(er != GL_NO_ERROR) \
+ cout << "===== OPENGL ERROR "<<__FILE__<<" "<<__LINE__ \
+ <<" "<<gluErrorString(er)<<"\n"; \
+ }
+
+
+#define STKS { if(dbg) {int sa, sm; glGetIntegerv(GL_ATTRIB_STACK_DEPTH, &sa);
\
+ glGetIntegerv(GL_MODELVIEW_STACK_DEPTH, &sm); \
+ cout << __FILE__<<" "<<__LINE__<<" STACKS: "<<sa<<"
"<<sm<<"\n";} }
+
+
+#if 0
+
+#define STKS
+
+#endif
+
+
+#if 0
+
+#define MATR { GLfloat mat[16]; glGetFloatv(GL_MODELVIEW_MATRIX, mat); \
+ cout <<"Matrix: \n"; \
+ for(int x = 0; x < 4; x++) { \
+ for(int y = 0 ; y < 4; y++) { \
+ cout << "\t"<< mat[y + x*4]; \
+ } \
+ cout << "\n"; \
+ } \
+ }
+#else
+
+#define MATR
+
+#endif
+
+
/** Handling debug variables.
* This namespace (essentially a Singleton object) provides
* a global namespace of integer variables, useful for
Index: gzz/gfx/libutil/effects.py
diff -u gzz/gfx/libutil/effects.py:1.26 gzz/gfx/libutil/effects.py:1.27
--- gzz/gfx/libutil/effects.py:1.26 Thu Dec 12 13:41:00 2002
+++ gzz/gfx/libutil/effects.py Fri Dec 13 07:16:06 2002
@@ -8,8 +8,8 @@
from gfx.libpaper.texcache import getCachedTexture
class IrreguFrame(IrregularFrame):
- dicefactor = .5
- # dicefactor = 0.1
+ dicefactor = .4
+ # dicefactor = 0.03
tex = GL.createTexture()
tex.shade(128, 128, 0, 1, "INTENSITY", "LUMINANCE",
Index: gzz/gfx/rules.mk
diff -u gzz/gfx/rules.mk:1.15 gzz/gfx/rules.mk:1.16
--- gzz/gfx/rules.mk:1.15 Sat Oct 12 10:59:54 2002
+++ gzz/gfx/rules.mk Fri Dec 13 07:16:06 2002
@@ -15,7 +15,7 @@
# Choose architecture
ARCH=-march=pentium4 -mfpmath=sse -msse2
-# OPTIMIZE = -O3 -ffast-math $(ARCH) -fomit-frame-pointer
+# OPTIMIZE = -O3 -ffast-math $(ARCH) -fomit-frame-pointer
-foptimize-sibling-calls
OPTIMIZE = -O0
CPPFLAGS = -I../libglwrapper/ -I../../libglwrapper/ -I/usr/include/freetype2
$(JNIINC) `gdk-pixbuf-config --cflags` -I../ -I.
Index: gzz/gzz/gfx/gl/GL.java
diff -u gzz/gzz/gfx/gl/GL.java:1.30 gzz/gzz/gfx/gl/GL.java:1.31
--- gzz/gzz/gfx/gl/GL.java:1.30 Wed Dec 11 01:24:12 2002
+++ gzz/gzz/gfx/gl/GL.java Fri Dec 13 07:16:06 2002
@@ -497,8 +497,8 @@
/** Load an image into a part of this texture.
*/
- public void loadSubImage(int level, Image img, int xoffs, int yoffs) {
- impl_Texture_loadSubImage(getId(), level, img.getId(), xoffs,
yoffs);
+ public void loadSubImage(int level, Image img, int x, int y, int xoffs,
int yoffs, int w, int h) {
+ impl_Texture_loadSubImage(getId(), level, img.getId(), x, y, xoffs,
yoffs, w, h);
}
/** Copy this texture into the given texture.
@@ -544,7 +544,7 @@
String internalFormat, int w, int h,
int border, String format, String type) ;
static private native void impl_Texture_loadSubImage(int id,
- int level, int imgid, int xoffs, int yoffs) ;
+ int level, int imgid, int x, int y, int xoffs, int yoffs, int w, int h)
;
static private native void impl_Texture_downsampleInto(int id, int intoid,
String target,
int level, String internalFormat, String transferformat);
static private native void impl_Texture_copyTexImage2D(
Index: gzz/gzz/gfx/gl/GLSpans.java
diff -u gzz/gzz/gfx/gl/GLSpans.java:1.9 gzz/gzz/gfx/gl/GLSpans.java:1.10
--- gzz/gzz/gfx/gl/GLSpans.java:1.9 Sat Nov 23 14:03:35 2002
+++ gzz/gzz/gfx/gl/GLSpans.java Fri Dec 13 07:16:06 2002
@@ -20,6 +20,8 @@
*/
public static String colorFormat;
+ public static boolean align4 = false;
+
/** Unfortunately we need to store the textures at two different levels
* since adjusting TEXTURE_BASE_LEVEL does not have enough effect.
*
@@ -33,6 +35,7 @@
if(GL.hasExtension("GL_EXT_texture_compression_s3tc")) {
monochromeFormat = "COMPRESSED_RGB_S3TC_DXT1_EXT";
colorFormat = "COMPRESSED_RGB_S3TC_DXT1_EXT";
+ align4 = true;
} else {
// Otherwise, pick as small formats as possible: these are BIG
images.
monochromeFormat = "LUMINANCE4";
@@ -70,12 +73,18 @@
GL.Image img = GL.createImage(file);
this.w = img.getSize(0);
this.h = img.getSize(1);
+ if(align4) {
+ // Compressed textures have to be 4-aligned
+ this.w /= 4 ; this.h /= 4;
+ this.w *= 4 ; this.h *= 4;
+ }
int overw = 1; while(overw < w) overw *= 2;
int overh = 1; while(overh < h) overh *= 2;
tex = GL.createTexture();
texLR = GL.createTexture();
tex.loadNull2D(0, colorFormat, overw, overh, 0, "RGB", "FLOAT");
- tex.loadSubImage(0, img, 0, 0);
+ if(dbg) pa("Loading image into texture: "+colorFormat+" "+w+" "+h+"
"+overw+" "+overh);
+ tex.loadSubImage(0, img, 0, 0, 0, 0, w, h);
tex.downsampleInto(texLR, "TEXTURE_2D", LODscale, colorFormat,
"RGB");
rect = new Rect();
rect.texId = tex.getTexId();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz gzz/gfx/gl/GL.java gzz/gfx/gl/GLSpans.java ...,
Tuomas J. Lukka <=