資源簡介
利用opengl實現雙三次Bezier曲面
代碼片段和文件信息
#include???
#include???
#include??
#include???
GLfloat?ctrlPoints[4][4][3]?=
{
{
{?-0.8f?0.8f?0.1f?}
{?-0.9f?0.3f?0.3f?}
{?-0.9f?-0.2f?0.3f?}
{?-0.8f?-0.7f?0.2f?}
}
{
{?-0.3f?0.8f?0.2f?}
{?-0.3f?0.2f?0.5f?}
{?-0.25f?-0.2f?0.6f?}
{?-0.3f?-0.6f?0.2f?}
}
{
{?0.2f?0.85f?0.1f?}
{?0.25f?0.25f?0.6f?}
{?0.3f?-0.2f?0.4f?}
{?0.2f?-0.65f?0.3f?}
}
{
{?0.7f?0.8f?0.1f?}
{?0.8f?0.3f?0.3f?}
{?0.75f?-0.2f?0.3f?}
{?0.7f?-0.7f?0.2f?}
}
};
void?myDisplay(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glClearColor(0.0?0.0?0.0?0.0);
glMap2f(GL_MAP2_VERTEX_3?0?1?3?4
0?1?12?4?&ctrlPoints[0][0][0]);
glEnable(GL_MAP2_VERTEX_3);
int?i?j;
glColor3f(1.0?1.0?1.0);
glRotatef(-65.0?1.0?0.3?0.2);
for?(j?=?0;?j?<=?10;?j++)?{
glBegin(GL_LINE_STRIP);
for?(i?=?0;?i?<=?10;?i++)
glEvalCoord2f((GLfloat)i?/?10.0?(GL
評論
共有 條評論