PDA

View Full Version : Rendering Color Stored In Texture Coordinates?



PickleWorld
08-03-2011, 07:37 AM
I have 1 channel of color data stored per vertex on a mesh with no parametrization. In my fragment program I simply pass this data in using texture coordinates and then use the data directly instead of doing a texture lookup (which works great).

However, for legacy/performance reasons, our application also has a fixed pipeline implementation and I am wondering if there is anyway to duplicate this behavior without a fragment program?

Is there any way to make OpenGL use a texture coordinate directly as a color (without doing a texture lookup)?

p.s. Note, I do not have parametrization on the mesh so I can not simply create a texture.

Aeluned
08-03-2011, 08:02 AM
If I understand you correctly you want a call to glTexCoord to map to a color?

You can't do that, but you can cheat and send your texture coordinates to OpenGL as a glColor(coordx,coordy,coordz). This will map your texture coordinates to a color per vertex.