I'm passing my vertex shader a bunch of vertices and color data. I would like to first render the triangles and then render a point at each vertex. The triangles render fine, but I can't think of a way to render the triangles and the points without making and calling a whole new method for rendering points, which I guess I could do, but I'd like to know if there is some shader magic that accomplish it for me.
Thanks in advance!
This is my vs:
#version 120
uniform mat4 projection;
void main() {
gl_Position = projection * ftransform();
gl_PointSize = 1.0;
gl_FrontColor = gl_Color;
}
This is my fs:
#version 120
#define point_color vec3(1,1,1)
void main() {
vec4 color = gl_Color;
gl_FragColor = vec4(color);
}
This is the code behind it. I'm using lwjgl.
public void render() {
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glEnable(GL_PROGRAM_POINT_SIZE);
glBindBuffer(GL_ARRAY_BUFFER, VBO_id);
glVertexPointer(3, GL_FLOAT, 0, 0);
glBindBuffer(GL_ARRAY_BUFFER, c_id);
glColorPointer(4, GL_FLOAT, 0, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, i_id);
glDrawElements(GL_TRIANGLES, draw_count, GL_UNSIGNED_INT, 0);
glDrawArrays(GL_POINTS, 0, draw_count_v);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glDisable(GL_PROGRAM_POINT_SIZE);
}