View Full Version : texture coordinates generation
04-01-2008, 04:36 AM
I need to have texture coordination generated for each vertex of given object, so that vector of texture coordinates is equal to the vector of vertex coordinates themselves, only normalized (ie. texture coordinates are calculated through projecting vertex to sphere with unit radius). Any suggestion on how best to accomplish this: is any of glTexGen() variations usable here, or the only alternative is to calculate texture coordinates manually, from corresponding vertex coordinates?
04-01-2008, 07:15 AM
glTexGen won't help with this. You must either use vertex shader or precompute texture coordinates at application startup.
04-01-2008, 08:56 AM
You can use texgen in an object linear setup with
s_plane -> 1 0 0 0
t_plane -> 0 1 0 0
r_plane -> 0 0 1 0
q_plane -> 0 0 0 1
and then use these coordinates to sample a cube texture. This way the normalization is implied in the texture lookup.
Otherwise I would suggest using shaders, which makes it a whole lot easier.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.