Archived

This topic is now archived and is closed to further replies.

Simple Color question

This topic is 5429 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I was wondering how do I designate certain colors on certain parts of a nurb surface or bezier patch. I have seen examples on height mapping where higher elevations are green and other elevations are yellow, etc... How do you specify the area to change colors. I am not using height mapping, I just want to use different colors in different areas of my nurb patch or bezier patch. Is it possible to do this on a nurb surface? Thanks, Laura laura stephens

Share this post


Link to post
Share on other sites
On a nurb surface I don''t think you could do that, since OpenGL would handle drawing all the vertices

But if you draw a bezier patch yourself you can just check the height of the vertex you''re drawing and color it according to that

So if you want ''min'' to represent the level at which all vertices are draw black, and ''max'' to represent the point at which all vertices are draw white, then the color would be:

float brightness = (vertex_y - min) / (max-min);
glColor3f(brightness, brightness, brightness);

I think if you''re over 1 opengl will consider it 1... same with zero

hope this helps



"If you gaze long into an abyss, the abyss will gaze back into you."
- Friedrich Nietzsche (1844-1900)

(my site)

Share this post


Link to post
Share on other sites
Oh, that helps alot. I was trying to figure out how to do it on a nurb surface but now I won''t waste my time. Now I have to figure out how to do a bezier patch in the shape of a body of water that I am trying to model.

Thanks,
Laura

Share this post


Link to post
Share on other sites