资源简介
vc++ opengl 绘制贝塞尔曲面,使用了提供的绘图器 16个点

代码片段和文件信息
// Bez3d.c
// OpenGL SuperBible Chapter 13
// Demonstrates 3D Bezier Surfaces
// Program by Richard S. Wright Jr.
#include
#include
#include
#include
#include
// The number of control points for this curve
GLint nNumPoints = 3;
GLfloat ctrlPoints[3][3][3]= {{{ -4.0f 0.0f 4.0f}
{ -2.0f 4.0f 4.0f}
{ 4.0f 0.0f 4.0f }}
{{ -4.0f 0.0f 0.0f}
{ -2.0f 4.0f 0.0f}
{ 4.0f 0.0f 0.0f }}
{{ -4.0f 0.0f -4.0f}
{ -2.0f 4.0f -4.0f}
{ 4.0f 0.0f -4.0f }}};
// This function is used to superimpose the control points over the curve
void DrawPoints(void)
{
int ij; // Counting variables
// Set point size larger to make more visible
glPointSize(5.0f);
// Loop through all control points for this example
glBegin(GL_POINTS);
for(i = 0; i < nNumPoints; i++)
for(j = 0; j < 3; j++)
glVertex3fv(ctrlPoints[i][j]);
glEnd();
}
// Called to draw scene
void RenderScene(void)
{
// Clear the window with current clearing color
glClear(GL_COLOR_BUFFER_BIT);
// Save the modelview matrix stack
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
// Rotate the mesh around to make it easier to see
glRotatef(45.0f 0.0f 1.0f 0.0f);
glRotatef(60.0f 1.0f 0.0f 0.0f);
// Sets up the Bezier
// This actually only needs to be called once and could go in
// the setup function
glMap2f(GL_MAP2_VERTEX_3 // Type of data generated
0.0f // Lower u range
10.0f // Upper u range
3 // Distance between points in the data
3 // Dimension in u direction (order)
0.0f // Lover v range
10.0f // Upper v range
9 // Distance between points in the data
3 // Dimension in v direction (order)
&ctrlPoints[0][0][0]); // array of control points
// Enable the evaluator
glEnable(GL_MAP2_VERTEX_3);
// Use higher level functions to map to a grid then evaluate the
// entire thing.
// Map a grid of 10 points from 0 to 10
glMapGrid2f(100.0f10.0f100.0f10.0f);
// Evaluate the grid using lines
glEvalMesh2(GL_LINE010010);
// Draw the Control Points
DrawPoints();
// Restore the modelview matrix
glPopMatrix();
// Dispalay the image
glutSwapBuffers();
}
// This function does any needed initialization on the rendering
// context.
void SetupRC()
{
// Clear Window to white
glClearColor(1.0f 1.0f 1.0f 1.0f );
// Draw in Blue
glColor3f(0.0f 0.0f 1.0f); }
void ChangeSize(int w int h)
{
// Prevent a divide by zero
if(h == 0)
h = 1;
// Set Viewport to window dimensions
glViewport(0 0 w h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-10.0f 10.0f -10.0f 10.0f -10.0f 10.0f);
// Modelview matrix reset
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
int
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3272 1999-09-04 09:21 Bez3d\Bez3d.c
文件 4064 1999-09-04 00:44 Bez3d\Bez3d.dsp
文件 533 1999-09-04 00:38 Bez3d\Bez3d.dsw
文件 32768 1999-09-04 09:21 Bez3d\Bez3d.exe
文件 57856 1999-09-04 09:22 Bez3d\Bez3d.opt
文件 1003 1999-09-04 09:21 Bez3d\Bez3d.plg
目录 0 2010-03-05 09:58 Bez3d
----------- --------- ---------- ----- ----
99496 7
相关资源
- VC++ 多线程文件读写操作
- 移木块游戏,可以自编自玩,vc6.0编写
- VC++MFC小游戏实例教程(实例)+MFC类库
- VC++实现CMD命令执行与获得返回信息
- 安卓c语言开发SDL2+opengles
- 交互式计算机图形学 第六版 OpenGL源代
- VC++基于OpenGL模拟的一个3维空间模型
- 基于VC++的SolidWorks二次开发SolidWorks
- 派克变换VC++源码(附文档)
- VC++ 串口
- VC++ 大富翁4_大富翁游戏源码
- VC++ 摄像头视频采集与回放源程序
- 转 VC++ 实现电子邮件(Email)发送
- opengl绘制汽车.cpp
- 基于MFC的VC++仿QQ浏览器源码(雏形)
- VC++ 服务程序编写及安装与卸载
- VC++6.0番茄西红柿VAXvirsual assist X完美破
- 基于改进的fcm算法的图像分割vc++
- VC++6.0 绿色版,免安装,非常好用。
- Microsoft Visual C++ 2005 Redistributable Pack
- VC++MFC课程设计的学生成绩管理系统
- 大智慧365DLL插件设计
- VC++6.0汉化包
- VC++完整商业界面源码(再上传)
- VC++编程技术600个大型项目源码.rar
- VC++实现RSA加密算法
- VC++ 中国象棋经典游戏源代码
- 郁金香VC++游戏辅助视频教程
- C语言进阶源码---基于graphics实现图书
- 摄影测量相对定向VC++程序
评论
共有 条评论