Circle dyed like color
How do you make circle with filled dyed RGB like the one in Nehe''s tutorial #4? (The one with triangle)
Waldoo
That''s much different because the triangle only has three points. You will need to make a gradient texture yourself (I think) and then map it to a quadratic sphere or quadratic disc object. You can find info on quadratics in NeHe''s tutorial 24
-E
-E
Quadrics are evil. Use your brain.
Peace,
ZE.
//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links
[if you have a link proposal, email me.]
const double DTR = 3.141593 / 180; const int inc = 5; float red = 0.0f, green = 0.0f, blue = 0.0f; int reda = 1, greena = 1, bluea = 1; glTranslatef(0.0f, 0.0f, -5.0f); glBegin(GL_TRIANGLE_FAN); glColor3f(0.0f, 0.0f, 0.0f); glVertex3f(0.0f, 0.0f, 0.0f); for(int i = 0; i <= 360; i+= inc) { glColor3f(reda*red, greena*green, bluea*blue); red += (inc/(float)360)*3; if(red > 1.0f) reda = 0; if(reda == 0) green += (inc/(float)360)*3; if(green > 1.0f) greena = 0; if(reda == 0 && greena == 0) blue += (inc/(float)360)*3; glVertex3f(cos(i*DTR), sin(i*DTR), 0); } glEnd();
Peace,
ZE.
//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links
[if you have a link proposal, email me.]
[twitter]warrenm[/twitter]
Well, I''ve exceeded my transfer quota from geocities AGAIN, but if you happen by at a later date, you can view a screenshot of the effect here:

Later,
ZE.
Later,
ZE.
[twitter]warrenm[/twitter]
Thanks for the code! I learned alot from it. I am working on it to generate RGB count from 0/255 to 0/16.7 million colors to make a color wheel. I have been working on it for hours as I am newbie to C++.
C++ and VB has little different way of writing formulas. I wrote a formula below in C++ but it did not work. I hope you will help me out.
glBegin(GL_TRIANGLE_FAN);
glColor3f(0.0f, 0.0f, 0.0f);
glVertex3f(0.0f, 0.0f, 0.0f);
for(int i = 0; i < 360; i+= inc)
{
for(int red=0; red<256; ++red) {
for(int green=0; green<256; ++green) {
for(int blue=0; blue<256; ++blue) {
glColor3f((red/255), (green/255), (blue/255));
}
}
}
glVertex3f(cos(i*DTR), sin(i*DTR), 0);
}
glEnd();
Waldoo
[edited by - waldoo on March 30, 2002 5:30:08 AM]
C++ and VB has little different way of writing formulas. I wrote a formula below in C++ but it did not work. I hope you will help me out.
glBegin(GL_TRIANGLE_FAN);
glColor3f(0.0f, 0.0f, 0.0f);
glVertex3f(0.0f, 0.0f, 0.0f);
for(int i = 0; i < 360; i+= inc)
{
for(int red=0; red<256; ++red) {
for(int green=0; green<256; ++green) {
for(int blue=0; blue<256; ++blue) {
glColor3f((red/255), (green/255), (blue/255));
}
}
}
glVertex3f(cos(i*DTR), sin(i*DTR), 0);
}
glEnd();
Waldoo
[edited by - waldoo on March 30, 2002 5:30:08 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement