代码如下,运行时运行不能通过,请帮忙查找下原因,谢谢。
#include <gl/glut.h>
#include <iostream>float control[4][3]={{-4.0,-4.0,0.0},{ -2.0,4.0,0.0},
{ 2.0,-4.0,0.0},{ 4.0,4.0,0.0}
};void Initialize()
{
glClearColor(0.0f,0.0f,0.0f,0.0f);
glShadeModel(GL_FLAT);
}void Render()
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glLoadIdentity(); glTranslatef(-3.0f,0.0f,0.0f);
glEnable(GL_MAP1_VERTEX_3);
glMap1f(GL_MAP1_VERTEX_3,0.0,1.0,3,4,&control[0][0]);
glColor3f(1.0f,1.0f,1.0f); glBegin(GL_LINE_STRIP);
for(int i=0;i<=30;i++)
glEvalCoord1f((float)i/30.0f);
glEnd(); /* glMapGrid1f(100,0.0f,100.0f);
glEvalMesh1(GL_LINE,0,100);*/
glPointSize(3.0); glBegin(GL_POINTS);
for( i=0;i<4;i++)
glVertex3fv(&control[i][0]);
glEnd(); glFlush();
}void myMainWinReshape(int _width, int _height) {
GLfloat fspect;
if(_height==0)
{
_height=1;
}
fspect=(GLfloat)_width/(GLfloat)_height;
// Set the perspective coordinate system
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// field of view of 45 degrees, near and far planes 1.0 and 425
//gluPerspective(70.0f, fspect, 1, 412);
gluPerspective(45.0f, fspect, 1,412);
// Modelview matrix reset
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}int main()
{
glutInitDisplayMode(GLUT_RGB|GLUT_SINGLE);
glutInitWindowPosition(0,0);
glutInitWindowSize(600,600);
glutCreateWindow("二次曲线");
Initialize();
glutDisplayFunc(Render);
glutReshapeFunc(myMainWinReshape);
glutMainLoop();
return 0;
}
#include <gl/glut.h>
#include <iostream>float control[4][3]={{-4.0,-4.0,0.0},{ -2.0,4.0,0.0},
{ 2.0,-4.0,0.0},{ 4.0,4.0,0.0}
};void Initialize()
{
glClearColor(0.0f,0.0f,0.0f,0.0f);
glShadeModel(GL_FLAT);
}void Render()
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glLoadIdentity(); glTranslatef(-3.0f,0.0f,0.0f);
glEnable(GL_MAP1_VERTEX_3);
glMap1f(GL_MAP1_VERTEX_3,0.0,1.0,3,4,&control[0][0]);
glColor3f(1.0f,1.0f,1.0f); glBegin(GL_LINE_STRIP);
for(int i=0;i<=30;i++)
glEvalCoord1f((float)i/30.0f);
glEnd(); /* glMapGrid1f(100,0.0f,100.0f);
glEvalMesh1(GL_LINE,0,100);*/
glPointSize(3.0); glBegin(GL_POINTS);
for( i=0;i<4;i++)
glVertex3fv(&control[i][0]);
glEnd(); glFlush();
}void myMainWinReshape(int _width, int _height) {
GLfloat fspect;
if(_height==0)
{
_height=1;
}
fspect=(GLfloat)_width/(GLfloat)_height;
// Set the perspective coordinate system
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// field of view of 45 degrees, near and far planes 1.0 and 425
//gluPerspective(70.0f, fspect, 1, 412);
gluPerspective(45.0f, fspect, 1,412);
// Modelview matrix reset
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}int main()
{
glutInitDisplayMode(GLUT_RGB|GLUT_SINGLE);
glutInitWindowPosition(0,0);
glutInitWindowSize(600,600);
glutCreateWindow("二次曲线");
Initialize();
glutDisplayFunc(Render);
glutReshapeFunc(myMainWinReshape);
glutMainLoop();
return 0;
}
解决方案 »
- dll中的函数传参数std::string的问题
- 有谁用GDI+作过图形实时显示方面的系统。来讨论一下GDI+和GDI图形处理效率的问题。
- 请问,直接从CWnd派生的类可以做ON_BTN_CLICK的消息映射么?我现在急需这项功能!谢谢!
- TCP可以保证不缺包,能否保证包中数据全部正确啊?
- 请问怎样设置Static(静态文本框)的背景色?
- 这次来个简单点的问题,希望能有收获。关于listCtrl::EnsureVisible
- 很菜很菜的问题!
- 怎么在程序中改变桌面的背景?怎么在程序中改变某一个文件目录的背景?
- 小问题:如何在运行中设置编辑框中的内容
- CToolBar通过代码选中不同的功能键
- 如何利用wmi 获取系统版本信息,操作系统信息, cpu占用,内存,以及电脑硬件信息
- 界面
glut库一般需要自己下载
就是在项目->属性->^^^^
应该把静态连接库的路径写上
或者用#pragma("lib",****)
编译指令把库给连上