Max number of polygon

Hi,

I want to draw an object that consists of many polygons for I need to construct it from many polygons. But, I was stuck due to limited number of polygon I can draw in my device.
I used vertex array, no texture, with a single light source. Is there any chance to increase the number of polygon I can draw for each single frame?

Thanks

[QUOTE=deduu10;29274]Hi,

I want to draw an object that consists of many polygons for I need to construct it from many polygons. But, I was stuck due to limited number of polygon I can draw in my device.
I used vertex array, no texture, with a single light source. Is there any chance to increase the number of polygon I can draw for each single frame?

Thanks[/QUOTE]

Using a vertex buffer object (VBO) will help, if you are not already doing that. VBO typically performs better than ordinary vertex arrays or triangle strips, particularly when the number of polygons is large. If you can control the algorithm that generates the polygons, try to discard triangles that will be too small to be visible.

Regards, Clay

[QUOTE=ClayMontgomery;29277]Using a vertex buffer object (VBO) will help, if you are not already doing that. VBO typically performs better than ordinary vertex arrays or triangle strips, particularly when the number of polygons is large. If you can control the algorithm that generates the polygons, try to discard triangles that will be too small to be visible.

Regards, Clay[/QUOTE]

Hi,

I’ve tried using VBO but I got OutOfMemoryError. it seems my graphics memory has lower capacity than my client memory because it works when I rendered without VBO but failed with VB0. Do you have any idea about this issue?

Thanks

[QUOTE=deduu10;29280]Hi,

I’ve tried using VBO but I got OutOfMemoryError. it seems my graphics memory has lower capacity than my client memory because it works when I rendered without VBO but failed with VB0. Do you have any idea about this issue?

Thanks[/QUOTE]

VBO is a required feature of OpenGL ES 2.0, so it should work. What platform and GPU are you using? If you have a lot of textures or FBOs allocated, try disabling that to free up more memory for the VBO.

Regards, Clay

[QUOTE=ClayMontgomery;29289]VBO is a required feature of OpenGL ES 2.0, so it should work. What platform and GPU are you using? If you have a lot of textures or FBOs allocated, try disabling that to free up more memory for the VBO.

Regards, Clay[/QUOTE]

Hi, can you help me to figure out what’s wrong with my snippet code? I could not figure out, what cause my VBO got OutOfMemoryError.
Here is my snippet code. I use Android platform, and I used no texture.

GLuint buffer[3];
 
glGenBuffers(3, buffer);
 
glBindBuffer(GL_ARRAY_BUFFER, buffer[0]);
glBufferData(GL_ARRAY_BUFFER, genData.cubeNumVerts * 4, genData.vertex, GL_DYNAMIC_DRAW);
 
glBindBuffer(GL_ARRAY_BUFFER, buffer[1]);
glBufferData(GL_ARRAY_BUFFER, genData.cubeColorVerts *4, genData.colors, GL_DYNAMIC_DRAW);
 
glBindBuffer(GL_ARRAY_BUFFER, buffer[2]);
glBufferData(GL_ARRAY_BUFFER, genData.cubeNormalVerts * 4, genData.normals, GL_DYNAMIC_DRAW);
 
 
  if(genData.vertex == 0 || genData.normals == 0 || genData.colors == 0) LOG("Error: failed to allocate a memory");
 
 
  glBindBuffer(GL_ARRAY_BUFFER, buffer[0]);
  glEnableVertexAttribArray(vertexHandle);
  glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0,0);
 
  glBindBuffer(GL_ARRAY_BUFFER, buffer[2]);
  glEnableVertexAttribArray(normalHandle);
  glVertexAttribPointer(normalHandle, 3, GL_FLOAT, GL_FALSE, 0,0);
 
       // glVertexAttrib4fv(mColorHandle,   genData.colors);
  glBindBuffer(GL_ARRAY_BUFFER, buffer[1]);
  glEnableVertexAttribArray(mColorHandle);
  glVertexAttribPointer(mColorHandle, 4, GL_FLOAT, GL_FALSE, 0,0);
 
      glDrawArrays(GL_TRIANGLES, 0, genData.cubeNumVerts);
 
      glDeleteBuffers(3, buffer);

Please helps…
Thanks

[QUOTE=deduu10;29300]Hi, can you help me to figure out what’s wrong with my snippet code? I could not figure out, what cause my VBO got OutOfMemoryError.
Here is my snippet code. I use Android platform, and I used no texture.

GLuint buffer[3];
 
glGenBuffers(3, buffer);
 
glBindBuffer(GL_ARRAY_BUFFER, buffer[0]);
glBufferData(GL_ARRAY_BUFFER, genData.cubeNumVerts * 4, genData.vertex, GL_DYNAMIC_DRAW);
 
glBindBuffer(GL_ARRAY_BUFFER, buffer[1]);
glBufferData(GL_ARRAY_BUFFER, genData.cubeColorVerts *4, genData.colors, GL_DYNAMIC_DRAW);
 
glBindBuffer(GL_ARRAY_BUFFER, buffer[2]);
glBufferData(GL_ARRAY_BUFFER, genData.cubeNormalVerts * 4, genData.normals, GL_DYNAMIC_DRAW);
 
 
  if(genData.vertex == 0 || genData.normals == 0 || genData.colors == 0) LOG("Error: failed to allocate a memory");
 
 
  glBindBuffer(GL_ARRAY_BUFFER, buffer[0]);
  glEnableVertexAttribArray(vertexHandle);
  glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0,0);
 
  glBindBuffer(GL_ARRAY_BUFFER, buffer[2]);
  glEnableVertexAttribArray(normalHandle);
  glVertexAttribPointer(normalHandle, 3, GL_FLOAT, GL_FALSE, 0,0);
 
       // glVertexAttrib4fv(mColorHandle,   genData.colors);
  glBindBuffer(GL_ARRAY_BUFFER, buffer[1]);
  glEnableVertexAttribArray(mColorHandle);
  glVertexAttribPointer(mColorHandle, 4, GL_FLOAT, GL_FALSE, 0,0);
 
      glDrawArrays(GL_TRIANGLES, 0, genData.cubeNumVerts);
 
      glDeleteBuffers(3, buffer);

Please helps…
Thanks[/QUOTE]

I recommended you try GL_STATIC_DRAW instead of GL_DYNAMIC_DRAW to see if it eliminates the error. I would also try commenting out the VBOs for the normal and color arrays temporarily to see if that helps.
I suspect this may be an OpenGL ES driver problem, rather than a bug in your code. Which GPU are you using (Nvidia, PowerVR, Adreno)? Is this code running in a native library or with the OpenGL ES wrapper classes? You should try running your code in an AVD emulator, but you must use a recent version of Android to do that. This article will help you setup an AVD for OpenGL ES 2.0:

Regards, Clay

Hi,

I’ve tried using GL_STATIC_DRAW and the error persists. It’s weird that I could render the from the same data with VAO but failed with VBO.
I’m using Mali 400MP, Yes, this code is running in a native library. Since I’m dealing with Augmented Reality, I just could not run this code in an AVD emulator.

Thanks

[QUOTE=deduu10;29304]Hi,

I’ve tried using GL_STATIC_DRAW and the error persists. It’s weird that I could render the from the same data with VAO but failed with VBO.
I’m using Mali 400MP, Yes, this code is running in a native library. Since I’m dealing with Augmented Reality, I just could not run this code in an AVD emulator.

Thanks[/QUOTE]

I think the problem might be a bug in the Mali OpenGL ES driver. I recommend you try your code on an Android device with a different type of GPU, such as Nvidia Tegra or PowerVR.

Regards, Clay

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.