資源簡介
工程環(huán)境:VS2010 C++源碼
使用OpenGL實(shí)現(xiàn)B樣條曲線的繪制,拖動(dòng)節(jié)點(diǎn)實(shí)現(xiàn)樣條的調(diào)節(jié)以及曲線平滑的實(shí)現(xiàn);
右擊添加節(jié)點(diǎn),左鍵拖動(dòng)調(diào)節(jié)
代碼片段和文件信息
#include???
#include???
#include???
#include???
#include???
#include?
#include?
using?namespace?std;
vectorx_coord;
vectory_coord;
bool?flag?=0;?????????//?wbp?控制是否閉合
int?nPoints?=?0;?????//?wbp控制點(diǎn)數(shù)
int?j=0;??
int?pointChoose?=0;
void?init(){??
glClearColor(1110);??
glOrtho(0700.0?700?0?-5.05.0);??
}??
void?myReshape(int?wint?h)??
{??
glViewport(00(GLsizei)w(GLsizei)h);??
glMatrixMode(GL_PROJECTION);??
glLoadIdentity();??
//gluPerspective(45.0(GLfloat)w/(GLfloat)h1.050.0);??
//if(w<=h)??
// //glOrtho(-5.05.0-5.0*(GLfloat)h/(GLfloat)w5.0*(GLfloat)h/(GLfloat)w-5.05.0);??
// glOrtho(0500.0500.0*(GLfloat)h/(GLfloat)w0*(GLfloat)h/(GLfloat)w-5.05.0
評論
共有 條評論