Guest User

Untitled

a guest
Aug 17th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. void RenderVertexForGL (const CVertex & v)
  2. {
  3.     glColor4f (v.m_Color.r, v.m_Color.g, v.m_Color.b, v.m_Color.a);
  4.     glTexCoord2f (v.m_TexCoord.x, v.m_TexCoord.y);
  5.     glNormal3f (v.m_Normal.x, v.m_Normal.y, v.m_Normal.z);
  6.     glVertex3f (v.m_Position.x, v.m_Position.y, v.m_Position.z);
  7. }
  8.  
  9. void CTerrain::Render ()       
  10. {
  11.     // ...
  12.  
  13.     //  Render the terrain
  14.     //  y
  15.     for (int i = 0; i < size-1; i++)
  16.     {
  17.         glBegin (GL_TRIANGLE_STRIP);
  18.         //glBegin (GL_LINES);
  19.         //  x
  20.         for (int ii = 0; ii < size; ii++)
  21.         {
  22.             const CVertex
  23.                 & v1 = vertices [size*i + ii],
  24.                 & v2 = vertices [size*(i+1) + ii];
  25.    
  26.             RenderVertexForGL (v1);
  27.             RenderVertexForGL (v2);
  28.         }
  29.         glEnd ();
  30.     }
  31.  
  32.     // ...
  33. }
Add Comment
Please, Sign In to add comment