Hi all,
i want to an object through direct volume rendering. here's some code, how i create the 3d volum (256*256*256). My problem is that I only see the slices but no object...
This is a part of the init function
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| int[] textures = new int[1]; gl.glGenTextures(1, textures, 0); this.textureID = textures[0]; gl.glBindTexture(GL.GL_TEXTURE_3D, this.textureID); byte[] newByte = new byte[(int)Math.pow(Jogl3DVDRView.TEXT_SIZE, 3)]; for ( int i = 0; i < Jogl3DVDRView.TEXT_SIZE; i++) { for ( int j = 0; j < Jogl3DVDRView.TEXT_SIZE; j++) { for ( int k = 0; k < Jogl3DVDRView.TEXT_SIZE; k++) { if ( i < Jogl3DVDRView.TEXT_SIZE/2) newByte[k + (j*Jogl3DVDRView.TEXT_SIZE) + (i*Jogl3DVDRView.TEXT_SIZE*Jogl3DVDRView.TEXT_SIZE)] = (byte)110; else newByte[k + (j*Jogl3DVDRView.TEXT_SIZE) + (i*Jogl3DVDRView.TEXT_SIZE*Jogl3DVDRView.TEXT_SIZE)] = (byte)0; } } } ByteBuffer buffer = ByteBuffer.allocate((int)Math.pow(Jogl3DVDRView.TEXT_SIZE, 3)); buffer.put(this.byteValues); buffer.flip(); gl.glTexImage3D(GL.GL_TEXTURE_3D, 0, GL.GL_INTENSITY, Jogl3DVDRView.TEXT_SIZE, Jogl3DVDRView.TEXT_SIZE, Jogl3DVDRView.TEXT_SIZE, 0, GL.GL_LUMINANCE, GL.GL_UNSIGNED_BYTE, buffer); |
and here's a part of my display function:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| ... gl.glBindTexture(GL.GL_TEXTURE_3D, textureID); gl.glMatrixMode(GL.GL_MODELVIEW); gl.glPushMatrix(); gl.glLoadIdentity(); glu.gluLookAt(0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); gl.glColor4d(1.0, 1.0, 1.0, transparency); for ( double[][] slice : this.slices) { for (double[] vertex : slice) { gl.glVertex3dv(vertex, 0); } } ... |
my problem is now that i can see the slices but not the volume...
You can download the source (including project files for eclipse) from here:
http://www.informatik.fh-wiesbaden.de/~fdueh001/Viewer.zipThanks for your help