render vertex points and fundamental region
This commit is contained in:
@@ -33,10 +33,10 @@ public:
|
||||
program = build_program("main", vs, fs);
|
||||
|
||||
verts_data = vertices<3>({}, Multiplicites<3>({
|
||||
{0, 1, 4},
|
||||
{0, 1, 5},
|
||||
{1, 2, 3}
|
||||
}), {
|
||||
2.0f, .05f, 0.05f
|
||||
10, 1, 1
|
||||
});
|
||||
|
||||
glGenBuffers(1, &verts);
|
||||
@@ -58,25 +58,32 @@ public:
|
||||
glViewport(0, 0, w, h);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
const glm::mat4 id = glm::mat4(1);
|
||||
const glm::vec3 ax = glm::vec3(0, 0, 1);
|
||||
double t = glfwGetTime();
|
||||
float angle = (float) t;
|
||||
const auto id = glm::mat4(1);
|
||||
const auto ax_1 = glm::vec3(0, 0, 1);
|
||||
const auto ax_2 = glm::vec3(.5, 1, 0.2);
|
||||
const auto t = glfwGetTime();
|
||||
const auto angle = (float) t / 2;
|
||||
|
||||
float ar = (float) w / (float) h;
|
||||
const float sc = 1.5f;
|
||||
const float ar = (float) w / (float) h;
|
||||
|
||||
const glm::mat4 proj = glm::ortho(-ar, ar, -1.f, 1.f, -1.f, 1.f);
|
||||
const glm::mat4 view = glm::rotate(id, angle, ax);
|
||||
const glm::mat4 proj = glm::ortho(-ar * sc, ar * sc, -sc, sc, -10.f, 10.f);
|
||||
const glm::mat4 view = glm::rotate(id, angle, ax_1) * glm::rotate(id, angle, ax_2);
|
||||
const glm::mat4 mat = proj * view;
|
||||
|
||||
glUseProgram(program);
|
||||
glUniformMatrix4fv(0, 1, false, glm::value_ptr(mat));
|
||||
glUniformMatrix4fv(1, 1, false, glm::value_ptr(mat));
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_POINT_SMOOTH);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glPointSize(10.f);
|
||||
|
||||
glBindVertexArray(tri);
|
||||
glDrawArrays(GL_POINTS, 0, verts_data.size());
|
||||
glUniform4f(0, 1, 1, 1, 1);
|
||||
glDrawArrays(GL_POINTS, 0, verts_data.size() - 3);
|
||||
glUniform4f(0, 1, 1, 1, .1);
|
||||
glDrawArrays(GL_TRIANGLES, verts_data.size() - 3, 3);
|
||||
|
||||
swapbuffers();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user