使用opengl 绘制9个点,理解各个参数的含义

时间:2022-11-16 15:38:30
 // SimpleTest1.cpp : 定义控制台应用程序的入口点。
// #include "stdafx.h"
#include<gl/glut.h>
#include<iostream>
using namespace std;
void DrawTriggle()
{
glPointSize();
glColor4f(1.0,0.0,0.0,0.6);
glColor4f(0.5,0.8,,0.6);
glBegin(GL_POINTS);
glVertex3f(0.0,0.0,0.0);
glVertex3f(0.9,0.0,0.0);
glVertex3f(0.9,0.9,0.0);
glVertex3f(0.0,0.9,0.0);
glEnd();
glColor4f(0.3,,,0.6);
glBegin(GL_POINTS);
glVertex3f(-0.9,0.9,0.0);
glEnd();
glColor4f(,,0.1,0.6);
glBegin(GL_POINTS);
glVertex3f(-0.9,0.0,0.0);
glVertex3f(-0.9,-0.9,0.0);
glEnd();
glColor4f(,,0.5,0.1);
glBegin(GL_POINTS);
glVertex3f(0.9,-0.9,0.0);
glVertex3f(0.0,-0.9,0.0);
glEnd();
glFlush();
} void init()
{
glClearColor(1.0,1.0,1.0,0.0);
glutInitWindowPosition(,);
glutInitWindowSize(,);
glutCreateWindow("simpletest window");
gluLookAt(0.0,0.0,-1.0,0.0,0.0,-0.0,-,0.0,0.0);
glutDisplayFunc(&DrawTriggle);
}
int _tmain(int argc, _TCHAR* argv[])
{
glutInit(&argc,(char**)argv);
glutInitDisplayMode(GLUT_RGBA );
init();
std::cout<<"out: enter main loop"<<std::endl;;
glutMainLoop();
return ;
}