normals and multitex

Two short questions :
-do I have to implement my own matrix math to rotate normals or is there a way to do it with opengl ?

  • I run a small demo that’s supposed to use multitexturing, it detects it fine but then all I see is white polys. I’m using a riva TNT and haven’t tried to implement multitex yet so I don’t know if it comes from the demo or the card. Rings a bell to anyone ?

Thanks a lot for help (especially on rotating normals…)

Sorry no idea about your multitex-prob.
But concerning the normals I think it depends on what you want to do with them…
If you just want to draw them or use them for OpenGl´s lighting system or something else you can rotate them…BUT if you need the normal´s coordinates after rotation,you´ll have to rotate them yourself
´cause this isn´t really possible with OpenGl(I heard about some function called
"gluUnproject but I think it returns only the x+y coordinate of the vertex if you now it´s z-value.AND getting things back from OpenGl usually stalls the Pipeline…)

But hey what´s the problem?You´ll need a matrix class anyway in nearly every 3d-app!


[This message has been edited by XBCT (edited 07-21-2000).]

What I want to do is for example if I do :

glRotatef(30.0, 0.0, 1.0, 0.0) ;
drawMyObject() ;

I want to rotate the pre computed normals of the object along with it, so I guess I would need a matrix class. Anyone knows a good one (free) ?

If that is all you want to do with the normals, using them only for lighting, then yes, OpenGL will rotate them for you just like that. Just make sure your normals are still unit normals and are not being scaled by a call to glScale and everything will be fine. If your are using a call to glScale then you’ll need to enable normal renormalization. On the otherhand if you want to do special effects or optimizations which require you to know the normal, then you are better off using your own transformations (model view only) in place of OpenGL’s.

You’re multitextureing problem sounds like the textures aren’t being loaded. That will cause the polygons to be white as you discribe them. A simple check is to make sure the textures being loaded are in the proper location. If this is fine then you’ll have to look at the code. For simple multitexturing with the tnt you want to use an extension called ARB_multitexture. It is possible that this code was designed for a different card or system and uses the wrong calls. Look at nvidias development sight for more into on multitexturing or find a different demo.

From the contexts of you’re question on normals it sounds like you don’t need to do you’re own maxtix mults. But if you do need the locations of the normals like XBCT and DFrey said you need to do them on you’re own. This isn’t recomened though unless you really have to cause your method probably won’t end up as efficent as opengl’s. Also to do it at all efficently you will need to know a fair amount about matrixs like why you want to have the transpose of the modelview matrix when you need to do a rotation on the normals.