🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
Waving Bezier Face
Hi together,
just for fun I modified lesson 5 to implement a waving bezier face. Allthough it's not a real great thing, but I don't want to withhold it.
For anyone, who want to try it out:
- declare two global variables
GLfloat bparm=1.0f; // Parameter For The Bezier Curve
short incdec=1; // Swap Increment/Decrement
- take this DrawGLScene code
int DrawGLScene(GLvoid) // Here's Where We Do All The Drawing
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
GLfloat pointMatrix[]= {0.0f,0.0f,0.0f,
0.0f,2.0f,0.0f,
0.0f,4.0f,0.0f,
0.0f,6.0f,0.0f,
1.0f,0.0f,0.0f,
1.0f,2.0f,0.0f,
1.0f,4.0f,-1*bparm,
1.0f,6.0f,0.0f,
2.0f,0.0f,0.0f,
2.0f,2.0f,0.0f,
2.0f,4.0f,bparm,
2.0f,6.0f,0.0f,
3.0f,0.0f,0.0f,
3.0f,2.0f,0.0f,
3.0f,4.0f,0.0f,
3.0f,6.0f,0.0f};
glEnable(GL_MAP2_VERTEX_3);
glMap2f(GL_MAP2_VERTEX_3,0,1,12,4,0,1,3,4,pointMatrix);
glMapGrid2f(20,0,1,20,0,1);
glPushMatrix();
glTranslatef(-2.5f,-2.5f,-10.0f);
glRotatef(45,0.5f,0.5f,0.0f);
glEvalMesh2(GL_LINE,0,20,0,20);
glPopMatrix();
if(bparm>40.0f){
incdec=-1;
}else if(bparm<-40.0f){
incdec=1;
}
bparm+=(incdec*0.2f);
return TRUE; }
Have fun...
RAPsody
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement