Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RenderVboIbo: fix number of vertex indices for glDrawElements #152

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions include/pangolin/gl/glvbo.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,12 @@ inline void RenderVboIbo(GlBuffer& vbo, GlBuffer& ibo, bool draw_mesh)

if(draw_mesh) {
ibo.Bind();
glDrawElements(GL_TRIANGLE_STRIP,ibo.num_elements, ibo.datatype, 0);
if(ibo.count_per_element==1) {
glDrawElements(GL_TRIANGLE_STRIP,ibo.num_elements, ibo.datatype, 0);
}
else {
glDrawElements(GL_TRIANGLES,ibo.num_elements*ibo.count_per_element, ibo.datatype, 0);
}
ibo.Unbind();
}else{
glDrawArrays(GL_POINTS, 0, vbo.num_elements);
Expand Down Expand Up @@ -173,7 +178,12 @@ inline void RenderVboIboCboNbo(GlBuffer& vbo, GlBuffer& ibo, GlBuffer& cbo, GlBu

if(draw_mesh) {
ibo.Bind();
glDrawElements(GL_TRIANGLE_STRIP,ibo.num_elements, ibo.datatype, 0);
if(ibo.count_per_element==1) {
glDrawElements(GL_TRIANGLE_STRIP,ibo.num_elements, ibo.datatype, 0);
}
else {
glDrawElements(GL_TRIANGLES,ibo.num_elements*ibo.count_per_element, ibo.datatype, 0);
}
ibo.Unbind();
}else{
glDrawArrays(GL_POINTS, 0, vbo.num_elements);
Expand Down Expand Up @@ -207,7 +217,12 @@ inline void RenderVboIboNbo(GlBuffer& vbo, GlBuffer& ibo, GlBuffer& nbo, bool dr

if(draw_mesh) {
ibo.Bind();
glDrawElements(GL_TRIANGLE_STRIP,ibo.num_elements, ibo.datatype, 0);
if(ibo.count_per_element==1) {
glDrawElements(GL_TRIANGLE_STRIP,ibo.num_elements, ibo.datatype, 0);
}
else {
glDrawElements(GL_TRIANGLES,ibo.num_elements*ibo.count_per_element, ibo.datatype, 0);
}
ibo.Unbind();
}else{
glDrawArrays(GL_POINTS, 0, vbo.num_elements);
Expand Down