Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


OpenGL 4 and Index Buffer


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Atemu   Members   -  Reputation: 232

Like
0Likes
Like

Posted 13 January 2014 - 06:52 AM

Hey,

 

I'm following a tutorial about OpenGL 4 and the author always use glDrawArrays (with simple shape) but I'm wondering how he could draw complex shape without using any Index Buffer ?



Sponsor:

#2 haegarr   Crossbones+   -  Reputation: 4437

Like
0Likes
Like

Posted 13 January 2014 - 07:02 AM

glDrawArrays can be used for meshes of any complexity. Indexing is just a vehicle that helps in certain situations to improve performance. A code snippet w/o indexing looks less cluttered, so it may be meant to be better suited for demonstration purposes as occurs in such a tutorial (assuming that the attention is on something else, of course).



#3 richardurich   Members   -  Reputation: 1187

Like
0Likes
Like

Posted 13 January 2014 - 07:57 AM

The only thing you wind up doing if you don't have an index buffer is repeating vertex data. Unless that is causing your program to bottleneck, it really doesn't matter that you're repeating the vertex data. Index buffers just add a layer of indirection like pointers do for normal code.

 

Whether you use index buffers or duplicate data a bit, it probably won't matter. Odds are pretty good you won't meaningfully impact your end result either way since you're probably not trying to make a AAA title. If you ever do need to optimize, you might just do it in different places for each approach.

 

Most people don't even have noticeable performance issues when using TRIANGLE_LIST or such until they are well into development, and in that situation you're talking almost 2/3 of the data being duplicated for no benefit.



#4 Atemu   Members   -  Reputation: 232

Like
0Likes
Like

Posted 13 January 2014 - 04:27 PM

Alright, thanks for your answers :)



#5 Kaptein   Prime Members   -  Reputation: 2175

Like
0Likes
Like

Posted 18 January 2014 - 08:40 PM

if you are using complex models, and they are indexable - use it

if you have a flat-ish world that uses normals that are weighted - use it

otherwise, just stay away from indexing

if your meshes aren't indexable to a larger degree, you will likely just incur a performance loss

 

the thing that matters the most is reusing indices to the maximum degree, and that is something you really want a mesh generator for

you can also google the subject as there are various methods to generating heightmapped terrain with varying degrees of effectiveness vs generation speed

 

in the end it doesn't really matter much.. maybe its 15 fps at some extreme

 

also, use a profiler if you can :) you'd be surprised at what REALLY chopped your fps in half :D






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS