1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
void CSprite::GenerateGLDisplayList(SGfxSprite *aSprite, int aNumFrames)
{
uint displayList = glGenLists(aNumFrames);
for(int i = 0; i < aNumFrames; ++i)
{
glNewList((displayList+i), GL_COMPILE);
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glBindTexture(GL_TEXTURE_2D, aSprite->iGLTextures[i]);
glTexCoord2i(0, 0);
glVertex2f(aSprite->gfxObject->sPoly->sPosition->nX, aSprite->gfxObject->sPoly->sPosition->nY); // At the end of the loop, this is the line that seg faults. My locals/watchers are showing me that sPoly is NULL.
glTexCoord2i(1, 0);
glVertex2f(aSprite->gfxObject->sPoly->sDimensions->nX, aSprite->gfxObject->sPoly->sPosition->nY);
glTexCoord2i(1, 1);
glVertex2f(aSprite->gfxObject->sPoly->sDimensions->nX, aSprite->gfxObject->sPoly->sDimensions->nY);
glTexCoord2i(0, 1);
glVertex2f(aSprite->gfxObject->sPoly->sPosition->nX, aSprite->gfxObject->sPoly->sDimensions->nY);
glEndList();
aSprite->iFrames[i] = (displayList+i);
}
aSprite->currentFrame = 0;
}
|