yea, I got it working finally at about midnight last night. Thanks for you help though, I didn''t notice the for loops until after you had mentioned them. Turns out I was also declaring the object twice in my program so it was apperently using both, or something.
laters.
Anyone know where I can find a good animated billboard tut?
How quick is that algorithm? Is it feasable to use it with a particle engine?
edit:
Ah, I could just have it so it just unrotates for the centre of the particle engine then go from there - that'd work wouldn't it? Hmm, probably not for close up - it may look a bit funny. But hey, it'd look better than and be quicker than doing the particle twice/3 times at right angles! Anyway, back to the original q, is it feasable to do it with every particle?
[edited by - strider44 on December 29, 2003 6:40:18 AM]
edit:
Ah, I could just have it so it just unrotates for the centre of the particle engine then go from there - that'd work wouldn't it? Hmm, probably not for close up - it may look a bit funny. But hey, it'd look better than and be quicker than doing the particle twice/3 times at right angles! Anyway, back to the original q, is it feasable to do it with every particle?
[edited by - strider44 on December 29, 2003 6:40:18 AM]
The Love Of Trees
The algorithm itself seems pritty quick. all it does is resets 9 values to 1 or 0, so I'm guessing it'd be fast enough for you.
edit:
I haven't done the processor tick count but I'm guessing that the whole process takes less than 100 cycles to preform.
[edited by - Steelrose on December 29, 2003 11:23:09 AM]
edit:
I haven't done the processor tick count but I'm guessing that the whole process takes less than 100 cycles to preform.
[edited by - Steelrose on December 29, 2003 11:23:09 AM]
Dreams arn't just dreams, They're a whole new world to play in.
hmm, I still might do it just once because I don't really want to use 240 000 cycles per frame to have it absolutely perfect 
Hmm, it doesn't seem to work with gluLookAt(); - it does all these wierd things, is there some modification that I could do or do I have to get the vector etc?
[edited by - strider44 on December 31, 2003 9:59:31 PM]

Hmm, it doesn't seem to work with gluLookAt(); - it does all these wierd things, is there some modification that I could do or do I have to get the vector etc?
[edited by - strider44 on December 31, 2003 9:59:31 PM]
The Love Of Trees
I''m not sure why you would use glulookat with this setup. Basicly what it does is take a quad and makes it face the camera at all times. Glulookat, if I remember correctly (tell me if I''m wrong), only applies to the camera and where the camera is facing.
Dreams arn't just dreams, They're a whole new world to play in.
*shrug* I don''t really have an idea what you''re talking about but you sound like you know. I might just try getting the camera vector and doing the triangle from there.
The Love Of Trees
Please don''t take this the wrong way, but I''m thinking that you are misunderstanding the usage of billboards.
Follow this link to get a complete understanding of what billboards do and how useful they can be.
http://www.lighthouse3d.com/opengl/billboarding/
This should get you going, it did me.
Follow this link to get a complete understanding of what billboards do and how useful they can be.
http://www.lighthouse3d.com/opengl/billboarding/
This should get you going, it did me.
Dreams arn't just dreams, They're a whole new world to play in.
I know what billboarding is, I am just wanting to use it so I can use gluLookAt(); to render the rest of the scene and have the particles at a certain location always facing the camera as sprites. I think I''ll have to do it by hand - get the vector from the camera and do a bit of algebra to work out what orientation I''ll need for the camera.
The Love Of Trees
i don''t think doing matrix manipulation per particle is the best way to deal with this. i used to do something similar then switched to grabbing the matrix once and computing my own vertices for the particle corners and things were much, much faster.
float matrix[16];
glGetFloatv(GL_MODELVIEW_MATRIX,matrix);
x0 = matrix[0] - matrix[1];
x1 = matrix[0] + matrix[1];
y0 = matrix[4] - matrix[5];
y1 = matrix[4] + matrix[5];
z0 = matrix[8] - matrix[9];
z1 = matrix[8] + matrix[9];
loop thru paricles:
glBegin(GL_QUADS);
glVertex3f(particle.x - x1*radius, particle.y - y1*radius, particle.z - z1*radius);
glVertex3f(particle.x + x0*radius, particle.y + y0*radius, particle.z + z0*radius);
glVertex3f(particle.x + x1*radius, particle.y + y1*radius, particle.z + z1*radius);
glVertex3d(particle.x - x0*radius, particle.y - y0*radius, particle.z - z0*radius);
glEnd();
note: this code might not work as is since it was ripped and re-interpreted for simplicity, but it''s the general idea...
float matrix[16];
glGetFloatv(GL_MODELVIEW_MATRIX,matrix);
x0 = matrix[0] - matrix[1];
x1 = matrix[0] + matrix[1];
y0 = matrix[4] - matrix[5];
y1 = matrix[4] + matrix[5];
z0 = matrix[8] - matrix[9];
z1 = matrix[8] + matrix[9];
loop thru paricles:
glBegin(GL_QUADS);
glVertex3f(particle.x - x1*radius, particle.y - y1*radius, particle.z - z1*radius);
glVertex3f(particle.x + x0*radius, particle.y + y0*radius, particle.z + z0*radius);
glVertex3f(particle.x + x1*radius, particle.y + y1*radius, particle.z + z1*radius);
glVertex3d(particle.x - x0*radius, particle.y - y0*radius, particle.z - z0*radius);
glEnd();
note: this code might not work as is since it was ripped and re-interpreted for simplicity, but it''s the general idea...
quote:
Original post by miles vignol
i don''t think doing matrix manipulation per particle is the best way to deal with this. i used to do something similar then switched to grabbing the matrix once and computing my own vertices for the particle corners and things were much, much faster.
float matrix[16];
glGetFloatv(GL_MODELVIEW_MATRIX,matrix);
x0 = matrix[0] - matrix[1];
x1 = matrix[0] + matrix[1];
y0 = matrix[4] - matrix[5];
y1 = matrix[4] + matrix[5];
z0 = matrix[8] - matrix[9];
z1 = matrix[8] + matrix[9];
loop thru paricles:
glBegin(GL_QUADS);
glVertex3f(particle.x - x1*radius, particle.y - y1*radius, particle.z - z1*radius);
glVertex3f(particle.x + x0*radius, particle.y + y0*radius, particle.z + z0*radius);
glVertex3f(particle.x + x1*radius, particle.y + y1*radius, particle.z + z1*radius);
glVertex3d(particle.x - x0*radius, particle.y - y0*radius, particle.z - z0*radius);
glEnd();
note: this code might not work as is since it was ripped and re-interpreted for simplicity, but it''s the general idea...
Ya man! worked for me, i just scraped my billboard code that i had infavour of your optimization. Kudos!! =)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement