Jump to content
  • Advertisement


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


Simple Color question

This topic is 5646 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.


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!