Advertisement

Quads facing at the camera

Started by July 24, 2001 10:13 AM
23 comments, last by YartZ 23 years, 6 months ago
A real programmer doesn''t need documentation.
A real programmer reads source code like poetry.
A real programmer doesn''t eat quiche.



Steve ''Sly'' Williams  Code Monkey  Krome Studios
Steve 'Sly' Williams  Monkey Wrangler  Krome Studios
turbo game development with Borland compilers
does anyone have anything help-full to say ?
Advertisement
What you''re talking about is billboarding. Check this out
:

http://reality.sgi.com/blythe/sig99/advanced99/notes/node73.html
quote:
Original post by NitroGL
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);}     



What is that matrix[x] thing?

-- YartZ
I think he meant m[x] instead of matrix[x].
It works now, but not like I want it to. I need to make it like in Wolf3d or Doom.

Screenshot from my product:
http://mbnet.fi/yartz/gaeh.jpg

Now it goes around circle when its X or Z is more than 0 and I think I have to somehow lock the Y. If anyone can help me with this?

-- YartZ

Edited by - YartZ on July 26, 2001 7:02:37 PM

Edited by - YartZ on July 26, 2001 7:03:34 PM
Advertisement
quote:
Original post by Parveen Kaler
I think he meant m[x] instead of matrix[x].


Yeah, opps

I guess I missed something when I posted the code
Celeron ][ 566 @ 850256MB PC-100 CAS2 RAMDFI PA-61 Mainboard (250MB memory bandwidth sucks, it should be 500MB)ATI Radeon 32MB DDR LEWindows 98SE
If I understand, you''re saying you want it only to aim at the camera in regards to a Y-Rotation, but X and Z should be normal. (Assuming Y is up). Like Doom''s sprites. Of course, Doom had no camera rotation which would illustrate the problems in this technique...

While I think I understand the problem, I don''t know the fast efficient solution. I''m sure there''s one related to the matrix transposing technique above...
Yes, that''s excactly what I meant.

-- YartZ
Hey!
I''m writing a tutorial for NeHe which, amongst other things, adds a particle engine to lesson 10, I needed to make the particles face the camera so I will make a point of explaining it. I can only quickly tell you here how I did it but I can say off the top of my head that I used the code from lesson 10 to move forward and back. all that sin() and cos() stuff. I hacked that into the drawing code for glvertex3f in the drawing of the triangle strip. What it does is rotate the quad (by changing the coordinates appropriately) by how much YOU have turned. You''ll maybe understand in the tut .

baldurkarlsson

This topic is closed to new replies.

Advertisement