create visual studio project, add Windows initialization code

This commit is contained in:
2017-01-17 20:20:12 +00:00
parent f1e6fb7716
commit c93c1daecc
9 changed files with 456 additions and 21 deletions

View File

@@ -58,7 +58,7 @@ void App::init()
circle.create<10>(25, Circle::kUVMapping::Tube);
circle2.create<10>(25, 12, Circle::kUVMapping::Tube);
rounded.create<3>(50, 50, 10);
slice.create(50, 50, 10, .3);
slice.create(50, 50, 10, .3f);
if (!tex.load("data/uvs.jpg"))
printf("error loading image\n");
@@ -66,15 +66,15 @@ void App::init()
glEnable(GL_TEXTURE);
glDisable(GL_DEPTH_TEST);
glPointSize(5);
glLineWidth(15);
glLineWidth(1);
int n;
glGetIntegerv(GL_NUM_EXTENSIONS, &n);
for (int i = 0; i < n; i++)
{
const unsigned char* s = glGetStringi(GL_EXTENSIONS, i);
printf("GL ext %03d: %s\n", i, s);
}
//int n;
//glGetIntegerv(GL_NUM_EXTENSIONS, &n);
//for (int i = 0; i < n; i++)
//{
// const unsigned char* s = glGetStringi(GL_EXTENSIONS, i);
// printf("GL ext %03d: %s\n", i, s);
//}
printf("GL version: %s\n", glGetString(GL_VERSION));
printf("GL vendor: %s\n", glGetString(GL_VENDOR));
printf("GL renderer: %s\n", glGetString(GL_RENDERER));
@@ -94,7 +94,7 @@ void App::update(float dt)
// glm::mat4 model = glm::translate(glm::vec3(0, 0, 0));
// glm::mat4 view = glm::lookAt(glm::vec3(sinf(theta), 0, 1), glm::vec3(0, 0, 0), glm::vec3(0, 1, 0));
glm::mat4 proj = glm::ortho<float>(0, width, height, 0, -1, 1);
glm::mat4 proj = glm::ortho(0.f, (float)width, (float)height, 0.f, -1.f, 1.f);
Shape* shapes[] = { &circle, &circle2, &plane, &rounded, &slice };
@@ -115,11 +115,11 @@ void App::update(float dt)
tex.unbind();
shader_color.use();
shader.u_mat4("mvp", proj * glm::translate(glm::vec3{75 + 120 * 2, 75 + 120 * i, 0.f}) * s);
shader_color.u_mat4("mvp", proj * glm::translate(glm::vec3{75 + 120 * 2, 75 + 120 * i, 0.f}) * s);
shader_color.u_vec4("col", {1, 1, 1, 1});
shapes[i]->draw_stroke();
shader.u_mat4("mvp", proj * glm::translate(glm::vec3{75 + 120 * 0, 75 + 120 * i, 0.f}) * s);
shader_color.u_mat4("mvp", proj * glm::translate(glm::vec3{75 + 120 * 0, 75 + 120 * i, 0.f}) * s);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
shapes[i]->draw_fill();