91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 3KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-05
  • 語言: 其他
  • 標簽: OpenGL??透視投影??

資源簡介

本程序提供給OpenGL初學者使用, 該程序中描述了如何實現透視投影。代碼中如有疑問請指出,會為你一一解答。

資源截圖

代碼片段和文件信息

#include?
#include?
#include?
#include?
#include?

#ifdef?__APPLE__
#include???????????//?OS?X?version?of?GLUT
#else
#define?FREEGLUT_STATIC
#include?????????????//?Windows?FreeGlut?equivalent
#endif

#include?
using?namespace?std;

const?float?PI?=?3.14159265358979323846;

/************************************************************************************/
void?ChangeSize(int?w?int?h)
{
????glViewport(0?0?w?h);
}

/************************************************************************************/
#include?
#include?
#define?MAX_SHADER_LENGTH?8192
#define?MAX_TARGET_NUM??10

GLchar?shaderText[MAX_SHADER_LENGTH];

void?gltLoadShaderSrc(const?char?*szShaderSrc?GLuint?shader)
{
????GLchar?*fsStringPtr[1];

????fsStringPtr[0]?=?(GLchar?*)szShaderSrc;
????glShaderSource(shader?1?(const?GLchar?**)fsStringPtr?NULL);
}

bool?gltLoadShaderFile(const?char?*szFile?GLuint?shader)
{
????GLint?shaderLength?=?0;
????FILE?*fp;

????//?Open?the?shader?file
????fp?=?fopen(szFile?“r“);
????if(fp?!=?NULL)
????{
????????//?See?how?long?the?file?is
????????while?(fgetc(fp)?!=?EOF)
????????????shaderLength++;

????????//?Allocate?a?block?of?memory?to?send?in?the?shader
????????assert(shaderLength?????????if(shaderLength?>?MAX_SHADER_LENGTH)
????????{
????????????fclose(fp);
????????????return?false;
????????}

????????//?Go?back?to?beginning?of?file
????????rewind(fp);

????????//?Read?the?whole?file?in
????????if?(shaderText?!=?NULL)
????????????fread(shaderText?1?shaderLength?fp);

????????//?Make?sure?it?is?null?terminated?and?close?the?file
????????shaderText[shaderLength]?=?‘\0‘;
????????fclose(fp);
????}
????else
????????return?false;

????//?Load?the?string
????gltLoadShaderSrc((const?char?*)shaderText?shader);

????return?true;
}

GLuint?vao;
GLuint?vertex_bufferindex_buffer;
GLuint?vert_shader?frag_shader;
GLuint?program;


GLfloat?vVerts[12]?=?{?-500.0f?-500.0f?-800.0f
????????????????????????????????????????500.0f?-500.0f?-800.0f
????????????????????????????????????????????0.0f???500.0f?-800.0f
????????????????????????????????????????????0.0f???????0.0f?-300.0f?};

GLuint?element_index[]?=?{??0?1?2
???????????????????????????????????????????????0?1?3
???????????????????????????????????????????????0?3?2
???????????????????????????????????????????????1?2?3??};

GLfloat?modelMatrix[16]?=?{1.0?0.0?0.0?0.0
????????????????????????????????????????????????0.0?1.0?0.0?0.0
????????????????????????????????????????????????0.0?0.0?1.0?0.0
????????????????????????????????????????????????0.0?0.0?0.0?1.0};

GLfloat?viewMatrix[16]?=??{1.0?0.0?0.0?0.0
???????????????????????????????????????????????0.0?1.0?0.0?0.0
???????????????????????????????????????????????0.0?0.0?1.0?0.0
???????????????????????????????????????????????0.0?0.0?0.0?1.0};

GLfloat?projectionMat

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-04-14?13:16??SetPerspective\
?????文件?????????202??2016-09-23?10:56??SetPerspective\Identity.fp
?????文件?????????310??2016-09-23?14:11??SetPerspective\Identity.vp
?????文件????????6878??2016-10-10?13:13??SetPerspective\main.cpp
?????文件?????????322??2016-10-09?15:52??SetPerspective\Triangle.pro

評論

共有 條評論