这段OPENGL程序运行之后为什么没有点,窗口都是白的?
#include"windows.h"#include"stdio.h"#include"GL/gl.h"#include"GL/glu.h"#include"GL/gl...
#include "windows.h"
#include "stdio.h"
#include "GL/gl.h"
#include "GL/glu.h"
#include "GL/glut.h"
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0,1.0,1.0);
glBegin(GL_POLYGON);
glVertex2f(0.0,0.0);
glVertex2f(0.0,3.0);
glVertex2f(4.0,3.0);
glVertex2f(6.0,1.5);
glVertex2f(4.0,0.0);
glEnd();
glFlush();
}
void init(void)
{
glClearColor(0.0,0.0,0.0,0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0,1.0,0.0,1.0,-1.0,1.0);
}
int main(int argc,char** argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(250,250);
glutInitWindowPosition(100,100);
glutCreateWindow("points");
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;
} 展开
#include "stdio.h"
#include "GL/gl.h"
#include "GL/glu.h"
#include "GL/glut.h"
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0,1.0,1.0);
glBegin(GL_POLYGON);
glVertex2f(0.0,0.0);
glVertex2f(0.0,3.0);
glVertex2f(4.0,3.0);
glVertex2f(6.0,1.5);
glVertex2f(4.0,0.0);
glEnd();
glFlush();
}
void init(void)
{
glClearColor(0.0,0.0,0.0,0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0,1.0,0.0,1.0,-1.0,1.0);
}
int main(int argc,char** argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(250,250);
glutInitWindowPosition(100,100);
glutCreateWindow("points");
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询