bool has_gen_attrs = false;
for(const unsigned char *c=format.begin(); c!=format.end(); ++c)
{
- if(*c>=TEXCOORD1+4 && *c<ATTRIB1)
+ if(*c>=TEXCOORD1+4 && *c<=TEXCOORD4+12)
has_multitex = true;
if(*c>=ATTRIB1)
has_gen_attrs = true;
if(!en)
glEnableClientState(GL_COLOR_ARRAY);
}
- else if(*c>=TEXCOORD1 && *c<=TEXCOORD4+28)
+ else if(*c>=TEXCOORD1 && *c<=TEXCOORD4+12)
{
t -= get_component_type(TEXCOORD1);
if(t>0 || active_tex)
}
else
{
- t -= get_component_type(ATTRIB1);
+ if(t>=get_component_type(ATTRIB1))
+ t -= get_component_type(ATTRIB1);
glVertexAttribPointer(t, sz, GL_FLOAT, false, bpv, base+offset);
if(!en)
glEnableVertexAttribArray(t);
glDisableClientState(GL_NORMAL_ARRAY);
else if(i==get_component_type(COLOR4_FLOAT))
glDisableClientState(GL_COLOR_ARRAY);
- else if(i>=get_component_type(TEXCOORD1) && i<=get_component_type(TEXCOORD1)+7)
+ else if(i>=get_component_type(TEXCOORD1) && i<=get_component_type(TEXCOORD1)+3)
{
unsigned j = i-get_component_type(TEXCOORD1);
if(j>0 || active_tex)
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
active_tex = j;
}
+ else if(i<get_component_type(ATTRIB1))
+ glDisableVertexAttribArray(i);
else
glDisableVertexAttribArray(i-get_component_type(ATTRIB1));
}
const Vector4 *v = 0;
if(t==get_component_type(VERTEX3))
v = &ver;
- else if(*c>=TEXCOORD1 && *c<=TEXCOORD4+28)
+ else if(*c>=TEXCOORD1 && *c<=TEXCOORD4+12)
v = &texc[t-get_component_type(TEXCOORD1)];
else if(*c>=ATTRIB1)
v = &attr[t-get_component_type(ATTRIB1)];
+ else
+ v = &attr[t];
*ptr++ = v->x;
if(sz>=2) *ptr++ = v->y;
if(sz>=3) *ptr++ = v->z;
namespace Msp {
namespace GL {
+/** A single vertex component. Nvidia drivers have aliasing between the
+fixed-functions and generic vertex attributes, despite the standard not
+allowing it. We use the same attribute indices here to avoid problems. */
enum VertexComponent
{
VERTEX2 = 1,
VERTEX3,
VERTEX4,
- NORMAL3 = 6,
- COLOR4_UBYTE = 8,
- COLOR3_FLOAT = 10,
+ NORMAL3 = 10,
+ COLOR4_UBYTE = 12,
+ COLOR3_FLOAT = 14,
COLOR4_FLOAT,
- TEXCOORD1 = 12,
+ TEXCOORD1 = 32,
TEXCOORD2,
TEXCOORD3,
TEXCOORD4,
- ATTRIB1 = 44,
+ ATTRIB1 = 64,
ATTRIB2,
ATTRIB3,
ATTRIB4