enable multi sampling in Windows, fix circle shape
This commit is contained in:
@@ -55,8 +55,10 @@ void App::init()
|
||||
shader_color.create(shader_color_v, shader_color_f);
|
||||
shader_uv.create(shader_v, shader_uv_f);
|
||||
plane.create<5>(50, 50);
|
||||
circle.create<10>(25, Circle::kUVMapping::Tube);
|
||||
circle2.create<10>(25, 12, Circle::kUVMapping::Tube);
|
||||
circle.create<10>(25);
|
||||
circle2.create<10>(25, Circle::kUVMapping::Tube);
|
||||
circle3.create<10>(25, 12, Circle::kUVMapping::Tube);
|
||||
circle4.create<10>(25, 12, Circle::kUVMapping::Planar);
|
||||
rounded.create<3>(50, 50, 10);
|
||||
slice.create(50, 50, 10, .3f);
|
||||
if (!tex.load("data/uvs.jpg"))
|
||||
@@ -96,13 +98,14 @@ void App::update(float dt)
|
||||
|
||||
glm::mat4 proj = glm::ortho(0.f, (float)width, (float)height, 0.f, -1.f, 1.f);
|
||||
|
||||
Shape* shapes[] = { &circle, &circle2, &plane, &rounded, &slice };
|
||||
Shape* shapes[] = { &circle, &circle2, &circle3, &circle4, &plane, &rounded, &slice };
|
||||
|
||||
//glClearColor(red, 0, 0, 1);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
auto s = glm::scale(glm::vec3(2));
|
||||
for (int i = 0; i < 5; i++)
|
||||
auto s = glm::scale(glm::vec3(1.5));
|
||||
int h = 100;
|
||||
for (int i = 0; i < sizeof(shapes)/sizeof(Shape*); i++)
|
||||
{
|
||||
shader.use();
|
||||
|
||||
@@ -110,32 +113,45 @@ void App::update(float dt)
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
tex.bind();
|
||||
shader.u_int("tex", 0);
|
||||
shader.u_mat4("mvp", proj * glm::translate(glm::vec3{75 + 120 * 1, 75 + 120 * i, 0.f}) * s);
|
||||
shader.u_mat4("mvp", proj * glm::translate(glm::vec3{75 + h * 1, 75 + h * i, 0.f}) * s);
|
||||
shapes[i]->draw_fill();
|
||||
tex.unbind();
|
||||
|
||||
shader_color.use();
|
||||
shader_color.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 + h * 2, 75 + h * i, 0.f}) * s);
|
||||
shader_color.u_vec4("col", {1, 1, 1, 1});
|
||||
shapes[i]->draw_stroke();
|
||||
|
||||
shader_color.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 + h * 0, 75 + h * i, 0.f}) * s);
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
shapes[i]->draw_fill();
|
||||
|
||||
shader_uv.use();
|
||||
shader_uv.u_mat4("mvp", proj * glm::translate(glm::vec3{75 + 120 * 3, 75 + 120 * i, 0.f}) * s);
|
||||
shader_uv.u_mat4("mvp", proj * glm::translate(glm::vec3{75 + h * 3, 75 + h * i, 0.f}) * s);
|
||||
shader_uv.u_int("tex", 0);
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
shapes[i]->draw_fill();
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
shader_uv.u_mat4("mvp", proj * glm::translate(glm::vec3{75 + 120 * 4, 75 + 120 * i, 0.f}) * s);
|
||||
shader_uv.u_mat4("mvp", proj * glm::translate(glm::vec3{75 + h * 4, 75 + h * i, 0.f}) * s);
|
||||
shapes[i]->draw_fill();
|
||||
tex.unbind();
|
||||
}
|
||||
//glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
// shader_color.use();
|
||||
// shader_color.u_mat4("mvp", proj * glm::translate(glm::vec3{width/2, height/2, 0.f}) * glm::scale(glm::vec3(8)));
|
||||
// shader_color.u_vec4("col", {1, 1, 1, 1});
|
||||
// slice.draw_fill();
|
||||
//shader_color.use();
|
||||
//shader_color.u_mat4("mvp", proj * glm::translate(glm::vec3{width/2, height/2, 0.f}) * glm::scale(glm::vec3(8)));
|
||||
//shader_color.u_vec4("col", {1, 1, 1, 1});
|
||||
|
||||
//glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
//tex.bind();
|
||||
//shader.use();
|
||||
//shader.u_mat4("mvp", proj * glm::translate(glm::vec3{ width / 2, height / 2, 0.f }) * glm::scale(glm::vec3(8)));
|
||||
//shader.u_int("tex", 0);
|
||||
//circle3.draw_fill();
|
||||
|
||||
//glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
//shader_color.use();
|
||||
//shader_color.u_mat4("mvp", proj * glm::translate(glm::vec3{width/2, height/2, 0.f}) * glm::scale(glm::vec3(8)));
|
||||
//shader_color.u_vec4("col", {1, 1, 1, 1});
|
||||
//glLineWidth(2);
|
||||
//circle3.draw_fill();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user