CUBIC ENV MAPPING

I have been playing around with cubic env mapping, how do I get env mapping to reflect based on the objects location in relation to the camera, so that the reflection on a sphere changes with the camera?

before rendering the sphere grab the modelviewmatrix, grab its rotation and invert it, load this into the texturematrix of your cubemapstage

grab its rotation:

just kill the 4th line / row… means this:

a b c 0
d e f 0
g h i 0
0 0 0 1

then inverting is simple cause its just rotation: you have to transpose it simply…

a d g 0
b e h 0
c f i 0
0 0 0 1

then load this into the texturematrix… like that the cube rotates in the inverted way you do… that means ( cause cubemap is viewindependand, so you dont rotate… ) it works like the camera system… instead of moving the cam you move the scene in the opposite…

Cool thanks, i’ll give that a go!

Is there a way with GL to copy the current matrix into a local matrix?

as long as i am online, you can grab a demo here… ( i have a 56k modem, so slow uploading… but its not soo big… )
http://194.230.199.41/Demonstration.zip

hope you are fast enough… its just this code i wrote above… nothing else…

btw, its my harddrive you will grab it when you do it… so be fast, i have to reboot in bout 20minutes, and then i will loose this ip…

[This message has been edited by davepermen (edited 04-12-2001).]

float matrix[ 16 ];
glGetFloatv( GL_MODELVIEW (_MATRIX… i dont remember ), matrix );

do you have MSDN library? if you have, just browse it, it has every opengl function described… ( very usefull, have to upload it sometimes onto my official page )

Resolved dynamic IP address [194.230.199.41]
Resolved dynamic IP address [194.230.199.41]
62.226.6.100 localhost - [12/Apr/2001:21:33:28 +0200] “GET /Demonstration.zip HTTP/1.1” 206 17631 “http://194.230.199.41” “FlashGet”
Resolved dynamic IP address [194.230.199.41]
Resolved dynamic IP address [194.230.199.41]

hm… whas that you mwanderson? what the hell is “FlashGet”…

A nice FTP programm, you can get it at www.amazesoft.com.

(But i didn’t download, just wan’ted to give an answer)

Lars

Nope I just downloaded it a second ago