#1
|
|||
|
|||
Visual C++ kullanarak OpenGl ile ekrana Bezier Spline Eğrisi Çizdirme
Visual C++ kullanarak OpenGl ile ekrana Bezier Spline eğrisi çizdirme Bu C++ programı ekrana bezier eğrisi çizer.4 nokta var.2'si kontrol noktası#include <GL/glut.h>
GLfloat ctrlpts[4][3] = { {-0.4, 0.4, 0.0}, {-0.1, 2.0, 0.0}, { 0.1,-2.0, 0.0}, { 0.4, 0.4, 0.0} }; void display() { GLint k; glClear(GL_COLOR_BUFFER_BIT); glColor3f(0.0, 0.0, 1.0); glBegin(GL_LINE_STRIP); for (k= 0; k<= 50; k++) glEvalCoord1f((GLfloat) (k)/50.0); glEnd(); glPointSize(5.0); glColor3f(1.0, 0.0, 0.0); glBegin(GL_POINTS); for (k= 0; k< 4; k++) glVertex3fv(&ctrlpts[k][0]); glEnd(); glutSwapBuffers(); } void init() { glClearColor(1.0,1.0,1.0,0.0); glMap1f(GL_MAP1_VERTEX_3, 0.0, 1.0, 3, 4, *ctrlpts); glEnable(GL_MAP1_VERTEX_3); } int main(int argc, char ** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB); glutInitWindowSize(400,400); glutInitWindowPosition(50, 50); glutCreateWindow("Bezier Eğrisi"); init(); glutDisplayFunc(display); glutMainLoop(); return 0; } ALINTIDIR. |