Create Brick Textured Pyramid Opengl Code Coordinates Length Anything Q37118433

Create a brick textured pyramid in OpenGL code. Coordinates andlength can be anything.


Solution


Sol)

#ifdef __APPLE_CC__#include <GLUT/glut.h>#else#include <GL/glut.h>#endif#include <cstdlib>// Define a 2 x 2 red and yellow checkered pattern using RGB colors.#define red {0xff, 0x00, 0x00}#define yellow {0xff, 0xff, 0x00}#define magenta {0xff, 0, 0xff}GLubyte texture[][3] = { red, yellow, yellow, red,};// Fixes up camera and remaps texture when window reshaped.void reshape(int width, int height) { glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(80, GLfloat(width)/height, 1, 40); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(2, -1, 5, 0, 0, 0, 0, 1, 0);

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.