Quads facing at the camera

Started by
23 comments, last by YartZ 22 years, 8 months ago
Any tutorial somewhere where is explained how to make quads, triangles, polygons, whatever always facing at the camera? Or if someone can help me with this. -- YartZ
Advertisement
You can try this http://nate.scuzzy.net/docs/billboard/ and this http://nate.scuzzy.net/gltut/billboard.zip.
I recently wrote a class that uses the code from nate''s tutorial. I can send it to you, just drop me an e-mail, or you can check out nate''s source.

HHSDrum@yahoo.com
Polarisoft Home Page
My HomepageSome shoot to kill, others shoot to mame. I say clear the chamber and let the lord decide. - Reno 911
Call this just before you draw the quad:

void Billboard(void){	float temp[16]={ 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f }, m[16];	glGetFloatv(GL_MODELVIEW_MATRIX, m);	temp[0]=matrix[0];	temp[1]=matrix[4];	temp[2]=matrix[8];	temp[4]=matrix[1];	temp[5]=matrix[5];	temp[6]=matrix[9];	temp[8]=matrix[2];	temp[9]=matrix[6];	temp[10]=matrix[10];	glMultMatrixf(temp);}    
Celeron ][ 566 @ 850256MB PC-100 CAS2 RAMDFI PA-61 Mainboard (250MB memory bandwidth sucks, it should be 500MB)ATI Radeon 32MB DDR LEWindows 98SE
ya, that''s basically what my code does, just inverts the modelview matrix.

HHSDrum@yahoo.com
Polarisoft Home Page
My HomepageSome shoot to kill, others shoot to mame. I say clear the chamber and let the lord decide. - Reno 911
Is that faster than:

glGetFloatv(GL_MODELVIEW_MATRIX,m);
glLoadIdentity();
glTranslatef(m[12],m[13],m[14]);

?


Or do they do different things?



I do a LOT of these in my game, so maybe I''ll go ahead and try the other method to see if I can get a speed improvement...
I''m not sure that the elements you are changing are correct. I''m not at home now, so I can''t check, but nate inverts in one line like that in his code. to can check his code.

HHSDrum@yahoo.com
Polarisoft Home Page
My HomepageSome shoot to kill, others shoot to mame. I say clear the chamber and let the lord decide. - Reno 911
Thank you verymuch. I''ll try these when I have time.

-- YartZ
hi
i have been messing with a program for a long time & cant seem to see the problem . the blue book thingy i downloaded from the www doesnt explain what the APIs do in realistic terms so im not sure what i am doing . i want to make 3D objects from 2D polygons using the maximum amount so the objects can be taken apart . i want the polygons to always face forwards but the objects have to rotate etc. . i want to make a loop so i dont have to rewrite the gltranslate x,y,z etc. more than once . i want it to be taken care of so all i have to do is program like i am using DMA with algebra,trig,logic in masm32 with formulas .
is that @ all possible ? what is , what isint ?
> steverowe5@aol.com or hotmail
are there any more explanitory examples of these APIs ?
i am a programmer only when there is documentation that is defined or with definitions .

This topic is closed to new replies.

Advertisement