Results 1 to 8 of 8

Thread: Max number of polygon

Hybrid View

  1. #1
    Newbie
    Join Date
    May 2013
    Posts
    4

    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

  2. #2
    Member
    Join Date
    Jun 2012
    Location
    Texas
    Posts
    61
    Quote Originally Posted by deduu10 View Post
    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
    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

  3. #3
    Newbie
    Join Date
    May 2013
    Posts
    4
    Quote Originally Posted by ClayMontgomery View Post
    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
    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

  4. #4
    Member
    Join Date
    Jun 2012
    Location
    Texas
    Posts
    61
    Quote Originally Posted by deduu10 View Post
    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
    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

  5. #5
    Newbie
    Join Date
    May 2013
    Posts
    4
    Quote Originally Posted by ClayMontgomery View Post
    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
    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.

    Code :
    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
    Last edited by deduu10; 05-17-2013 at 02:13 AM.

  6. #6
    Member
    Join Date
    Jun 2012
    Location
    Texas
    Posts
    61
    Quote Originally Posted by deduu10 View Post
    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.

    Code :
    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
    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:

    http://software.intel.com/en-us/arti...cessors-part-2

    Regards, Clay

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •