Correct the alias vertex data types.

Vertex locations need to be unsigned byte rather than byte (GL is funy
with that). s and t need to be at least short, and since the normal index
is embedded in the st vector, it needs to be the same type. With this, my
test tetrahedrons seem to be working.
This commit is contained in:
Bill Currie 2012-01-02 23:27:46 +09:00
parent c378acab6b
commit baab15279f
2 changed files with 3 additions and 3 deletions

View file

@ -33,7 +33,7 @@
typedef struct aliasvrt_s { typedef struct aliasvrt_s {
byte vertex[3]; byte vertex[3];
byte stn[3]; short stn[3];
} aliasvrt_t; } aliasvrt_t;
void R_InitAlias (void); void R_InitAlias (void);

View file

@ -204,10 +204,10 @@ R_DrawAlias (void)
qfglUniformMatrix4fv (quake_mdl.mvp_matrix.location, 1, false, mvp_mat); qfglUniformMatrix4fv (quake_mdl.mvp_matrix.location, 1, false, mvp_mat);
qfglUniformMatrix3fv (quake_mdl.norm_matrix.location, 1, false, norm_mat); qfglUniformMatrix3fv (quake_mdl.norm_matrix.location, 1, false, norm_mat);
qfglVertexAttribPointer (quake_mdl.vertex.location, 3, GL_BYTE, qfglVertexAttribPointer (quake_mdl.vertex.location, 3, GL_UNSIGNED_BYTE,
0, sizeof (aliasvrt_t), 0, sizeof (aliasvrt_t),
pose + field_offset (aliasvrt_t, vertex)); pose + field_offset (aliasvrt_t, vertex));
qfglVertexAttribPointer (quake_mdl.vertex.location, 3, GL_BYTE, qfglVertexAttribPointer (quake_mdl.stn.location, 3, GL_SHORT,
0, sizeof (aliasvrt_t), 0, sizeof (aliasvrt_t),
pose + field_offset (aliasvrt_t, stn)); pose + field_offset (aliasvrt_t, stn));
qfglDrawElements (GL_TRIANGLES, hdr->mdl.numtris, GL_UNSIGNED_SHORT, 0); qfglDrawElements (GL_TRIANGLES, hdr->mdl.numtris, GL_UNSIGNED_SHORT, 0);