初学OpenGL

今天在公司开始了第一天的实习。首先就让学习ray casting算法。

关于ray casting算法的心得我会在学习透彻之后再写一篇文章分析。今天首先做的事情就是配置了OpenGL然后学习了OpenGL配合VS的一些基本使用。

先上代码吧

// openGL_test_d.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include "GL/glut.h"
#include "math.h"
using namespace std;
void  GL_display()
{
const  GLfloat pi = 3.1415926f;
GLfloat a = cos(54 * pi / 180);
GLfloat b = sin(54 * pi / 180);
GLfloat c = cos(18 * pi / 180);
GLfloat d = sin(18 * pi / 180);
GLfloat pointA[2] = {0,1};
GLfloat pointB[2] = { -a, -b };
GLfloat pointC[2] = { c, d };
GLfloat pointD[2] = { -c, d };
GLfloat pointE[2] = { a, -b };
glClear(GL_COLOR_BUFFER_BIT);     //用于清除当前的颜色缓冲
	glBegin(GL_LINE_LOOP);   //设置连线方式位闭曲线
	glVertex2fv(pointA);
	glVertex2fv(pointB);
	glVertex2fv(pointC);
	glVertex2fv(pointD);
	glVertex2fv(pointE);
	glEnd();
	glFlush();           //强制刷新缓冲区,让画图程序进行
}

int main(int argc, char *argv[])
{
	glut
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值