資源簡介
OpenGL Assimp Shader 加載3DMax模型
代碼片段和文件信息
//?Std.?Includes
#include?
//?GLEW
#define?GLEW_STATIC
#include?
//?GLFW
#include?
//?GL?includes
#include?“Shader.h“
#include?“Camera.h“
#include?“Model.h“
//?GLM?Mathemtics
#include?
#include?
#include?
//?Other?Libs
#include?
#pragma?comment(lib?“./SOIL.lib“)
#pragma?comment?(lib?“opengl32.lib“)
#pragma?comment?(lib?“glew32s.lib“)
#pragma?comment?(lib?“glfw3.lib“)?
#pragma?comment?(lib?“glfw3dll.lib“)?
#pragma?comment?(lib?“glew32mxs.lib“)
#pragma?comment?(lib?“assimp.lib“)
//?Properties
GLuint?screenWidth?=?800?screenHeight?=?600;
//?Function?prototypes
void?key_callback(GLFWwindow*?window?int?key?int?scancode?int?action?int?mode);
void?scroll_callback(GLFWwindow*?window?double?xoffset?double?yoffset);
void?mouse_callback(GLFWwindow*?window?double?xpos?double?ypos);
void?Do_Movement();
//?Camera
Camera?camera(glm::vec3(0.0f?0.0f?3.0f));
bool?keys[1024];
GLfloat?lastX?=?400?lastY?=?300;
bool?firstMouse?=?true;
GLfloat?deltaTime?=?0.0f;
GLfloat?lastframe?=?0.0f;
//?The?MAIN?function?from?here?we?start?our?application?and?run?the?Game?loop
int?main()
{
//?Init?GLFW
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR?3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR?3);
glfwWindowHint(GLFW_OPENGL_PROFILE?GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_RESIZABLE?GL_FALSE);
GLFWwindow*?window?=?glfwCreateWindow(screenWidth?screenHeight?“LearnOpenGL“?nullptr?nullptr);?//?Windowed
glfwMakeContextCurrent(window);
//?Set?the?required?callback?functions
glfwSetKeyCallback(window?key_callback);
glfwSetCursorPosCallback(window?mouse_callback);
glfwSetScrollCallback(window?scroll_callback);
//?Options
//glfwSetInputMode(window?GLFW_CURSOR?GLFW_CURSOR_DISABLED);
//?Initialize?GLEW?to?setup?the?OpenGL?Function?pointers
glewExperimental?=?GL_TRUE;
glewInit();
//?Define?the?viewport?dimensions
glViewport(0?0?screenWidth?screenHeight);
//?Setup?some?OpenGL?options
glEnable(GL_DEPTH_TEST);
//?Setup?and?compile?our?shaders
Shader?shader(“./Shader/obj_vertex“?“./Shader/obj_fragement“);
Shader?lampShader(“./Shader/lamp_vertex“?“./Shader/lamp_fragement“);
//?Load?models
Model?ourModel(“./nanosuit.obj“);
//?Used?a?lamp?object?here.?Find?one?yourself?on?the?internet?or?create?your?own?one?;)?(or?be?oldschool?and?set?the?VBO?and?VAO?yourselves)
//Model?lightBulb(“./Bulb.obj“);
Model?lightBulb(“./nanosuit.obj“);
//?Draw?in?wireframe
//glPolygonMode(GL_FRONT_AND_BACK?GL_LINE);
//?Point?light?positions
glm::vec3?pointLightPositions[]?=?{
glm::vec3(2.3f?-1.6f?-3.0f)
glm::vec3(-1.7f?0.9f?1.0f)
};
//?Game?loop
while?(!glfwWindowShouldClose(window))
{
//?Set?frame?time
GLfloat?currentframe?=?glfwGetTime();
deltaTime?=?currentframe?-?lastframe;
las
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????575246??2011-05-27?01:20??OGLModel\arm_dif.png
?????文件?????866022??2011-05-27?01:41??OGLModel\arm_showroom_ddn.png
?????文件????1667518??2011-05-27?01:20??OGLModel\arm_showroom_spec.png
?????文件?????636275??2011-05-27?01:20??OGLModel\body_dif.png
?????文件?????859857??2011-05-27?01:42??OGLModel\body_showroom_ddn.png
?????文件????1767209??2011-05-27?01:20??OGLModel\body_showroom_spec.png
?????文件????5429685??2014-12-13?02:28??OGLModel\Bulb.obj
?????文件???????3951??2016-12-16?17:45??OGLModel\Camera.h
?????文件???????5988??2011-05-27?01:42??OGLModel\glass_ddn.png
?????文件???????1303??2011-05-27?01:20??OGLModel\glass_dif.png
?????文件?????655217??2011-05-27?01:20??OGLModel\hand_dif.png
?????文件?????999651??2011-05-27?01:44??OGLModel\hand_showroom_ddn.png
?????文件????1741615??2011-05-27?01:20??OGLModel\hand_showroom_spec.png
?????文件?????525264??2011-05-27?01:20??OGLModel\helmet_diff.png
?????文件?????746785??2011-05-27?01:44??OGLModel\helmet_showroom_ddn.png
?????文件????1565316??2011-05-27?01:20??OGLModel\helmet_showroom_spec.png
?????文件????1179745??2011-05-27?01:21??OGLModel\leg_dif.png
?????文件????1370738??2011-05-27?01:44??OGLModel\leg_showroom_ddn.png
?????文件????1772341??2011-05-27?01:21??OGLModel\leg_showroom_spec.png
?????文件????????201??2015-08-12?11:01??OGLModel\LICENSE.txt
?????文件???????9063??2016-12-19?15:45??OGLModel\main.cpp
?????文件???????3976??2016-12-19?14:55??OGLModel\mesh.h
?????文件???????7725??2016-12-19?15:00??OGLModel\model.h
?????文件????2970628??2014-07-17?11:41??OGLModel\nanosuit.blend
?????文件???????1396??2014-12-22?11:25??OGLModel\nanosuit.mtl
?????文件????1854853??2014-07-17?14:07??OGLModel\nanosuit.obj
?????文件???????7558??2016-12-19?14:55??OGLModel\OGLModel.vcxproj
?????文件???????1325??2016-12-19?14:55??OGLModel\OGLModel.vcxproj.filters
?????文件????????179??2016-12-19?15:44??OGLModel\Shader\lamp_fragement
?????文件????????349??2016-12-19?15:44??OGLModel\Shader\lamp_vertex
............此處省略9個文件信息
評論
共有 條評論