sending normals and vertex data to the vertex shader using gldrawelements()

hi there,
i am trying to write a .obj loader. the most convenient way to do this would be to setup up 2 indexing buffers for 2 different sets of vertex data but internet research has led me to believe this is not possible. my questions are is this possible? And if it is how would i go about doing this? and if not, can it be done with one gldrawelements call? if not that what would be the best way to get the result i want?
thanks alot

my questions are is this possible?

Broadly speaking, no.

More specifically speaking, yes, but it requires far more work than you should bother with.

And if it is how would i go about doing this?

If you can’t be bothered to use mesh loading tools like the Open Asset Importer and must writer your own, and you can’t be bothered to do the splitting yourself, then you could do what you’re wanting by accessing your vertex and index data directly in your shader.

What I mean is that you have vertex and index data in buffer objects. You then hand those buffer objects to the shader via Buffer Textures, Image Load/Store, or Shader Storage Buffers. Your vertex shader must now use [var]gl_VertexID[/var] input to fetch indices from your index buffers, then use those indices to fetch the attributes from the vertex buffers.

Of course, you lose all automatic vertex formatting features of vertex attributes. So if you want to use packed vertex data, or use half-float attributes, you’ll have to manually unpack it in the shader. You’ll also lose the use of the post-T&L cache (since you must use non-indexed rendering, as far as the pipeline is concerned), though your memory fetches will at least use their own caches.

great ill check out open asset importer, (sounds easier :))

also one last question, can you use one indexing buffer to index into and draw from multiple vertex buffers? also, tiny question, what do i call what i describe as vertex buffers? is it vertex array objects?

also one last question, can you use one indexing buffer to index into and draw from multiple vertex buffers?

Yes. You shouldn’t need to unless you have specific needs, but yes you can. Just bind a different buffer to GL_VERTER_ARRAY before calling glVertexAttribPointer for the attributes that come from that buffer.

Or if you are able, use separate format specification, which makes the format and the source buffers entirely separate.

also, tiny question, what do i call what i describe as vertex buffers? is it vertex array objects?

No. A vertex array object is a container object that references buffer objects.

[Buffer objects](https://www.opengl.org/wiki/Buffer Object) are called buffer objects. You could call them “vertex buffers” or “vertex buffer objects”, but that suggests that they can only be used for that. Buffer objects are like pointers to memory; you can use them anywhere, for any purpose, so long as they contain data that the consuming function can work with. You can take a buffer object and use [transform feedback](https://www.opengl.org/wiki/Transform Feedback) to write to it, then use the same buffer as source data for vertex attributes.

This really should become a FAQ or Wiki entry as it’s something that there are enough questions about already.

There is a FAQ entry on this. On the Wiki. Even the Wiki’s article on Vertex Specification makes this clear. The problem is finding it. Because there are literally dozens of different ways to ask it, no search engine will return the right answer for them.

And that doesn’t even cover the general uselessness of FAQ pages. People generally feel better about having a FAQ than users do in using it. Also, the more extensive the FAQ is, the more likely that it will have such a high signal-to-noise ratio that it’s effectively impossible to find useful information. And all it takes for a FAQ to be considered useless and thus ignored by a person, is for it to fail them. Once.