1
\$\begingroup\$

My code currently uses glBindAttribLocation and glVertexAttribPointer to specify two custom vertex attributes in indices 6 and 7. This seems to work fine, but I wish to add another attribute and no index other than 6 or 7 will work - the shader instead acts like the attribute is always set to a value of 0.

I'm using gl_Vertex, gl_Normal, gl_Color and gl_MultiTexCoord0, and apparently some nVidia thing means indices 0, 2, 3 and 8 are off limits, but that should still leave other indices. I don't use gl_SecondaryColor or gl_FogCoord anywhere in my code or shaders for example, but indices 4 and 5 still don't work.

If I change graphics cards for an ATI one which supports more than 16 attributes, then indices 16+ work fine, but I want to support cards with only 16 attributes.

\$\endgroup\$
  • \$\begingroup\$ Why are you mixing and matching fixed-function vertex pointers with generic vertex attributes in the first place? That is allowed, though inadvisable, in compatibility profiles. On modern platforms that only offer core profiles, you need to ditch that altogether and use your own generic attribute numbering convention. For portability, plan to do that now rather than later. \$\endgroup\$ – Andon M. Coleman Mar 10 '15 at 21:05
1
\$\begingroup\$

For "modern" OpenGl, it's easiest to use all "custom" attributes, instead of a mix of classic built-in ones and your own.

Add your own vec3 for "positionXyz" or whatever you'd like to call it, and so on.

(For myself, I never pre-assign locations, just let OpenGl pick them has seemed sufficient for needs.)

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.