Advertisement
Guest User

Untitled

a guest
Sep 15th, 2012
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. glBegin(GL_TRIANGLE_STRIP);
  2. for(int x = 0; x < teren->width(); x++) {
  3. //0
  4. glColor3f((unsigned char)image->pixels[3 * (z * image->width + x)]/256.0f,
  5. (unsigned char)image->pixels[3 * (z * image->width + x) + 1]/256.0f,
  6. (unsigned char)image->pixels[3 * (z * image->width + x) + 2]/256.0f);
  7. Vec3f normal = teren->getNormal(x, z);
  8. glNormal3f(normal[0], normal[1], normal[2]);
  9. glVertex3f(x, teren->getHeight(x, z), z);
  10. //1
  11. glColor3f((unsigned char)image->pixels[3 * ((z+1) * image->width + x)]/256.0f,
  12. (unsigned char)image->pixels[3 * ((z+1) * image->width + x) + 1]/256.0f,
  13. (unsigned char)image->pixels[3 * ((z+1) * image->width + x) + 2]/256.0f);
  14. normal = teren->getNormal(x, z + 1);
  15. glNormal3f(normal[0], normal[1], normal[2]);
  16. glVertex3f(x, teren->getHeight(x, z + 1), z + 1);
  17. /*//2
  18. normal = teren->getNormal(x, z + 1);
  19. glNormal3f(normal[0], normal[1], normal[2]);
  20. glVertex3f(x, teren->getHeight(x, z + 1), z);
  21. //3
  22. normal = teren->getNormal(x, z + 1);
  23. glNormal3f(normal[0], normal[1], normal[2]);
  24. glVertex3f(x + 1, teren->getHeight(x + 1, z + 1), z + 1); */
  25. }
  26. glEnd();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement