I've tried getting billboarding to work, it seems easy enough, but no matter what I do it doesn't actually work. The bitmaps seem to somewhat turn with the camera but they are never actually completely perpendicular.
Here is what I have so far, what am I doing wrong? It's probably something incredibly obvious.
I have tried using what the original model view matrix would be and what the transpose would be. i.e:Code:void Meteor::CallDraw(){ red = (int)rand()%255; green = (int)rand()%255; blue = (int)rand()%255; float scale = 10; float MVMAT[16]; glGetFloatv(GL_MODELVIEW_MATRIX, &MVMAT[0]); //FIXME: I don't know if I need the transpose or what is going on here Vector up(MVMAT[0], MVMAT[1], MVMAT[2]); Vector right(MVMAT[4], MVMAT[5], MVMAT[6]); glPushMatrix(); glDisable(GL_LIGHTING); glEnable(GL_BLEND); glBindTexture(GL_TEXTURE_2D, texture); //THIS IS ACTUALLY THE PARTICLE TEXTURE, hmmm? glTranslatef(Position.x, Position.y, Position.z); glColor4ub(red, green, blue, transparency); glBegin(GL_QUADS); glTexCoord2f(0.0f, 0.0f); glVertex3f(Position.x + (up.x + right.x) * -scale, Position.y + (up.y + right.y) * -scale, Position.z); glTexCoord2f(1.0f, 0.0f); glVertex3f(Position.x + (-up.x + right.x) * scale, Position.y + (-up.y + right.y) * scale, Position.z); glTexCoord2f(1.0f, 1.0f); glVertex3f(Position.x + (up.x + right.x) * scale, Position.y + (up.y + right.y) * scale, Position.z); glTexCoord2f(0.0f, 1.0f); glVertex3f(Position.x + (up.x + -right.x) * scale, Position.y + (up.y + -right.y) * scale, Position.z); glEnd(); glDisable(GL_BLEND); glEnable(GL_LIGHTING); glPopMatrix(); }
Vector up(MVMAT[0], MVMAT[1], MVMAT[2]);
Vector right(MVMAT[4], MVMAT[5], MVMAT[6]);



LinkBack URL
About LinkBacks


