VBO / IBO Woes

Started by
12 comments, last by PaladinOfKaos 13 years, 8 months ago
Any particular reason why you're using classes instead of structs here?

Anyway - and I don't have an authoritative source on this, but - I strongly suspect (based on a hunch coming from my knowledge of D3D) that padding at the end is OK but padding at the beginning is not. To be honest I'm slightly confused as to why you would need to pad at the beginning.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

Advertisement
There's no reason for classes over structs. These should probably be structs as they have no member functions and are simply described. In my case, my padding (the two ints) actually had some weight data which is used in animation. i wanted my vertex structure storage to mimic carmack's. there is no specific reason why i need to have the ints in the beginning of the structure -- it's just that it really eerked me out that the program would run or crash depending on the order I defined variables.
"a low level aho master like you couldn't kill me even if I let you"
@Uthman:

Glad to see I've been able to help. But right now I am curious, why do you need other attributes besides your fixed pipeline ones, since you wont be able to use them at all?

Unless your stuffA is private data for your management, in which case you are uploading on default attributes wrong data, which is not a good idea from my point of view.

@mhagain:

With generic attributes you may use padding wherever you want, there are no restrictions at all as there is no restriction to attribute order.
EDIT: just saw that you actually sorted the element buffer offset issue out (I missed that line between everone complaining about your data formatting). I really don't know why it should be crashing based on where you position the padding, unless you're not allocating enough space in your VBO in the first place, in which case the final element could overrun depending on where the padding is? Generic attributes don't care about offsets (in theory, at any rate).

This topic is closed to new replies.

Advertisement