zoukankan      html  css  js  c++  java
  • 使用opengl 绘制9个点,理解各个参数的含义

     1 // SimpleTest1.cpp : 定义控制台应用程序的入口点。
     2 //
     3 
     4 #include "stdafx.h"
     5 #include<gl/glut.h>
     6 #include<iostream>
     7 using namespace std;
     8 void DrawTriggle()
     9 {
    10     glPointSize(20);
    11     glColor4f(1.0,0.0,0.0,0.6);
    12     glColor4f(0.5,0.8,0,0.6);
    13     glBegin(GL_POINTS);
    14         glVertex3f(0.0,0.0,0.0);
    15         glVertex3f(0.9,0.0,0.0);
    16         glVertex3f(0.9,0.9,0.0);
    17         glVertex3f(0.0,0.9,0.0);
    18     glEnd();
    19     glColor4f(0.3,0,1,0.6);
    20     glBegin(GL_POINTS);
    21         glVertex3f(-0.9,0.9,0.0);
    22     glEnd();
    23 glColor4f(1,0,0.1,0.6);
    24     glBegin(GL_POINTS);
    25         glVertex3f(-0.9,0.0,0.0);
    26         glVertex3f(-0.9,-0.9,0.0);
    27     glEnd();
    28     glColor4f(1,0,0.5,0.1);
    29     glBegin(GL_POINTS);
    30         glVertex3f(0.9,-0.9,0.0);
    31         glVertex3f(0.0,-0.9,0.0);
    32     glEnd();
    33     glFlush();
    34 }
    35 
    36 void init()
    37 {
    38     glClearColor(1.0,1.0,1.0,0.0);
    39     glutInitWindowPosition(300,300);
    40     glutInitWindowSize(800,800);
    41     glutCreateWindow("simpletest window");
    42     gluLookAt(0.0,0.0,-1.0,0.0,0.0,-0.0,-100,0.0,0.0);
    43     glutDisplayFunc(&DrawTriggle);
    44 }
    45 int _tmain(int argc, _TCHAR* argv[])
    46 {
    47     glutInit(&argc,(char**)argv);
    48     glutInitDisplayMode(GLUT_RGBA  );
    49     init();
    50     std::cout<<"out: enter main loop"<<std::endl;;
    51     glutMainLoop();
    52     return 0;
    53 }
  • 相关阅读:
    2018-div-matrix
    cf663div2
    生成树
    Call to your teacher
    并查集总结
    分组背包
    被3整除的子序列
    多重背包
    12.05
    django生命周期图
  • 原文地址:https://www.cnblogs.com/sdnyzhl/p/4467781.html
Copyright © 2011-2022 走看看