dodanie modelu lazik3.obj
This commit is contained in:
7678
lazik3.obj
Normal file
7678
lazik3.obj
Normal file
File diff suppressed because it is too large
Load Diff
@@ -24,6 +24,8 @@ bool loadOBJ(const char* path, std::vector <glm::vec3>& out_vertices, std::vecto
|
||||
return false;
|
||||
}
|
||||
|
||||
int line = 0;
|
||||
|
||||
while (1) {
|
||||
|
||||
char lineHeader[128];
|
||||
@@ -57,7 +59,7 @@ bool loadOBJ(const char* path, std::vector <glm::vec3>& out_vertices, std::vecto
|
||||
int matches = fscanf(file, "%d/%d/%d %d/%d/%d %d/%d/%d\n", &vertexIndex[0], &uvIndex[0], &normalIndex[0], &vertexIndex[1], &uvIndex[1], &normalIndex[1], &vertexIndex[2], &uvIndex[2], &normalIndex[2]);
|
||||
|
||||
if (matches != 9){
|
||||
printf("File can't be read by our simple parser : ( Try exporting with other options\n");
|
||||
printf("File can't be read by our simple parser. Try exporting with other options (%d matches on line %d)\n", matches, line);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -87,6 +89,8 @@ bool loadOBJ(const char* path, std::vector <glm::vec3>& out_vertices, std::vecto
|
||||
out_normals .push_back(vertex3);
|
||||
}
|
||||
|
||||
line++;
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
13
main.cpp
13
main.cpp
@@ -263,7 +263,7 @@ void RenderScene(void) {
|
||||
/* */
|
||||
// Read our .obj file
|
||||
|
||||
bool res = loadOBJ("suzanne.obj", vertices, uvs, normals);
|
||||
bool res = loadOBJ("lazik3.obj", vertices, uvs, normals);
|
||||
/* */
|
||||
|
||||
glGenBuffers(1, &vertexbuffer);
|
||||
@@ -329,10 +329,10 @@ void RenderScene(void) {
|
||||
//glUseProgram(programID);
|
||||
|
||||
// Bind our texture in Texture Unit 0
|
||||
//glActiveTexture(GL_TEXTURE0);
|
||||
//glBindTexture(GL_TEXTURE_2D, Texture);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, Texture);
|
||||
// Set our "myTextureSampler" sampler to use Texture Unit 0
|
||||
//glUniform1i(TextureID, 0);
|
||||
glUniform1i(TextureID, 0);
|
||||
|
||||
// 1rst attribute buffer : vertices
|
||||
glEnableVertexAttribArray(0);
|
||||
@@ -346,7 +346,7 @@ void RenderScene(void) {
|
||||
(void*)0 // array buffer offset
|
||||
);
|
||||
|
||||
// 2nd attribute buffer : UVs
|
||||
// 2nd attribute buffer: UVs
|
||||
glEnableVertexAttribArray(1);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, uvbuffer);
|
||||
glVertexAttribPointer(
|
||||
@@ -358,7 +358,7 @@ void RenderScene(void) {
|
||||
(void*)0 // array buffer offset
|
||||
);
|
||||
|
||||
// Draw the triangle !
|
||||
// Draw the triangle!
|
||||
glDrawArrays(GL_TRIANGLES, 0, vertices.size() );
|
||||
|
||||
glDisableVertexAttribArray(0);
|
||||
@@ -706,6 +706,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
case ' ': // 32
|
||||
polygonmode = !polygonmode;
|
||||
if (polygonmode) std::cout << "debug: tryb wireframe jest niewydajny i powinien sluzyc tylko do debugowania!\n";
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
BIN
output.exe
BIN
output.exe
Binary file not shown.
Reference in New Issue
Block a user