#### Archived

This topic is now archived and is closed to further replies.

# Quads facing at the camera

This topic is 6349 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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

##### Share on other sites
You can try this http://nate.scuzzy.net/docs/billboard/ and this http://nate.scuzzy.net/gltut/billboard.zip.

##### Share on other sites
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

##### Share on other sites
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);}

##### Share on other sites
ya, that''s basically what my code does, just inverts the modelview matrix.

HHSDrum@yahoo.com

##### Share on other sites
Is that faster than:

glGetFloatv(GL_MODELVIEW_MATRIX,m);
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...

##### Share on other sites
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

##### Share on other sites
Thank you verymuch. I''ll try these when I have time.

-- YartZ

hi

##### Share on other sites
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 .

1. 1
2. 2
Rutin
20
3. 3
khawk
17
4. 4
A4L
14
5. 5

• 12
• 16
• 26
• 10
• 11
• ### Forum Statistics

• Total Topics
633758
• Total Posts
3013713
×