Why do I keep seing the same thing in the model? I believe I have to do something to the texture matrix, right? what? and where in the code should I do that? Do I have to draw the model with normals or what?
OpenGL’s texture matrix is also very useful for manipulating cube map texture coordinates. The texture matrix can be used to rotate an (s,t,r) vector from one space to another. For example, if your cube map texture is oriented in world coordinate space, and M is the matrix transform that moves from world coordinates to eye coordinates, you can load the inverse of the affine portion of M into the texture matrix to rotate the eye-space reflection or normal vectors generated by GL_REFLECTION_MAP_EXT or GL_NORMAL_MAP_EXT back into world space.
I believe, you need to use the texture matrix to take account of the changing eye position. For simple demo’s whereby the eye and object do note move, this is not necessary.
I haven’t actually tried moving round an object to see if cube map appears correct or not… (hmmm future example code there me thinks)
Hope this helps.
What exactly do you mean by the image not chnaging? Does it look right if you rotate the object?
Seems like I’m having a conversation with myself here. oh well…
I’ve found that it doesn’t crash if I replace the display list call with a function that has the EXACT same code as was used to build the display list, but renders it in immediate mode.
WTF is up with that?? Why the hell would a display list care about me rotating the texture matrix in the Y? Very odd…
I can only think it’s a driver bug.
P.S. How can I speedup glCopyTexSubImage2D? Will it go faster if I use bgr8 format for the cubemap instead of rgb8?
No, I’m not doing that… if it was a problem with the display list it wouldn’t work at all. But it does. I can rotate the texture matrix in the X and it works. Only crashes when I rotate texture matrix in the Y.
Though it all works perfectly without display lists.
I’m not doing the rotate in display lists either. Just normal and vertex functions only.
Here is some code that does it for you, even if you don’t use C it is easy to adapt.
Basically, it takes the MODELVIEW MATRIX finds the inverse and applies it to the TEXTURE MATRIX, so the the texture matrix is always aligned with major axes, no matter where you are looking.
I adjusted the code so you need just two calls, one to align the cube map, then render the objects and one to clear up afterwards.
The only other thing I had to do was replace the cofactor function, to get detM.
Yes I tried swapping back to the modelview matrix prior to glCallList. No joy.
The cubes are just sphere mapped at the mo…
Thinking of changing them to statically mapped transparent cubes… might make it more interesting… reflecting trasparent objects that is… might see the picies of Jordan better too!
There’ll be a new version up soon. I have to do it all at work though, cos I aint got my geforce 3 yet, and I only have a crappy intel 740 adapter at home!
Nutty
P.S. Matt, Cass, any idea why modifying the texture matrix can cause a glCallList to crash in the driver? I can reproduce it everytime if you’re interested.??
[This message has been edited by Nutty (edited 04-06-2001).]
Hmm… In my cubic environment mapping demo I mess with the texture matrix and I call glCallList (for some of the shapes in the demo) and it doesn’t crash on me.
Try and run it on your computer and let me know if it works when you have the supertoroid and superellipsoid shapes selected (mousewheel changes current one).
Man, a i740…thats oooold, better hope your GeForce3 gets there soon
This I740 thing is right poor, it wont even do sphere mapping properly. One of my demos that does 2 passes, 2nd with a sphere map, just has a static 2nd pass on this adapter. Very odd!!
Had no OpenGL support under 2K too, so I had to revert back to 98… bah