PDA

View Full Version : My textures are hip cause they wrap



the_sausager
03-18-2001, 11:14 PM
heya all,

A quick question about the opengl texture wrap function, the texcoords are calculated based on the eye, is there a way i can get those coords then rotate the object??

Oh yes, and also, off topic, regaurding multitexturing, im trying to querry how many texelsunits i have with glGetIntegerv( GL_MAX_TEXTURE_UNITS_ARB, &maxTexelUnits ); and i am receiving a compiler error that GL_MAX_TEXTURE_UNITS_ARB does not exist. Am i missing the header file where this is defined? Where is this defined? and i have a gf2 so i do have multitexels.

you help is much apperciated,
the_sausager

zed
03-18-2001, 11:46 PM
not to sure what u mean for the first one but for the second have a search for "glext.h" its on this site and at nvidia developer one as well

Deiussum
03-19-2001, 09:48 AM
For the first one do you mean that you are using glTexGen to generate coordinates and you want to get the values?

If that's what you mean, I don't think there is a good way to do that directly, but if you want the formula that OpenGL uses to specify that you can find it in the OpenGL 1.2.1 specification. Actually, you might be able to use feedback mode to get the coordinates, but that's not something I think I'd recommend doing. http://www.opengl.org/discussion_boards/ubb/smile.gif

the_sausager
03-19-2001, 10:13 AM
As for the glTexGen, to be more specific, i have a phong texture and i use glTexGen to do some neat spec lighting and i had the thought that if i could use TexGen to map the phong texture based on the light instead of the eye, i could do lighting that way and avoid gouraud lighting altogether. So what i would have to do is rotate the object in relation to the light, map the texture, then rotate the object in relation to the eye. Isnt that pretty much what phong lighting is? i have the equations to find the sphere coords myself but id much rather have opengl do it for me.

btw, thanks for the help with the header file, i now have that working and your help is much appreciated

thanks again,
the_sausager

Deiussum
03-19-2001, 12:42 PM
Take a look at the formula that is used for calculating the coordinates when using GL_EYE_LINEAR. You can modify the formula slightly by giving OpenGL a different set of values using something like so..

// 4 values... I just added 1.0's to show that there are 4. http://www.opengl.org/discussion_boards/ubb/smile.gif
// These can be used in the formula for texture generation
float pFloats[] = {1.0, 1.0, 1.0, 1.0};

glTexGen(GL_S /*GL_T, ETC.*/, GL_EYE_PLANE, pFloats);

I'm not sure if you can do what you want with this, but it could be possible.