Advertisement

Simple Color question

Started by January 28, 2003 02:20 PM
4 comments, last by laura_steph1 22 years, 1 month ago
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
laura stephens
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)
MSN: stupidbackup@hotmail.com (not actual e-mail)ICQ: 26469254(my site)
Advertisement
Also you probably want to make sure to have smooth shading enabled

so:

glEnable(GL_SMOOTH);
MSN: stupidbackup@hotmail.com (not actual e-mail)ICQ: 26469254(my site)
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
laura stephens
If you don''t want to waste your time, I can send you some code on how to do beizer patches using OpenGL in-built code or manually (that''s probably what you need). You can also check my website (link below) for some useful code.


" Do we need us? "


Ionware Productions - Games and Game Tools Development

Yes that would be great! I would really appreciate it.

My email address is: laura_steph1@hotmail.com

Thanks,
Laura
laura stephens

This topic is closed to new replies.

Advertisement