Jump to content

View more

Image of the Day

Boxes as reward for our ranking mode. ヾ(☆▽☆)
#indiedev #gamedev #gameart #screenshotsaturday https://t.co/ALF1InmM7K
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

something about the Billboards

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1 Dannyli   Members   

135
Like
0Likes
Like

Posted 28 July 2013 - 09:18 AM

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);
  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  glEnable(GL_ALPHA_TEST);
  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;
  glBegin(GL_QUADS);
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
  glEnd();
  glDisable(GL_ALPHA);
  glDisable(GL_BLEND);
}

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

 



#2 RobTheBloke   Members   

2552
Like
1Likes
Like

Posted 03 August 2013 - 10:48 AM

X and Z are vectors from a rotation matrix (which you've extracted from the current modelview matrix)



#3 Dannyli   Members   

135
Like
0Likes
Like

Posted 04 August 2013 - 10:18 AM

you are right . thanks a lot






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.