login about faq


Hey Lockergnome,

I am currently busy with some 3D model drawing that I am converting from (wavefront) *.obj to vertex data. When I have low poly models it work quite well but when the amount just gets to big it starts to cut off some data. Objects are not being drawn completely and are cut of.

Is there a maximum to the amount of vertices and triangles (the way that I draw the model) or is there something else going on?

The model that I currently want to draw has ~600 vertices (X Y Z) and ~1200 faces (V1,V2,V3)

Edit:

I guess the OpenGL code is ok, my converter from .obj (wavefront via riptude pro in Cinema4D) to OpenGLES is messed up when handeling large amounts of data...

Edit 2:

Nope I just ran a test with a code generated plane, 1010 vertices goes fine, 2020 vertices get's cut of...

This is my drawing code for the Vertex array and Indices array

glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);

glEnableVertexAttribArray(GLKVertexAttribPosition);        
glVertexAttribPointer(GLKVertexAttribPosition, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid *) offsetof(Vertex, Position));
glEnableVertexAttribArray(GLKVertexAttribColor);
glVertexAttribPointer(GLKVertexAttribColor, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid *) offsetof(Vertex, Color));

glDrawElements(GL_TRIANGLES, sizeof(indicies)/sizeof(indicies[0]), GL_UNSIGNED_BYTE, 0);

Edit 3:

I got it working! My problem was that the GL_ UNSIGNED_ BYTE only allows up to vertex 255 while I had way more then that. By changing the GL_ UNSIGNED_ BYTE to a GL_UNSIGNED_ SHORT and the Vertices array from a GLubyte to a GLushort I am now able to draw up to 32768 inicies, or around 11,000 faces!

asked May 21 '12 at 07:35

nitrocrime's gravatar image

nitrocrime
3.6k6277125

edited May 22 '12 at 04:53

Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported


Join Us in the Chat Room

Tags:

×1,396
×863
×350
×39
×13
×8
×4
×4
×4
×1

Asked: May 21 '12 at 07:35

Seen: 724 times

Last updated: May 22 '12 at 04:53