Skip to content

Commit

Permalink
cosmetics.
Browse files Browse the repository at this point in the history
  • Loading branch information
syoyo committed Oct 15, 2023
1 parent 268872d commit 1ca8d96
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions examples/openglviewer/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ struct GLProgramState {
std::map<std::string, example::shader> shaders;
};

struct GLScene {
std::vector<GLMeshState> meshes;
};

struct GUIContext {
enum AOV {
AOV_COLOR = 0,
Expand Down Expand Up @@ -595,7 +599,7 @@ static bool SetupMesh(tinyusdz::tydra::RenderMesh& mesh, GLuint program_id,
/* stride */ sizeof(GLfloat) * 3, 0);
CHECK_GL("VertexAttribPointer");
} else {
std::cerr << kAttribPoints << " attribute not found in vertex shader.\n";
std::cerr << "vertex positions: " << kAttribPoints << " attribute not found in vertex shader.\n";
return false;
}
}
Expand All @@ -617,7 +621,7 @@ static bool SetupMesh(tinyusdz::tydra::RenderMesh& mesh, GLuint program_id,
/* stride */ sizeof(GLfloat) * 3, 0);
CHECK_GL("VertexAttribPointer");
} else {
std::cerr << kAttribNormals << " attribute not found in vertex shader. Shader does not use it?\n";
std::cerr << "vertex normals: " << kAttribNormals << " attribute not found in vertex shader. Shader does not use it?\n";
// may ok
}
}
Expand Down Expand Up @@ -651,12 +655,13 @@ static bool SetupMesh(tinyusdz::tydra::RenderMesh& mesh, GLuint program_id,
/* stride */ sizeof(GLfloat) * 2, 0);
CHECK_GL("VertexAttribPointer");
} else {
std::cerr << texattr << " attribute not found in vertex shader.\n";
return false;
std::cerr << "Texture UV0: " << texattr << " attribute not found in vertex shader.\n";
// may OK
}
}
}

// We build facevarying vertex data, so no index buffers.
#if 0
// Build index buffer.
GLuint elementbuffer;
Expand Down Expand Up @@ -690,6 +695,9 @@ static void DrawScene(const example::shader &shader,
shader.use();
CHECK_GL("shader.use");

for (size_t i = 0; i < scene.meshes.size(); i++) {
}

glUseProgram(0);
CHECK_GL("glUseProgram(0)");
}
Expand Down Expand Up @@ -947,13 +955,10 @@ int main(int argc, char** argv) {
exit(-1);
}

ProcScene(gl_progs.shaders["default"], stage);

struct GLProgramState {
// std::map<std::string, GLint> uniforms;
if (!ProcScene(gl_progs.shaders["default"], stage)) {
exit(-1);
}

std::map<std::string, example::shader> shaders;
};

int display_w, display_h;
ImVec4 clear_color = {0.1f, 0.18f, 0.3f, 1.0f};
Expand Down

0 comments on commit 1ca8d96

Please sign in to comment.