Seems to have an issue with OpenGLES2.0 as it can only draw up to 65535 on my:
Code: Select all
glDrawArrays(GL_POINTS, 0, pointCount); //307200 points So is there any way to increase the point count for the call?
Thanks.
Code: Select all
glDrawArrays(GL_POINTS, 0, pointCount); //307200 points Code: Select all
glVertexAttribPointer(posAttrib, 4, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat), (GLvoid *)segment1);
glEnableVertexAttribArray(posAttrib);
glDrawArrays(GL_POINTS, 0, 65535);
glVertexAttribPointer(posAttrib, 4, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat), (GLvoid *)segment2);
glEnableVertexAttribArray(posAttrib);
glDrawArrays(GL_POINTS, 0, 65535);
glVertexAttribPointer(posAttrib, 4, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat), (GLvoid *)segment3);
glEnableVertexAttribArray(posAttrib);
glDrawArrays(GL_POINTS, 0, 65535);There shouldn't be a problem. Although in your code you showed you call glEnableVertexAttribArray(posAttrib); three times, you only need to enable it the first time, it'll stay active until you disable it with glDisableVertexAttribArray (posAttrib);Mariusmssj4 wrote:Yeah it seems to be the case, is it possible to make up a point cloud out of multiple 65535 point segments?
Code: Select all
glDrawArrays(GL_POINTS, 0, 65535);
glDrawArrays(GL_POINTS, 65536, 65535);
glDrawArrays (GL_POINTS, 131072, 65535); Code: Select all
void Renderer::draw(pcl::PointCloud<pcl::PointXYZRGB>::Ptr pointCloud)
{
// Set the viewport
glViewport(0, 0, this->GScreenWidth, this->GScreenHeight);
//Clear colour buffer
glClearColor(0.0f, 0.8f, 0.8f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
if (pointCloud->size() == 0)
return;
pcl::PointXYZRGB *pointPtr = &pointCloud->points[0];
size_t pointCount = pointCloud->points.size();
int segments = pointCount / 65535;
int lowSegm = pointCount % 65535; //307200
//Use program object
glUseProgram(this->programObject);
//Get attribute location
GLint posAttrib = glGetAttribLocation(this->programObject, "position");
glEnableVertexAttribArray(posAttrib);
for (int i = 0; i <= segments; i++)
{
float * ptrV = (float*)(&pointPtr[65535 * i]);
//Load vertex data
glVertexAttribPointer(posAttrib, 4, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat), (GLvoid *)(ptrV));
if (i < segments)
glDrawArrays(GL_POINTS, 0, 65535);
else
glDrawArrays(GL_POINTS, 0, lowSegm);
}
glDisableVertexAttribArray(posAttrib);
eglSwapBuffers(this->GDisplay, this->GSurface);
}