Jump to content
  • Advertisement
Sign in to follow this  

something about the Billboards

This topic is 2175 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

I am a novice in the tree design. I have a question about the code :

void baiscobj::ShowTree(float x,float z,float h,float s,int cactus)
{ glEnable(GL_BLEND);
  glAlphaFunc(GL_GREATER, 0);
  float mat[16];
  glGetFloatv(GL_MODELVIEW_MATRIX, mat);
  vector3_t X(mat[0], mat[4], mat[8]);
  vector3_t Z(mat[1], mat[5], mat[9]); 
  glBindTexture(GL_TEXTURE_2D, g_cactus[cactus]);
  vector3_t pos(x,0.0,-z);
  pos.y = GetHeight(x, -z) + h + s;
glTexCoord2f(0.0,0.0);glVertex3fv((pos+(X+Z)*-h).v);//left down
glTexCoord2f(1.0,0.0);glVertex3fv((pos+(X-Z)* h).v);//up down
glTexCoord2f(1.0,1.0);glVertex3fv((pos+(X+Z)* h).v);//up right
glTexCoord2f(0.0,1.0);glVertex3fv((pos+(Z-X)* h).v);//left up

why the line glVertex3fv((pos+(X+Z)*-h).v); can rotate the point? pos+(X+Z)*-h is a translation , isn't it?


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • 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!