Show Posts
|
|
Pages: [1]
|
|
3
|
Java Game APIs & Engines / JOGL Development / Re: Matrix math in JOGL
|
on: 2008-01-27 01:11:34
|
Ok, I figured it out myself through trial and error! Still got a lot of tidying up to do though in my code, I've pasted it below in case it helps anyone else. For some reason the shadow map has absolutely killed my framerate. I was getting >300fps with one light source and 350,000 polygons, now with shadows it's dropped to 70fps 1/5th!! Is this normal??? Anyway the code snippet is below... 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| { int j=0,k=0; for(int i = 0; i < 16; i++) { bm.set(j,k,biasMatrix[i]); lpm.set(j,k,lightProjectionMatrix[i]); lvm.set(j,k,lightViewMatrix[i]); j++; if(j>3) j=0; if(j==0) k++; } } tm = bm.mul(lpm.mul(lvm)); { int j=0,k=0; for(int i = 0; i < 16; i++) { textureMatrix[i] = tm.get(k,j); j++; if(j>3) j=0; if(j==0) k++; } } gl.glTexGeni(GL.GL_S, GL.GL_TEXTURE_GEN_MODE, GL.GL_EYE_LINEAR); gl.glTexGenfv(GL.GL_S, GL.GL_EYE_PLANE, textureMatrix, 0); gl.glEnable(GL.GL_TEXTURE_GEN_S); gl.glTexGeni(GL.GL_T, GL.GL_TEXTURE_GEN_MODE, GL.GL_EYE_LINEAR); gl.glTexGenfv(GL.GL_T, GL.GL_EYE_PLANE, textureMatrix, 4); gl.glEnable(GL.GL_TEXTURE_GEN_T); gl.glTexGeni(GL.GL_R, GL.GL_TEXTURE_GEN_MODE, GL.GL_EYE_LINEAR); gl.glTexGenfv(GL.GL_R, GL.GL_EYE_PLANE, textureMatrix, 8); gl.glEnable(GL.GL_TEXTURE_GEN_R); gl.glTexGeni(GL.GL_Q, GL.GL_TEXTURE_GEN_MODE, GL.GL_EYE_LINEAR); gl.glTexGenfv(GL.GL_Q, GL.GL_EYE_PLANE, textureMatrix, 12); gl.glEnable(GL.GL_TEXTURE_GEN_Q); |
|
|
|
|
|
4
|
Java Game APIs & Engines / JOGL Development / Re: Matrix math in JOGL
|
on: 2008-01-27 00:39:14
|
Thanks for the reply. So, how then do I access each row of the matrix used in the code that follows? It's part of a shadow map... textureMatrix being the float[16] that I'm using. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| gl.glTexGeni(GL.GL_S, GL.GL_TEXTURE_GEN_MODE, GL.GL_EYE_LINEAR); gl.glTexGenfv(GL.GL_S, GL.GL_EYE_PLANE, textureMatrix, 0); gl.glEnable(GL.GL_TEXTURE_GEN_S); gl.glTexGeni(GL.GL_T, GL.GL_TEXTURE_GEN_MODE, GL.GL_EYE_LINEAR); gl.glTexGenfv(GL.GL_T, GL.GL_EYE_PLANE, textureMatrix, 4); gl.glEnable(GL.GL_TEXTURE_GEN_T); gl.glTexGeni(GL.GL_R, GL.GL_TEXTURE_GEN_MODE, GL.GL_EYE_LINEAR); gl.glTexGenfv(GL.GL_R, GL.GL_EYE_PLANE, textureMatrix, 8); gl.glEnable(GL.GL_TEXTURE_GEN_R); gl.glTexGeni(GL.GL_Q, GL.GL_TEXTURE_GEN_MODE, GL.GL_EYE_LINEAR); gl.glTexGenfv(GL.GL_Q, GL.GL_EYE_PLANE, textureMatrix, 12); gl.glEnable(GL.GL_TEXTURE_GEN_Q); |
|
|
|
|
|
5
|
Java Game APIs & Engines / JOGL Development / Matrix math in JOGL
|
on: 2008-01-26 19:45:17
|
Hi. I've asked a similar question in a reply to a different thread but I thought I'd simplify... How do I go about doing this: 1
| MATRIX4X4 textureMatrix=biasMatrix*lightProjectionMatrix*lightViewMatrix; |
in JOGL using float[16] instead of MATRIX4x4 as listed in the C example above? Thanks in advance to anyone who can help!
|
|
|
|
|
6
|
Java Game APIs & Engines / JOGL Development / Re: shadow mapping
|
on: 2008-01-26 13:56:48
|
Hi. I know I'm digging up an old thread here. I'm just trying to get this working myself here and I'm having trouble understanding how matrices work in jogl and how they're manipulated. I've used the gleem library to convert my float arrays to Mat4f to multiply them. Can anyone tell me if the following look correct? tm, bm, lvm, lpm are Mat4f of transformMatrix, biasMatrix, lightViewMatrix and lightProjectionMatrix ( all float[16] ) 1 2 3 4 5 6 7 8 9 10 11 12 13
| int j=0,k=0; for(int i = 0; i < 16; i++) { bm.set(j,k,biasMatrix[i]); lpm.set(j,k,lightProjectionMatrix[i]); lvm.set(j,k,lightViewMatrix[i]); j++; if(j>3) j=0; if(j==0) k++; } tm = bm.mul(lpm.mul(lvm)); |
I've done a lot of googling and searching this forum... Basically, if anyone has any code they'd be willing to share to help me understand the matrix operations going on in the above tutorial, I would be very, very grateful!! Thanks in advance...
|
|
|
|
|
7
|
Java Game APIs & Engines / JInput / 3dConnexion Space Navigator on Mac
|
on: 2008-01-22 12:53:52
|
Hi. I'm a student writing a VJ app in Java/JOGL and I'd like to be able to hook up a Space Navigator and do some cool things. I think I have jinput installed correctly and when I run: 1
| java net.java.games.input.test.ControllerTextTest |
I get this: 1 2
| Controller Env = net.java.games.input.DefaultControllerEnvironment@dd5b Loading: net.java.games.input.OSXEnvironmentPlugin |
And it lists all my peripherals including usb mouse and bluetooth keyboard but no Space Navigator. Also not listed when running this: 1 2 3 4 5 6 7 8 9 10 11 12
| java net.java.games.input.test.RumbleTest Loading: net.java.games.input.OSXEnvironmentPlugin Scanning Apple Internal Keyboard / Trackpad Found 0 rumblers Scanning Trackpad Found 0 rumblers Scanning Apple Internal Keyboard / Trackpad Found 0 rumblers Scanning matt’s keyboard Found 0 rumblers Scanning USB-PS/2 Optical Mouse Found 0 rumblers |
Also using net.java.games.input.test.ControllerReadTest, it seems to detect movement from the internal trackpad on my laptop and built in keyboard & bluetooth keyboard, but doesnt detect movement from my usb mouse. Has anyone got this working on a Mac or can shed any light on this? Any help would be much appreciated. Cheers. Matt
|
|
|
|
|