Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- glBegin(GL_TRIANGLE_STRIP);
- for(int x = 0; x < teren->width(); x++) {
- //0
- glColor3f((unsigned char)image->pixels[3 * (z * image->width + x)]/256.0f,
- (unsigned char)image->pixels[3 * (z * image->width + x) + 1]/256.0f,
- (unsigned char)image->pixels[3 * (z * image->width + x) + 2]/256.0f);
- Vec3f normal = teren->getNormal(x, z);
- glNormal3f(normal[0], normal[1], normal[2]);
- glVertex3f(x, teren->getHeight(x, z), z);
- //1
- glColor3f((unsigned char)image->pixels[3 * ((z+1) * image->width + x)]/256.0f,
- (unsigned char)image->pixels[3 * ((z+1) * image->width + x) + 1]/256.0f,
- (unsigned char)image->pixels[3 * ((z+1) * image->width + x) + 2]/256.0f);
- normal = teren->getNormal(x, z + 1);
- glNormal3f(normal[0], normal[1], normal[2]);
- glVertex3f(x, teren->getHeight(x, z + 1), z + 1);
- /*//2
- normal = teren->getNormal(x, z + 1);
- glNormal3f(normal[0], normal[1], normal[2]);
- glVertex3f(x, teren->getHeight(x, z + 1), z);
- //3
- normal = teren->getNormal(x, z + 1);
- glNormal3f(normal[0], normal[1], normal[2]);
- glVertex3f(x + 1, teren->getHeight(x + 1, z + 1), z + 1); */
- }
- glEnd();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement