[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] libvob include/vob/vobs/Pixel.hxx include/vob/v...
From: |
Tuomas J. Lukka |
Subject: |
[Gzz-commits] libvob include/vob/vobs/Pixel.hxx include/vob/v... |
Date: |
Sun, 29 Jun 2003 04:13:15 -0400 |
CVSROOT: /cvsroot/libvob
Module name: libvob
Branch:
Changes by: Tuomas J. Lukka <address@hidden> 03/06/29 04:13:15
Modified files:
include/vob/vobs: Pixel.hxx Texture.hxx
vob/demo/multifil: fillet3d.py
Log message:
Take the data through CPU memory, converting depth components to RGBA
which we can unpack for use. Not fun but it works
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/vobs/Pixel.hxx.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/vobs/Texture.hxx.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/demo/multifil/fillet3d.py.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
Patches:
Index: libvob/include/vob/vobs/Pixel.hxx
diff -u libvob/include/vob/vobs/Pixel.hxx:1.2
libvob/include/vob/vobs/Pixel.hxx:1.3
--- libvob/include/vob/vobs/Pixel.hxx:1.2 Tue Mar 11 07:10:31 2003
+++ libvob/include/vob/vobs/Pixel.hxx Sun Jun 29 04:13:15 2003
@@ -70,6 +70,37 @@
};
VOB_DEFINED(DrawPixels);
+struct ReadPixels {
+ enum { NTrans = 1 };
+
+ int w, h;
+ Token format;
+ Token type;
+ GLubyte *bytes;
+
+ template<class F> void params(F &f) {
+ f(w, h, format, type, bytes);
+ }
+
+ template<class T> void render(const T &t) const {
+ glPushAttrib(GL_PIXEL_MODE_BIT);
+ glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
+ glPixelStorei(GL_PACK_ROW_LENGTH, 0);
+ glPixelStorei(GL_PACK_ALIGNMENT, 1);
+ ZPt p = t.transform(ZPt(0,0,0));
+ glRasterPos3f(p.x, p.y, p.z);
+ float ras[4];
+ glGetFloatv(GL_CURRENT_RASTER_POSITION, ras);
+
+ glReadPixels((int)ras[0], (int)ras[1]-h, w, h, format, type, bytes);
+ GLERR
+ glPopClientAttrib();
+ glPopAttrib();
+ }
+};
+VOB_DEFINED(ReadPixels);
+
+
}
}
Index: libvob/include/vob/vobs/Texture.hxx
diff -u libvob/include/vob/vobs/Texture.hxx:1.3
libvob/include/vob/vobs/Texture.hxx:1.4
--- libvob/include/vob/vobs/Texture.hxx:1.3 Sat Jun 28 10:35:39 2003
+++ libvob/include/vob/vobs/Texture.hxx Sun Jun 29 04:13:15 2003
@@ -77,6 +77,37 @@
};
VOB_DEFINED(CopyTexSubImage2D);
+/** Call CopyTexSubImage from a ByteVector.
+ */
+struct TexSubImage2D {
+ enum { NTrans = 0 };
+ Token target;
+ int level;
+ int x, y, w, h;
+ Token format;
+ Token type;
+ GLubyte *pixels;
+
+ template<class F> void params(F &f) {
+ f(target, level, x, y, w, h, format, type, pixels);
+ }
+ void render() const {
+ GLERR
+ glPushAttrib(GL_PIXEL_MODE_BIT);
+ glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+
+ glTexSubImage2D(target, level, x, y, w, h, format, type, pixels);
+
+ glPopClientAttrib();
+ glPopAttrib();
+ GLERR
+ }
+
+};
+VOB_DEFINED(TexSubImage2D);
+
}
}
Index: libvob/vob/demo/multifil/fillet3d.py
diff -u libvob/vob/demo/multifil/fillet3d.py:1.10
libvob/vob/demo/multifil/fillet3d.py:1.11
--- libvob/vob/demo/multifil/fillet3d.py:1.10 Sat Jun 28 10:35:39 2003
+++ libvob/vob/demo/multifil/fillet3d.py Sun Jun 29 04:13:15 2003
@@ -35,11 +35,18 @@
"3D filleting"
def __init__(self):
self.depthTexture = GL.createTexture()
+ self.direct = 0
rect = 1
targ = "TEXTURE_RECTANGLE_NV"
- self.depthTexture.loadNull2D("TEXTURE_RECTANGLE_NV", 0,
"DEPTH_COMPONENT24",
- 1024, 768, 0, "DEPTH_COMPONENT",
- "INT")
+ self.buffer = GL.createByteVector(1024 * 768 * 4)
+ if self.direct:
+ self.depthTexture.loadNull2D("TEXTURE_RECTANGLE_NV", 0,
"DEPTH_COMPONENT24",
+ 1024, 768, 0, "DEPTH_COMPONENT",
+ "INT")
+ else:
+ self.depthTexture.loadNull2D("TEXTURE_RECTANGLE_NV", 0, "RGBA8",
+ 1024, 768, 0, "BGRA",
+ "UNSIGNED_INT_8_8_8_8")
if not rect:
self.depthTexture.setTexParameter(targ,
"TEXTURE_MAX_LEVEL", 0)
@@ -131,11 +138,19 @@
Enable TEXTURE_RECTANGLE_NV
""" % self.depthTexture.getTexId()))
+ if self.direct:
# Now, draw the edges
- vs.put(GLRen.createCopyTexSubImage2D("TEXTURE_RECTANGLE_NV",
- 0, 0, 0, 1024, 768), 0)
+ vs.put(GLRen.createCopyTexSubImage2D("TEXTURE_RECTANGLE_NV",
+ 0, 0, 0, 1024, 768), 0)
+ else:
+
+ vs.put(GLRen.createReadPixels(1024, 768, "DEPTH_COMPONENT",
+ "UNSIGNED_INT", self.buffer), 0)
+ vs.put(GLRen.createTexSubImage2D(
+ "TEXTURE_RECTANGLE_NV", 0, 0, 0, 1024, 768,
+ "BGRA", "UNSIGNED_INT_8_8_8_8", self.buffer))
vs.put(getDListNocoords("""
Color 1 1 1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] libvob include/vob/vobs/Pixel.hxx include/vob/v...,
Tuomas J. Lukka <=