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

Fix text artifacts in example browser #4626

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
9 changes: 6 additions & 3 deletions examples/OpenGLWindow/GLInstancingRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ static GLint points_colourIn = 0;
static GLint points_colour = 0;
GLuint pointsVertexBufferObject = 0;
GLuint pointsVertexArrayObject = 0;
GLuint pointsIndexVbo = 0;
GLuint pointsColourBufferObject = 0;

static GLint lines_ModelViewMatrix = 0;
static GLint lines_ProjectionMatrix = 0;
Expand Down Expand Up @@ -1279,12 +1279,15 @@ void GLInstancingRenderer::InitShaders()
glBindVertexArray(pointsVertexArrayObject);

glGenBuffers(1, &pointsVertexBufferObject);
glGenBuffers(1, &pointsIndexVbo);
glGenBuffers(1, &pointsColourBufferObject);

int sz = MAX_POINTS_IN_BATCH * sizeof(b3Vector3);
int sz1 = MAX_POINTS_IN_BATCH * sizeof(b3Vector4);
glBindVertexArray(pointsVertexArrayObject);
glBindBuffer(GL_ARRAY_BUFFER, pointsVertexBufferObject);
glBufferData(GL_ARRAY_BUFFER, sz, 0, GL_DYNAMIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, pointsColourBufferObject);
glBufferData(GL_ARRAY_BUFFER, sz1, 0, GL_DYNAMIC_DRAW);

glBindVertexArray(0);
}
Expand Down Expand Up @@ -1968,7 +1971,7 @@ void GLInstancingRenderer::drawPoints(const float* positions, const float* color
glEnableVertexAttribArray(points_position);
glVertexAttribPointer(points_position, 3, GL_FLOAT, GL_FALSE, pointStrideInBytes, 0);

glBindBuffer(GL_ARRAY_BUFFER, pointsVertexArrayObject);
glBindBuffer(GL_ARRAY_BUFFER, pointsColourBufferObject);
glBufferSubData(GL_ARRAY_BUFFER, 0, curPointsInBatch * 4 * sizeof(float), colors + offsetNumPoints * 4);
glEnableVertexAttribArray(points_colourIn);
glVertexAttribPointer(points_colourIn, 4, GL_FLOAT, GL_FALSE, 4 * sizeof(float), 0);
Expand Down