   How to use VBOs without gl*Pointer() =/
  OK, so as some of you may know, my knowledge is mostly about OpenGL 1.1 (any answer about newer versions I made is because of random bits of knowledge I got around or (programmer) common sense =P). Whatever. Trying to learn VBOs for real this time. I'm writing something that should run on OpenGL 2.0 (especially since my video card doesn't support GL3 XD), but I'm trying to leave away as much deprecate content as possible.Now, the problem is, I searched about tutorials and such, but they all seem to have one issue: they use gl*Pointer() (e.g. glVertexPointer()) to tell OpenGL the layout of the data within a buffer. Those functions are deprecated in 3.0, but no matter what (I tried several search terms) I can't find any tutorial, doc or whatever that tells me what am I meant to use instead. The reference docs don't seem to help much either because, well, reference docs are to retrieve info about specific functions and are not tutorials and the like =|So, the question here is, does anybody know what am I meant to be using instead of gl*Pointer()? Or am I stuck to that if I want the code to be able to run with OpenGL 2.0? (in which case I'll just have to deal with it ._.)   
  Instead of having a single dedicated vertex stream, a single dedicated normal stream, and so on, you have a set of generic streams you can feed with any data you like. You then bind the generic streams to attributes in your vertex shader. For example, this lets you pass parametric data and generate vertices instead of passing vertex data, or you can have multiple normal or color streams to create your desired effects in the shader.So the new function is glVertexAttribPointer, and the location parameter is the location of the attrib parameter in the vertex shader as returned by glGetAttribLocation.   ;  Well, there's the glAttribPointer() function that will bind generic attributes - which all the deprecated fixed attributes now belong to.However, I'm not sure that it is supported to the same extent in OpenGL 2.x. Especially aliasing issues might arise, i.e. when a fixed attribute uses the same location as a generic one.   ;  I can think of some potential reasons to stick to the old mechanic for now: 1) Your own card doesn't support OpenGL 3.0, so you won't be able to test any of the new features for some time. It's also not supported on all platforms yet - NVdia's OpenGL drivers for Linux don't support it yet either, from what I can tell - if you care about cross-platform support, that is.2) If you're going to aim for OpenGL 2.0 or 2.1 as baseline (in order to get the most people possible to play your game, within reasons), you don't really have a reason to code around every single feature deprecated in future versions (although not relying on fixed function and especially immediate mode is a good thing). You can just code to the spec.3) I don't think you can use interleaved VBO with glVertexAttribPointer. There's no apparent mechanic for setting offsets. This is probably no big deal for you, though.   ;Quote:Original post by lightbringer3) I don't think you can use interleaved VBO with glVertexAttribPointer. There's no apparent mechanic for setting offsets. This is probably no big deal for you, though.The interleaved mechanism is exactly the same as with old pointer function; set the stride and pointer parameters.   ;  I stand corrected. :) So I guess it's something like specifying a stride larger than size*type and setting pointer to the 0th element? I should read docs more carefully.   ;Quote:Original post by lightbringerI stand corrected. :) So I guess it's something like specifying a stride larger than size*type and setting pointer to the 0th element? I should read docs more carefully.yup, the easiest way being.... struct Vertex {  float vert[3];  float norm[3];  float uv[2];};Vertex gData[VERTEX_ARRAY_SIZE] = {/*blah*/};glVertexAttribPointer(0,3,GL_FLOAT,GL_FALSE,sizeof(Vertex),gData[0].vert);glVertexAttribPointer(1,3,GL_FLOAT,GL_FALSE,sizeof(Vertex),gData[0].norm);glVertexAttribPointer(2,2,GL_FLOAT,GL_FALSE,sizeof(Vertex),gData[0].uv);;  Um, I wonder why Google completely refused to show me any tutorials using glVertexAttribPointer(), I just checked and it even works in OpenGL 2 =| Then again, even the "tutorial" in the OpenGL wiki is using glVertexPointer()...Quote:Original post by lightbringer1) Your own card doesn't support OpenGL 3.0, so you won't be able to test any of the new features for some time. It's also not supported on all platforms yet - NVdia's OpenGL drivers for Linux don't support it yet either, from what I can tell - if you care about cross-platform support, that is.My video card doesn't even support CUDA actually (it isn't a GPGPU =|) XDQuote:Original post by lightbringerif you care about cross-platform support, that is.That's one of the goals of the thing I'm writing =PQuote:Original post by lightbringer2) If you're going to aim for OpenGL 2.0 or 2.1 as baseline (in order to get the most people possible to play your game, within reasons), you don't really have a reason to code around every single feature deprecated in future versions (although not relying on fixed function and especially immediate mode is a good thing). You can just code to the spec.Well, some day OpenGL 3.0 will be more commonplace and I will want to make use of the new features when present eventually. Having as little code to rewrite as possible is a good idea, as well as non-deprecated functionality should be more supported than deprecated functionality (e.g. don't have slow performance because hardware isn't made for it).Um, and I assume that here is where I say thanks XD   ;  glVertexAttribPointer is part of GL 2.I'll update the wiki sometime.   ;  Keep in mind that the new mechanism is not very old, and since the old way is still highly usable today, the need for the new mechanism is only required if you want to go for the new 3.0 route exclusively. It's just not old enough yet for tutorials to exists in any greater extent.But check out the GLSL tutorials at Lighthouse 3D for some more modern approach. They are using features deprecated in 3.0 though, but they are mostly trivially changed to the new model. It is changes like using a generic attribute instead of the explicit color attribute. Treating the color is still the same, you just need to attach a generic stream with glVertexAttribPointer to it instead of the color stream using glColorPointer.   