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

  • 大小: 6.26MB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2023-10-01
  • 語言: 其他
  • 標簽: OpenGL??Texturing??

資源簡介

OpenGLTexture

資源截圖

代碼片段和文件信息

#include?“cgl.h“

CGL::CGL()
{
????//ctor

}

CGL::CGL(int?_width?int?_height)
{
????this->width?=?_width;
????this->height?=?_height;

???//?model?=?mat4(0.5f);

????prog?=?ShaderProgram();

}

CGL::~CGL()
{
????//dtor
}

bool?CGL::initGL()
{
????/*?Enable?smooth?shading?*/
????glShadeModel(?GL_SMOOTH?);
????/*?Set?the?background?black?*/
????glClearColor(?0.0f?0.0f?0.0f?0.0f?);
????/*?Depth?buffer?setup?*/
????glClearDepth(?1.0f?);
????/*?Enables?Depth?Testing?*/
????glEnable(?GL_DEPTH_TEST?);
????/*?The?Type?Of?Depth?Test?To?Do?*/
????glDepthFunc(?GL_LEQUAL?);
????/*?Really?Nice?Perspective?Calculations?*/
????glHint(?GL_PERSPECTIVE_CORRECTION_HINT?GL_NICEST?);

????model?=?mat4(1.0f);
????view?=?glm::lookAt(vec3(-2.0f5.0f1.0f)?vec3(0.0f1.0f0.0f)?vec3(0.0f1.0f0.0f));
????bunny?=?Objobject(“assets/model/cubic.obj“);
????return(?true?);
}



bool?CGL::resizeGL(int?widthint?height)
{
????if?(?height?==?0?)
????{
????????height?=?1;
????}
????//Reset?View
????glViewport(?0?0?(GLint)width?(GLint)height?);
????//Choose?the?Matrix?mode
????glMatrixMode(?GL_PROJECTION?);
????//reset?projection
????glLoadIdentity();
????//set?perspection
????gluPerspective(?45.0?(GLfloat)width/(GLfloat)height?0.1?100.0?);
????//choose?Matrix?mode
????glMatrixMode(?GL_MODELVIEW?);
????glEnable(GL_DEPTH_TEST);
????glEnable(GL_TEXTURE_2D);
????glLoadIdentity();
}

bool?CGL::renderGL()
{
????/*?These?are?to?calculate?our?fps?*/
????static?GLint?T0?????=?0;
static?GLint?frames?=?0;
????//?Clear?the?color?and?depth?buffers.
????glClear(?GL_COLOR_BUFFER_BIT?|?GL_DEPTH_BUFFER_BIT?);
????//?We?don‘t?want?to?modify?the?projection?matrix.?*/

????glMatrixMode(?GL_MODELVIEW?);

????glDrawArrays(GL_TRIANGLES?0?bunny.vertices.size()?);

??? SDL_GL_SwapBuffers(?);


????//this->changeMatrics();
????/*?Gather?our?frames?per?second?*/
????frames++;
????{
GLint?t?=?SDL_GetTicks();
if?(t?-?T0?>=?5000)?{
????GLfloat?seconds?=?(t?-?T0)?/?1000.0;
????GLfloat?fps?=?frames?/?seconds;
????printf(“%d?frames?in?%g?seconds?=?%g?FPS\n“?frames?seconds?fps);
????T0?=?t;
????frames?=?0;
????????}
????}
}



void?CGL::compileShader()
{


glGenVertexArrays(1?&VertexArrayID);
glBindVertexArray(VertexArrayID);

glGenBuffers(1?&vertexbuffer);
glBindBuffer(GL_ARRAY_BUFFER?vertexbuffer);
glBufferData(GL_ARRAY_BUFFER?bunny.vertices.size()?*?sizeof(glm::vec3)?&bunny.vertices[0]?GL_STATIC_DRAW);

//?1rst?attribute?buffer?:?vertices
????glEnableVertexAttribArray(0);
????glBindBuffer(GL_ARRAY_BUFFER?vertexbuffer);
????glVertexAttribPointer(
????????0??????????????????//?attribute
????????3??????????????????//?size
????????GL_FLOAT???????????//?type
????????GL_FALSE???????????//?normalized?
????????0??????????????????//?stride
????????(void*)0????????????//?array?buffer?offset
????);

//?2rd?attribute?buffer?:?normals
????GLuint?normalbuffer;
glGenBuffers(1?&normalbuffer);
glBindBuffer(GL_ARRAY_BUFFER?normalbuffer);
glBufferData(GL_ARRAY_BUFFER?bunny.normals

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2013-11-24?10:57??OpenGLPro16_Texturing\
?????文件?????????207??2013-08-07?16:35??OpenGLPro16_Texturing\README.txt
?????文件?????????194??2013-08-07?16:35??OpenGLPro16_Texturing\README.txt~
?????文件????????1555??2013-08-27?22:38??OpenGLPro16_Texturing\SDLTest.cbp
?????文件????????1437??2013-08-07?16:04??OpenGLPro16_Texturing\SDLTest.cbp~
?????文件????????7746??2013-11-24?10:43??OpenGLPro16_Texturing\SDLTest.depend
?????文件????????1280??2013-11-24?10:57??OpenGLPro16_Texturing\SDLTest.layout
?????文件????????1279??2013-11-24?10:57??OpenGLPro16_Texturing\SDLTest.layout.cbTemp
?????目錄???????????0??2013-11-22?16:13??OpenGLPro16_Texturing\assets\
?????目錄???????????0??2013-11-23?22:45??OpenGLPro16_Texturing\assets\model\
?????文件???????57404??2013-08-16?20:33??OpenGLPro16_Texturing\assets\model\ball.obj
?????文件???????43662??2013-08-17?10:25??OpenGLPro16_Texturing\assets\model\ball2.obj
?????文件?????4862151??2013-08-16?20:29??OpenGLPro16_Texturing\assets\model\bunny.obj
?????文件?????????944??2013-11-23?22:40??OpenGLPro16_Texturing\assets\model\cubic.obj
?????文件?????7037230??2013-08-16?23:18??OpenGLPro16_Texturing\assets\model\dragon.obj
?????文件???????58002??2013-08-01?14:59??OpenGLPro16_Texturing\assets\model\monkey.obj
?????文件??????194614??2013-08-21?21:39??OpenGLPro16_Texturing\assets\model\scene.obj
?????目錄???????????0??2013-11-24?09:53??OpenGLPro16_Texturing\assets\textures\
?????文件??????210980??2012-06-15?10:39??OpenGLPro16_Texturing\assets\textures\brick.jpg
?????文件??????196662??2001-06-16?10:29??OpenGLPro16_Texturing\assets\textures\crate.bmp
?????文件??????196662??2013-11-24?09:53??OpenGLPro16_Texturing\assets\textures\crate_normal.bmp
?????文件?????2193338??2012-06-15?10:39??OpenGLPro16_Texturing\assets\textures\moss.png
?????文件???????11159??2013-08-05?19:56??OpenGLPro16_Texturing\assets\textures\smile.png
?????目錄???????????0??2013-11-22?16:13??OpenGLPro16_Texturing\bin\
?????目錄???????????0??2013-11-24?10:55??OpenGLPro16_Texturing\bin\Debug\
?????文件??????457598??2013-11-24?10:55??OpenGLPro16_Texturing\bin\Debug\SDLTest
?????文件???????10098??2013-11-24?10:54??OpenGLPro16_Texturing\cgl.cpp
?????文件?????????739??2013-11-24?10:43??OpenGLPro16_Texturing\cgl.h
?????文件????????3143??2013-08-21?10:42??OpenGLPro16_Texturing\csdl.cpp
?????文件?????????766??2013-08-20?23:13??OpenGLPro16_Texturing\csdl.h
?????文件?????????704??2013-11-24?09:15??OpenGLPro16_Texturing\main.cpp
............此處省略28個文件信息

評論

共有 條評論