Pad struct and align on 4 byte boundary.

This commit is contained in:
Ian Curtis 2017-08-15 20:45:08 +00:00
parent eac76f0908
commit 2422caadc6
2 changed files with 2 additions and 1 deletions

View file

@ -28,6 +28,7 @@ struct Vertex
float texcoords[2]; float texcoords[2];
UINT8 color[4]; UINT8 color[4];
UINT8 fixedShade; UINT8 fixedShade;
UINT8 padding[3];
}; };
struct Poly // our polys are always 3 triangles, unlike the real h/w struct Poly // our polys are always 3 triangles, unlike the real h/w

View file

@ -289,7 +289,7 @@ void CNew3D::RenderFrame(void)
glVertexAttribPointer(m_r3dShader.GetVertexAttribPos("inNormal"), 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, normal)); glVertexAttribPointer(m_r3dShader.GetVertexAttribPos("inNormal"), 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, normal));
glVertexAttribPointer(m_r3dShader.GetVertexAttribPos("inTexCoord"), 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, texcoords)); glVertexAttribPointer(m_r3dShader.GetVertexAttribPos("inTexCoord"), 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, texcoords));
glVertexAttribPointer(m_r3dShader.GetVertexAttribPos("inColour"), 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Vertex), (void*)offsetof(Vertex, color)); glVertexAttribPointer(m_r3dShader.GetVertexAttribPos("inColour"), 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Vertex), (void*)offsetof(Vertex, color));
glVertexAttribPointer(m_r3dShader.GetVertexAttribPos("inFixedShade"), 1, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Vertex), (void*)offsetof(Vertex, fixedShade)); glVertexAttribPointer(m_r3dShader.GetVertexAttribPos("inFixedShade"), 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Vertex), (void*)offsetof(Vertex, fixedShade));
m_r3dShader.SetShader(true); m_r3dShader.SetShader(true);