Anyone know where I can find a good animated billboard tut?
I''m trying to get a animated billboard of an expolosion working.
Does anyone know of one?
Dreams arn't just dreams, They're a whole new world to play in.
Hi there!
I have a billboard tutorial that can be useful to you (But the demos are in DirectX 7.0). Anyway, the theory is cool.
Feel free to email me at gameover@vtr.net, so I can mail it to u.
[edited by - GameOverCL on December 22, 2003 11:04:17 PM]
I have a billboard tutorial that can be useful to you (But the demos are in DirectX 7.0). Anyway, the theory is cool.
Feel free to email me at gameover@vtr.net, so I can mail it to u.
[edited by - GameOverCL on December 22, 2003 11:04:17 PM]
Err... Why don''t you look up a regular billboarding tutorial (which shouldn''t have more than 10-20 lines of code) and add an animated texture to it (update the texture every n milliseconds or so). Nothing fancy...


"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
I may just be youre Santa Clause this year...
Here`s some billboarding code ->
And that`s about it... animating will be pretty much simple but that`s the hard code that no one knows
Here`s some billboarding code ->
void ResetMatrix(){//probably the key to everything float modelview[16]; int i,j; glGetFloatv(GL_MODELVIEW_MATRIX,modelview); for( i=0; i<3; i++ ) for( j=0; j<3; j++ ) { if ( i==j )//unrotate the modelview matrix-> modelview[i*4+j] = 1.0;//always face camera else modelview[i*4+j] = 0.0; } glLoadMatrixf(modelview);}/************/void Render(){glPushMatrix();glTranslatefv(ObjectPosition);glPushMatrix();ResetMatrix();//glRotatef(SomeRotationhere,0,0,1);//rotate on z axis//Render youre object here->glPopMatrix();glPopMatrix();
And that`s about it... animating will be pretty much simple but that`s the hard code that no one knows

Relative Games - My apps
Because glLoadIdentity resets rotation, scaling and translation, while cippyboy''s code effectively resets rotation (and scaling? - haven''t fully worked this through yet), leaving the translation part of the matrix intact. It looks like a neat way of doing things, but I''m not sure how robust it is (i.e. scaling e.t.c).
Enigma
Enigma
First of all it`s not me to be thanked.. I took from some site and now I`m angered because I forgot from where I took it 
but I remodeled some of it to fit for my needs, and offcourse I thought of scaling as well.
here`s a new piece of code that can effectively render a scaled particle->

but I remodeled some of it to fit for my needs, and offcourse I thought of scaling as well.
here`s a new piece of code that can effectively render a scaled particle->
void PARTICLE_SYSTEM::Render_SizedParticle(PARTICLE *MyParticle,int TID,float size){glPushMatrix();glTranslatef(MyParticle->Pos.x,MyParticle->Pos.y,MyParticle->Pos.z);glPushMatrix();ResetMatrix();glRotatef(MyParticle->rot,0,0,1);//rotate for variations and suchglActiveTextureARB(GL_TEXTURE1_ARB);glDisable(GL_TEXTURE_2D);glActiveTextureARB(GL_TEXTURE0_ARB);glEnable(GL_TEXTURE_2D);glBindTexture(GL_TEXTURE_2D,TID);glColor4f(MyParticle->Color.x,MyParticle->Color.y,MyParticle->Color.z,MyParticle->life);glBegin(GL_QUADS);glNormal3f(0.0f,0.0f,1.0f);//I don`t know how good the normalsglMultiTexCoord2fARB(GL_TEXTURE0_ARB,0.0f,0.0f);//are though...glVertex3f(-size,-size,0.0f);//but I`d recommend no lighting onglNormal3f(0.0f,0.0f,1.0f);//themglMultiTexCoord2fARB(GL_TEXTURE0_ARB,1.0f,0.0f);glVertex3f(size,-size,0.0f);glNormal3f(0.0f,0.0f,-1.0f);glMultiTexCoord2fARB(GL_TEXTURE0_ARB,1.0f,1.0f);glVertex3f(size,size,0.0f);glNormal3f(0.0f,0.0f,-1.0f);glMultiTexCoord2fARB(GL_TEXTURE0_ARB,0.0f,1.0f);glVertex3f(-size,size,0.0f);glEnd();glPopMatrix();glPopMatrix();}
Relative Games - My apps
Just wanted to thank everyone that helped, I wass able to get it working correctly. Now I just need to get the actual pictures to appear.
Dreams arn't just dreams, They're a whole new world to play in.
Ok, here's another problem. After I got the billboard to always face the player, I started to try to get the picture to work correctly, but I can't seem to figure out what the farg is wrong with my system.
Here's my code:
The pic I'm using is a 256x256 targa with 64 animation screens at 32x32 each.
Now I've been playing around with this for some time and I am about ready to scrap it altogether and start fresh, for the 10th time.
If anyone, and I mean anyone has any ideas of what I'm doing wrong, PLEASE tell me.
[edited by - Steelrose on December 26, 2003 11:36:01 PM]
Here's my code:
bool EXPLOSION::ExplosionInit(GLvoid) { float cx=0; float cy=0; float loopx,loopy,padx,pady; int loop = 0; if (!file.LoadTGAFile("Art\\explosion1.tga"))//, GL_LINEAR, GL_LINEAR)) return false; boom=glGenLists(64); //Creating a display list that can hold 64 glBindTexture(GL_TEXTURE_2D, file.ID); //Bind our explosion texture padx = (1/(float)file.imageWidth)*32; pady = (1/(float)file.imageHeight)*32; loopx = (1/(float)file.imageWidth)*31; loopy = (1/(float)file.imageHeight)*31; for(cy=0.0f; cy<file.imageHeight; cy+=pady) //Loop through the display list { for(cx=0.0f; cx<file.imageWidth; cx+=padx) { glNewList(boom+loop,GL_COMPILE); //Start building a list glBegin(GL_TRIANGLE_STRIP); //Use a quad for each character //Top right (tex/vertex) coordinates glTexCoord2f( (cx+loopx), (cy+loopy)); glVertex2f(1.0f,1.0f); //Top left (tex/vertex) coordinates glTexCoord2f( (cx), (cy+loopy)); glVertex2f(0.0f,1.0f); //Bottom right (tex/vertex) coordinates glTexCoord2f( (cx+loopx), (cy)); glVertex2f(1.0f,0.0f); //Bottom left (tex/vertex) coordinates glTexCoord2f( (cx), (cy)); glVertex2f(0.0f,0.0f); glEnd(); //Done Building Our Quad (Character) glEndList(); //Done Building The Display List loop++; } } // Loop Until All 64 Are Built return true;}
The pic I'm using is a 256x256 targa with 64 animation screens at 32x32 each.
Now I've been playing around with this for some time and I am about ready to scrap it altogether and start fresh, for the 10th time.
If anyone, and I mean anyone has any ideas of what I'm doing wrong, PLEASE tell me.
[edited by - Steelrose on December 26, 2003 11:36:01 PM]
Dreams arn't just dreams, They're a whole new world to play in.
Check your for-loops. The test is wrong (they loop too many times). Also your triangle strips are wrong - swap the order of the last two vertices. Also you shouldn't need loopx and loopy - just use padx and pady - unless you have a border between animation frames in your image.
Enigma
EDIT: triangle strips were correct - don't know what I was thinking!
[edited by - Enigma on December 28, 2003 8:13:52 AM]
Enigma
EDIT: triangle strips were correct - don't know what I was thinking!
[edited by - Enigma on December 28, 2003 8:13:52 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement