Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. glRotatef(xrot, 1.0f, 0.0f, 0.0);
  2. glRotatef(yrot, 0.0f, 1.0f, 0.0);
  3.  
  4. glTranslatef(-3.5f-xcam, ycam, -3.5f-zcam);
  5.  
  6. glEnable (GL_DEPTH_TEST); //enable the depth testing
  7. glEnable (GL_LIGHTING); //enable the lighting
  8. glEnable (GL_LIGHT0);
  9.  
  10. GLfloat specular[] = {1.0f-xcam, ycam+1.0, 1.0f-zcam, 1.0};
  11. glLightfv(GL_LIGHT0, GL_SPECULAR, specular);
  12.  
  13. glEnable(GL_TEXTURE_2D);
  14.  
  15. glBindTexture(GL_TEXTURE_2D, grnd);
  16.  
  17. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
  18. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
  19.  
  20. glBegin(GL_QUADS);
  21.  
  22. glTexCoord2i(0, 0);
  23. glVertex3f(0, 0, 0);
  24.  
  25. glTexCoord2i(0, 1);
  26. glVertex3f(0, 0, 7.0f);
  27.  
  28. glTexCoord2i(1, 1);
  29. glVertex3f(7.0f, 0, 7.0f);
  30.  
  31. glTexCoord2i(1, 0);
  32. glVertex3f(7.0f, 0, 0);
  33.  
  34. glEnd();
  35.  
  36. glDisable(GL_TEXTURE_2D);
  37.  
  38. glLoadIdentity();
  39.  
  40. drawVoxel(2.f, 0.f, 2.f, tex);
  41. drawVoxel(1.f, 0.f, 1.f, tex);
  42. drawVoxel(2.f, 0.f, 2.f, tex);
  43. drawVoxel(3.f, 0.f, 3.f, tex);
  44.  
  45. drawVoxel(4.f, 0.f, 4.f, tree);
  46. drawVoxel(4.f, 1.f, 4.f, tree);
  47. drawVoxel(4.f, 2.f, 4.f, tree);
  48. drawVoxel(4.f, 3.f, 4.f, tree);
  49.  
  50. test.Flip();
  51.  
  52. .
  53. .
  54. .
  55.  
  56. glBegin(GL_QUADS);
  57.  
  58. glTexCoord2i(0, 0);
  59. glNormal3f(0,1,0);
  60. glVertex3f(0, 0, 0);
  61.  
  62. glTexCoord2i(0, 1);
  63. glNormal3f(0,1,0);
  64. glVertex3f(0, 0, 7.0f);
  65.  
  66. glTexCoord2i(1, 1);
  67. glNormal3f(0,1,0);
  68. glVertex3f(7.0f, 0, 7.0f);
  69.  
  70. glTexCoord2i(1, 0);
  71. glNormal3f(0,1,0);
  72. glVertex3f(7.0f, 0, 0);
  73.  
  74. glEnd();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement