opengl 画点和线的问题
额本人刚学opengl~~用的是visualC++任务是用array储存点坐标画点或者线~~可是~~编译以后报错说glVertex2i不接受1个parameter~哪位高...
额 本人刚学 opengl ~~
用的是visual C++
任务是
用array 储存点坐标 画点 或者线~~
可是~~ 编译以后 报错说
glVertex2i 不接受1个parameter~
哪位高手可以 指正一下 谢谢~
#include <GL/glut.h>
void init (void)
{
glClearColor(1.0 , 1.0 , 1.0 , 0.0);
//glColor3f(1.0 , 0.0 , 0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0, 200, 0.0 ,150.0);
glPointSize(4.0);
}
void lineSegment(void )
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0 , 0.0 , 0.0); //RGB
glBegin(GL_LINES);
{
glVertex2i( 35, 145 );
glVertex2i( 144, 20);
}
glEnd();
glBegin(GL_POINTS);
{
GLint point1[] = {100 , 120};
GLint point2[] = {100 , 140};
glVertex2i(point1);
glVertex2i(point2);
glVertex2i(150,130);
}
glEnd();
glFlush();
}
void main(int argc , char**argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowPosition(50,100);
glutInitWindowSize(400,300);
glutCreateWindow("learning programming is fun");
init();
glutDisplayFunc(lineSegment);
glutMainLoop();
} 展开
用的是visual C++
任务是
用array 储存点坐标 画点 或者线~~
可是~~ 编译以后 报错说
glVertex2i 不接受1个parameter~
哪位高手可以 指正一下 谢谢~
#include <GL/glut.h>
void init (void)
{
glClearColor(1.0 , 1.0 , 1.0 , 0.0);
//glColor3f(1.0 , 0.0 , 0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0, 200, 0.0 ,150.0);
glPointSize(4.0);
}
void lineSegment(void )
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0 , 0.0 , 0.0); //RGB
glBegin(GL_LINES);
{
glVertex2i( 35, 145 );
glVertex2i( 144, 20);
}
glEnd();
glBegin(GL_POINTS);
{
GLint point1[] = {100 , 120};
GLint point2[] = {100 , 140};
glVertex2i(point1);
glVertex2i(point2);
glVertex2i(150,130);
}
glEnd();
glFlush();
}
void main(int argc , char**argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowPosition(50,100);
glutInitWindowSize(400,300);
glutCreateWindow("learning programming is fun");
init();
glutDisplayFunc(lineSegment);
glutMainLoop();
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询