Jump to content
  • Advertisement


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


3d sprites?

This topic is 5721 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
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] );


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

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

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

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


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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!