0

Im having a strange problem where all my models but one are rendering properly. When i changed my models from using shared vertices (set of vertices + indexing array) to using duplicated vertices (needed to do this to be able to texture my models), all my models worked fine when using shared vertices. When i made the swap to duplicated vertices, all of them work except one of my models and i cant figure out why. coincidently it is the model with the highest number of vertices (20 when shared, 108 when duplicated) so maybe it has something to do with that.

what i have done so far to try rectify this issue:

  • recreated the model from scratch (which is an easy task since its a very simple model)
  • new model doesnt render properly, changed the model back to shared vertices, works again (cant texture it like this though so doesnt help)
  • changed my indexing array from GLubyte to GLushort incase there was some datatype issue
  • played around with the draw order of the indexing array to see if it was some kind of triangle winding issue, which doesnt seem to be the case (took off back face culling to check as well)

All my models are basic shapes, pyramid, cube... up to an icosahedron. The dodecahedron is the shape that is giving the problems (looks like a 12 sided dice). When it is rendered only about 8 of the 36 triangles that are needed to draw the shape show up, the rest are transparent or not there at all. I've made all my models the same way using SoftImage, so i dont really think its something to do with the model itself. On the triangles that are visible the texture shows up correct. All the models are present on the screen at the same time, so that can rule out anything that could be not specific to rendering the models. They also use the same functions to render, just have different arrays.

any suggestions for what steps i can take to find out what could be causing this?

here is what the model looks like using duplicated vertices http://pastebin.com/2hg7D0Ga here is with shared http://pastebin.com/tUqTUM91

maybe if you have something that can render models like these you can test them quickly in your application and see if it works for you

here is my relevant rendering code http://pastebin.com/fRiKM89M

this is what the model looks like when its not rendering properly https://i.stack.imgur.com/grbw6.jpg

I hope someone can spot something that i have overlooked. Thanks for taking the time to read through all this if you have made it this far

Fonix
  • 11,447
  • 3
  • 45
  • 74
  • I'm afraid there's no answerable question here. We can't really guess why your code might not work without seeing any code. If you need help you'll have to format it into a proper question (**relevant** code + model data + images would be helpful). – Tim Aug 22 '12 at 16:42
  • ok ill try muster something up – Fonix Aug 22 '12 at 16:43

1 Answers1

0

Ok I feel kind of stupid now, but it was an honest mistake. If you look in my code, where I have NumVertices etc, those are all GLubytes, which I completely forgot, I was assuming I had defined them as int's. So on the one model which had the most vertices, the number was exceeding the GLubyte max of 255, but none of the other models were.

Really simple fix for such a complicated error wow! When OpenGL breaks it always makes you think something really technical has gone wrong and you overlook the simple problems

Fonix
  • 11,447
  • 3
  • 45
  • 74