Jump to content
  • Advertisement

Archived

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

VI2

3d sprites?

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I want to use sprites in 3d space. I havn''t tried it yet but can i just set the transform z distance and get the sprite to move around in 3d space??? I''d appreciate any input on 3d sprites and what things I should avoid doing...

Share this post


Link to post
Share on other sites
Advertisement
i dunno how to get DX''s modelview matrix

but here is for OpenGL

  
glGetFloatv(GL_MODELVIEW_MATRIX, mat);

CVector3 vx(mat[0], mat[4], mat[8] );
CVector3 vy(mat[1], mat[5], mat[9] );

glBegin(GL_QUADS);
glColor4fv(color);

glTexCoord2f(0.0f, 0.0f);
tmp = (pos + (vx + vy) * -sizeX) ;
p1[0] = tmp.x; p1[1] = tmp.y; p1[2] = tmp.z;
glVertex3fv(p1);

glTexCoord2f(1.0f, 0.0f);
tmp = (pos + (vx - vy) * sizeX) ;
p2[0] = tmp.x; p2[1] = tmp.y; p2[2] = tmp.z;
glVertex3fv(p2);

glTexCoord2f(1.0f, 1.0f);
tmp = (pos + (vx + vy) * sizeX) ;
p3[0] = tmp.x; p3[1] = tmp.y; p3[2] = tmp.z;
glVertex3fv(p3);

glTexCoord2f(0.0f, 1.0f);
tmp = (pos + (vy - vx) * sizeX) ;
p4[0] = tmp.x; p4[1] = tmp.y; p4[2] = tmp.z;
glVertex3fv(p4);

glEnd();


where pos is the position in 3d space of the sprite

Share this post


Link to post
Share on other sites
I don't need to get the matrix since I have it in the first place... but how do I apply that to move and rotate my sprites in 3d space?

Do I do a normal transform before calling the render or what?

Or should I look into billboarding or some for of that...

[edited by - vi2 on April 21, 2003 11:45:35 AM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!