Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Jajko2.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <windows.h>
- #include <gl/gl.h>
- #include <gl/glut.h>
- #include <math.h>
- #include <stdio.h>
- #include <cstdlib>
- #include <time.h>
- #include <vector>
- enum DisplayMode {
- Vertex = 1,
- Net = 2,
- Solid = 3
- };
- enum MouseStatus
- {
- NoAction = 0,
- LeftButtonPressed = 1,
- RightButtonPressed = 2,
- MiddleButtonPressed = 3
- };
- enum LightStatus
- {
- Light0 = 0,
- Light1 = 1
- };
- static GLfloat y = 1.0, x = 1.0;
- using namespace std;
- typedef float point3[3];
- typedef float point2[2];
- typedef float color3[3];
- const float pi = acos(-1.0);
- int N = 20;
- static GLfloat viewer[] = { 0.0, 0.0, 10.0 };
- static GLfloat light0[] = { 0.0, 0.0, 5.0, 1.0 };
- static GLfloat light1[] = { 5.0, 0.0, 10.0, 1.0 };
- point3** model;
- color3** colors;
- point3** lights;
- point2** textures;
- static GLfloat theta_zoom = 20.0;
- static GLfloat theta = 0.0; // kąt obrotu obiektu
- static GLfloat theta_y = 0.0;
- static GLfloat theta_x_light0 = 0.0;
- static GLfloat theta_y_light0 = 0.0;
- static GLfloat theta_x_light1 = 0.0;
- static GLfloat theta_y_light1 = 0.0;
- static GLfloat pix2angle; // przelicznik pikseli na stopnie
- static GLfloat pix2angleVert;
- static MouseStatus status = NoAction;
- static LightStatus lightNo = Light0;
- static int x_pos_old = 0;
- static int delta_x = 0;
- static int y_pos_old = 0;
- static int delta_y = 0;
- static int zoom_old = 0;
- static int delta_zoom = 0;
- static int light_x_pos_old0 = 0;
- static int delta_x_light0 = 0;
- static int light_y_pos_old0 = 0;
- static int delta_y_light0 = 0;
- static int light_x_pos_old1 = 0;
- static int delta_x_light1 = 0;
- static int light_y_pos_old1 = 0;
- static int delta_y_light1 = 0;
- void PrepareModel();
- void DrawEgg();
- DisplayMode displayMode = Solid;
- GLbyte *LoadTGAImage(const char *FileName, GLint *ImWidth, GLint *ImHeight, GLint *ImComponents, GLenum *ImFormat)
- {
- /*************************************************************************************/
- // Struktura dla nagłówka pliku TGA
- #pragma pack(1)
- typedef struct
- {
- GLbyte idlength;
- GLbyte colormaptype;
- GLbyte datatypecode;
- unsigned short colormapstart;
- unsigned short colormaplength;
- unsigned char colormapdepth;
- unsigned short x_orgin;
- unsigned short y_orgin;
- unsigned short width;
- unsigned short height;
- GLbyte bitsperpixel;
- GLbyte descriptor;
- }TGAHEADER;
- #pragma pack(8)
- FILE *pFile;
- TGAHEADER tgaHeader;
- unsigned long lImageSize;
- short sDepth;
- GLbyte *pbitsperpixel = NULL;
- /*************************************************************************************/
- // Wartości domyślne zwracane w przypadku błędu
- *ImWidth = 0;
- *ImHeight = 0;
- *ImFormat = GL_BGR_EXT;
- *ImComponents = GL_RGB8;
- fopen_s(&pFile, FileName, "rb");
- if (pFile == NULL)
- return NULL;
- /*************************************************************************************/
- // Przeczytanie nagłówka pliku
- fread(&tgaHeader, sizeof(TGAHEADER), 1, pFile);
- /*************************************************************************************/
- // Odczytanie szerokości, wysokości i głębi obrazu
- *ImWidth = tgaHeader.width;
- *ImHeight = tgaHeader.height;
- sDepth = tgaHeader.bitsperpixel / 8;
- /*************************************************************************************/
- // Sprawdzenie, czy głębia spełnia założone warunki (8, 24, lub 32 bity)
- if (tgaHeader.bitsperpixel != 8 && tgaHeader.bitsperpixel != 24 && tgaHeader.bitsperpixel != 32)
- return NULL;
- /*************************************************************************************/
- // Obliczenie rozmiaru bufora w pamięci
- lImageSize = tgaHeader.width * tgaHeader.height * sDepth;
- /*************************************************************************************/
- // Alokacja pamięci dla danych obrazu
- pbitsperpixel = (GLbyte*)malloc(lImageSize * sizeof(GLbyte));
- if (pbitsperpixel == NULL)
- return NULL;
- if (fread(pbitsperpixel, lImageSize, 1, pFile) != 1)
- {
- free(pbitsperpixel);
- return NULL;
- }
- /*************************************************************************************/
- // Ustawienie formatu OpenGL
- switch (sDepth)
- {
- case 3:
- *ImFormat = GL_BGR_EXT;
- *ImComponents = GL_RGB8;
- break;
- case 4:
- *ImFormat = GL_BGRA_EXT;
- *ImComponents = GL_RGBA8;
- break;
- case 1:
- *ImFormat = GL_LUMINANCE;
- *ImComponents = GL_LUMINANCE8;
- break;
- };
- fclose(pFile);
- return pbitsperpixel;
- }
- auto FunX = [](float u, float v)
- {
- return (-90 * pow(u, 5) + 225 * pow(u, 4) - 270 * pow(u, 3) + 180 * pow(u, 2) - 45 * u) * cos(pi * v);
- };
- auto FunY = [](float u, float v)
- {
- return 160 * pow(u, 4) - 320 * pow(u, 3) + 160 * pow(u, 2);
- };
- auto FunZ = [](float u, float v)
- {
- return (-90 * pow(u, 5) + 225 * pow(u, 4) - 270 * pow(u, 3) + 180 * pow(u, 2) - 45 * u) * sin(pi * v);
- };
- float SpectX(int rotX, int rotY)
- {
- return theta_zoom * cos(rotX) * cos(rotY);
- };
- float SpectY(int rotY)
- {
- return theta_zoom * sin(rotY);
- };
- float SpectZ(int rotX, int rotY)
- {
- return theta_zoom * sin(rotX) * cos(rotY);
- };
- GLfloat* GetNormalVector(float u, float v)
- {
- float lxu = (-450 * pow(u, 4) + 900 * pow(u, 3) - 810 * pow(u, 2) + 360 * u - 45) * cos(pi * v);
- float lxv = pi * (90 * pow(u, 5) - 225 * pow(u, 4) + 270 * pow(u, 3) - 180 * pow(u, 2) + 45 * u) * sin(pi * v);
- float lyu = 640 * pow(u, 3) - 960 * pow(u, 2) + 320 * u;
- float lyv = 0;
- float lzu = (-450 * pow(u, 4) + 900 * pow(u, 3) - 810 * pow(u, 2) + 360 * u - 45) * sin(pi * v);
- float lzv = -pi * (90 * pow(u, 5) - 225 * pow(u, 4) + 270 * pow(u, 3) - 180 * pow(u, 2) + 45 * u) * cos(pi * v);
- GLfloat* res = new GLfloat[2];
- res[0] = lyu * lzv - lzu * lyv;
- res[1] = lzu * lxv - lxu * lzv;
- res[2] = lxu * lyv - lyu * lxv;
- float vectorLength = sqrtf(powf(res[0], 2) + powf(res[1], 2) + powf(res[2], 2));
- for (auto i = 0; i < 3; i++)
- res[i] = res[i] / vectorLength;
- return res;
- };
- void Axes(void)
- {
- point3 x_min = { -5.0, 0.0, 0.0 };
- point3 x_max = { 5.0, 0.0, 0.0 };
- point3 y_min = { 0.0, -5.0, 0.0 };
- point3 y_max = { 0.0, 5.0, 0.0 };
- point3 z_min = { 0.0, 0.0, -5.0 };
- point3 z_max = { 0.0, 0.0, 5.0 };
- glColor3f(1.0f, 0.0f, 0.0f); // kolor rysowania osi - czerwony
- glBegin(GL_LINES); // rysowanie osi x
- glVertex3fv(x_min);
- glVertex3fv(x_max);
- glEnd();
- glColor3f(0.0f, 1.0f, 0.0f); // kolor rysowania - zielony
- glBegin(GL_LINES); // rysowanie osi y
- glVertex3fv(y_min);
- glVertex3fv(y_max);
- glEnd();
- glColor3f(0.0f, 0.0f, 1.0f); // kolor rysowania - niebieski
- glBegin(GL_LINES); // rysowanie osi z
- glVertex3fv(z_min);
- glVertex3fv(z_max);
- glEnd();
- }
- void RenderScene(void)
- {
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- // Czyszczenie okna aktualnym kolorem czyszcz�cym
- glLoadIdentity();
- // Czyszczenie macierzy bie��cej
- Axes();
- glColor3f(1.0f, 1.0f, 1.0f);
- if (status == LeftButtonPressed)
- {
- if (delta_x != 0)
- theta += delta_x * pix2angle * 0.01;
- if (delta_y != 0)
- theta_y += delta_y * pix2angleVert * 0.01;
- } // do różnicy położeń kursora myszy
- if (status == RightButtonPressed)
- {
- theta_zoom += delta_zoom * 0.1;
- }
- if (status == MiddleButtonPressed)
- {
- if (lightNo == Light0)
- {
- if (delta_x_light0 != 0)
- theta_x_light0 += delta_x_light0 * pix2angle * 0.01;
- if (delta_y_light0 != 0)
- theta_y_light0 += delta_y_light0 * pix2angleVert * 0.01;
- }
- else if (lightNo == Light1)
- {
- if (delta_x_light1 != 0)
- theta_x_light1 += delta_x_light1 * pix2angle * 0.01;
- if (delta_y_light1 != 0)
- theta_y_light1 += delta_y_light1 * pix2angleVert * 0.01;
- }
- }
- if (theta_y > 2 * pi) theta_y -= 2 * pi;
- else if (theta_y <= -2 * pi) theta_y += 2 * pi;
- if (theta_y < pi / 2 || theta_y > 2 * pi - pi / 2) {
- y = -1.0;
- }
- else y = 1.0;
- if (theta_zoom < 10) theta_zoom = 10;
- if (theta_zoom > 30) theta_zoom = 30;
- //viewer[0] = SpectX(theta, theta_y);
- viewer[0] = theta_zoom * cos(theta) * cos(theta_y);
- //viewer[1] = SpectY(theta_y);
- viewer[1] = theta_zoom * sin(theta_y);
- //viewer[2] = SpectZ(theta, theta_y);
- viewer[2] = theta_zoom * sin(theta) * cos(theta_y);
- if (lightNo == Light0) {
- light0[0] = theta_zoom * cos(theta_x_light0) * cos(theta_y_light0);
- light0[1] = theta_zoom * sin(theta_y_light0);
- light0[2] = theta_zoom * sin(theta_x_light0) * cos(theta_y_light0);
- glLightfv(GL_LIGHT0, GL_POSITION, light0);
- }
- else if (lightNo == Light1)
- {
- light1[0] = theta_zoom * cos(theta_x_light1) * cos(theta_y_light1);
- light1[1] = theta_zoom * sin(theta_y_light1);
- light1[2] = theta_zoom * sin(theta_x_light1) * cos(theta_y_light1);
- glLightfv(GL_LIGHT1, GL_POSITION, light1);
- }
- gluLookAt(viewer[0], viewer[1], viewer[2], 0.0, 0.0, 0.0, 0.0, y, 0.0);
- // Zdefiniowanie położenia obserwatora
- // Narysowanie osi przy pomocy funkcji zdefiniowanej wy�ej
- DrawEgg();
- glFlush();
- // Przekazanie polece� rysuj�cych do wykonania
- glutSwapBuffers();
- //
- }
- void ChangeSize(GLsizei horizontal, GLsizei vertical)
- {
- pix2angle = 360.0 / static_cast<float>(horizontal); // przeliczenie pikseli na stopnie
- pix2angleVert = 360.0 / static_cast<float>(vertical);
- glMatrixMode(GL_PROJECTION);
- // Przełączenie macierzy bieżącej na macierz projekcji
- glLoadIdentity();
- // Czyszcznie macierzy bieżącej
- gluPerspective(70, 1.0, 1.0, 30.0);
- // Ustawienie parametrów dla rzutu perspektywicznego
- if (horizontal <= vertical)
- glViewport(0, (vertical - horizontal) / 2, horizontal, horizontal);
- else
- glViewport((horizontal - vertical) / 2, 0, vertical, vertical);
- // Ustawienie wielkości okna okna widoku (viewport) w zależności
- // relacji pomiędzy wysokością i szerokością okna
- glMatrixMode(GL_MODELVIEW);
- // Przełączenie macierzy bieżącej na macierz widoku modelu
- glLoadIdentity();
- // Czyszczenie macierzy bieżącej
- }
- void PrepareModel() {
- model = new point3*[N];
- lights = new point3*[N];
- for (auto i = 0; i < N; i++) {
- model[i] = new point3[N];
- lights[i] = new point3[N];
- }
- for (auto i = 0; i < N; i++) {
- for (auto j = 0; j < N; j++) {
- auto vect = GetNormalVector(float(i) / float(N - 1), float(j) / float(N - 1));
- if (i < N / 2 && j < N / 2)
- {
- lights[i][j][0] = vect[0];
- lights[i][j][1] = vect[1];
- lights[i][j][2] = vect[2];
- }
- else if (j < N / 2)
- {
- lights[i][j][0] = -vect[0];
- lights[i][j][1] = -vect[1];
- lights[i][j][2] = -vect[2];
- }
- else if (i < N / 2)
- {
- lights[i][j][0] = vect[0];
- lights[i][j][1] = vect[1];
- lights[i][j][2] = vect[2];
- }
- else // i >= N/2 && j >= N/2
- {
- lights[i][j][0] = -vect[0];
- lights[i][j][1] = -vect[1];
- lights[i][j][2] = -vect[2];
- }
- model[i][j][0] = FunX(float(i) / float(N - 1), float(j) / float(N - 1));
- model[i][j][1] = FunY(float(i) / float(N - 1), float(j) / float(N - 1)) - 5;
- model[i][j][2] = FunZ(float(i) / float(N - 1), float(j) / float(N - 1));
- }
- }
- colors = new color3*[N];
- textures = new point2*[N];
- for (auto i = 0; i < N; i++) {
- colors[i] = new color3[N];
- textures[i] = new point2[N];
- for (auto j = 0; j < N; j++) {
- colors[i][j][0] = static_cast<float>(rand()) / RAND_MAX;
- colors[i][j][1] = static_cast<float>(rand()) / RAND_MAX;
- colors[i][j][2] = static_cast<float>(rand()) / RAND_MAX;
- }
- }
- for(int i = 0; i < N / 2; i++)
- {
- for(int j = 0; j < N; j++)
- {
- textures[i][j][0] = static_cast<float>(j) / static_cast<float>(N - 1);
- textures[i][j][1] = static_cast<float>(i) / static_cast<float>(N - 1);
- }
- }
- for (int i = N / 2; i < N; i++)
- {
- for (int j = 0; j < N; j++)
- {
- textures[i][j][0] = 1-static_cast<float>(j) / static_cast<float>(N - 1);
- textures[i][j][1] = 1-static_cast<float>(i) / static_cast<float>(N - 1);
- }
- }
- }
- void DrawEgg() {
- switch (displayMode) {
- case Vertex:
- glBegin(GL_POINTS);
- for (auto i = 0; i < N; i++) {
- for (auto j = 0; j < N; j++) {
- glVertex3fv(model[i][j]);
- }
- }
- glEnd();
- break;
- case Net:
- glBegin(GL_LINES);
- for (auto i = 0; i < N - 1; i++) {
- for (auto j = 0; j < N - 1; j++) {
- auto x = i, y = j;
- glVertex3fv(model[i][j]);
- glVertex3fv(model[i + 1][j]);
- glVertex3fv(model[i][j + 1]);
- //
- glVertex3fv(model[i][j]);
- glVertex3fv(model[i][j + 1]);
- glVertex3fv(model[i > 0 ? i - 1 : N - 1][j + 1]);
- }
- }
- glEnd();
- break;
- case Solid:
- glBegin(GL_TRIANGLES);
- for (auto i = 0; i < N / 2; i++) {
- for (auto j = 0; j < N - 1; j++) {
- glNormal3fv(lights[i][j]);
- glTexCoord2fv(textures[i][j]);
- glVertex3fv(model[i][j]);
- glNormal3fv(lights[i + 1][j + 1]);
- glTexCoord2fv(textures[i + 1][j + 1]);
- glVertex3fv(model[i + 1][j + 1]);
- glNormal3fv(lights[i][j + 1]);
- glTexCoord2fv(textures[i][j + 1]);
- glVertex3fv(model[i][j + 1]);
- glNormal3fv(lights[i][j]);
- glTexCoord2fv(textures[i][j]);
- glVertex3fv(model[i][j]);
- glNormal3fv(lights[i + 1][j]);
- glTexCoord2fv(textures[i + 1][j]);
- glVertex3fv(model[i + 1][j]);
- glNormal3fv(lights[i + 1][j + 1]);
- glTexCoord2fv(textures[i + 1][j + 1]);
- glVertex3fv(model[i + 1][j + 1]);
- }
- }
- for (auto i = N / 2; i < N - 1; i++) {
- for (auto j = 0; j < N - 1; j++) {
- glNormal3fv(lights[i][j]);
- glTexCoord2fv(textures[i][j]);
- glVertex3fv(model[i][j]);
- glNormal3fv(lights[i][j + 1]);
- glTexCoord2fv(textures[i][j + 1]);
- glVertex3fv(model[i][j + 1]);
- glNormal3fv(lights[i + 1][j + 1]);
- glTexCoord2fv(textures[i + 1][j + 1]);
- glVertex3fv(model[i + 1][j + 1]);
- glNormal3fv(lights[i][j]);
- glTexCoord2fv(textures[i][j]);
- glVertex3fv(model[i][j]);
- glNormal3fv(lights[i + 1][j + 1]);
- glTexCoord2fv(textures[i + 1][j + 1]);
- glVertex3fv(model[i + 1][j + 1]);
- glNormal3fv(lights[i + 1][j]);
- glTexCoord2fv(textures[i + 1][j]);
- glVertex3fv(model[i + 1][j]);
- }
- }
- glEnd();
- break;
- default: break;
- }
- }
- void Keys(unsigned char key, int x, int y) {
- if (key == 'p') displayMode = Vertex;
- if (key == 'w') displayMode = Net;
- if (key == 's') displayMode = Solid;
- if (key == '1') lightNo = Light0;
- if (key == '2') lightNo = Light1;
- RenderScene();
- }
- void Mouse(int btn, int state, int x, int y)
- {
- if (btn == GLUT_LEFT_BUTTON && state == GLUT_DOWN)
- {
- x_pos_old = x;
- y_pos_old = y;
- status = LeftButtonPressed;
- }
- else if (btn == GLUT_RIGHT_BUTTON && state == GLUT_DOWN)
- {
- zoom_old = x;
- status = RightButtonPressed;
- }
- else if (btn == GLUT_MIDDLE_BUTTON && state == GLUT_DOWN)
- {
- light_x_pos_old0 = x;
- light_y_pos_old0 = y;
- light_x_pos_old1 = x;
- light_y_pos_old1 = y;
- status = MiddleButtonPressed;
- }
- else status = NoAction;
- }
- void Motion(GLsizei x, GLsizei y)
- {
- delta_x = x - x_pos_old;
- x_pos_old = x;
- delta_y = y - y_pos_old;
- y_pos_old = y;
- delta_zoom = y - zoom_old;
- zoom_old = y;
- delta_x_light0 = delta_x;
- delta_y_light0 = delta_y;
- light_x_pos_old0 = x;
- light_y_pos_old0 = y;
- delta_x_light1 = delta_x;
- delta_y_light1 = delta_y;
- light_x_pos_old1 = x;
- light_y_pos_old1 = y;
- glutPostRedisplay();
- }
- void TurnOnTheLight()
- {
- GLfloat mat_ambient[] = { 1.0, 1.0, 1.0, 1.0 };
- GLfloat mat_diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
- GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 };
- GLfloat mat_shininess = { 40.0 };
- // Definicja źródła światła
- GLfloat light_ambient[] = { 1.0, 1.0, 1.0, 0.4 };
- GLfloat light_ambient2[] = { 1.0, 1.0, 1.0, 0.4 };
- GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 0.4 };
- GLfloat light_diffuse2[] = { 1.0, 1.0, 1.0, 0.4 };
- GLfloat light_specular[] = { 1.0, 1.0, 1.0, 1.0 };
- GLfloat att_constant = { 1.0 };
- double att_linear = { 0.05 };
- double att_quadratic = { 0.001 };
- glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
- glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
- glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
- glMaterialf(GL_FRONT, GL_SHININESS, mat_shininess);
- glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
- glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
- glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
- glLightfv(GL_LIGHT0, GL_POSITION, light0);
- glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, att_constant);
- glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, att_linear);
- glLightf(GL_LIGHT0, GL_QUADRATIC_ATTENUATION, att_quadratic);
- glLightfv(GL_LIGHT1, GL_AMBIENT, light_ambient2);
- glLightfv(GL_LIGHT1, GL_DIFFUSE, light_diffuse2);
- glLightfv(GL_LIGHT1, GL_SPECULAR, light_specular);
- glLightfv(GL_LIGHT1, GL_POSITION, light1);
- glLightf(GL_LIGHT1, GL_CONSTANT_ATTENUATION, att_constant);
- glLightf(GL_LIGHT1, GL_LINEAR_ATTENUATION, att_linear);
- glLightf(GL_LIGHT1, GL_QUADRATIC_ATTENUATION, att_quadratic);
- glShadeModel(GL_SMOOTH); // właczenie łagodnego cieniowania
- glEnable(GL_LIGHTING); // właczenie systemu oświetlenia sceny
- glEnable(GL_LIGHT0); // włączenie źródła o numerze 0
- glEnable(GL_LIGHT1);
- glEnable(GL_DEPTH_TEST); // włączenie mechanizmu z-bufora
- glEnable(GL_COLOR_MATERIAL);
- }
- void MyInit(void)
- {
- GLbyte *pBytes;
- GLint ImWidth, ImHeight, ImComponents;
- GLenum ImFormat;
- // ..................................
- // Pozostała część funkcji MyInit()
- // ..................................
- /*************************************************************************************/
- // Teksturowanie będzie prowadzone tyko po jednej stronie ściany
- glEnable(GL_CULL_FACE);
- /*************************************************************************************/
- // Przeczytanie obrazu tekstury z pliku o nazwie tekstura.tga
- pBytes = LoadTGAImage("jajko.tga", &ImWidth, &ImHeight, &ImComponents, &ImFormat);
- /*************************************************************************************/
- // Zdefiniowanie tekstury 2-D
- glTexImage2D(GL_TEXTURE_2D, 0, ImComponents, ImWidth, ImHeight, 0, ImFormat, GL_UNSIGNED_BYTE, pBytes);
- /*************************************************************************************/
- // Zwolnienie pamięci
- free(pBytes);
- /*************************************************************************************/
- // Włączenie mechanizmu teksturowania
- glEnable(GL_TEXTURE_2D);
- /*************************************************************************************/
- // Ustalenie trybu teksturowania
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- /*************************************************************************************/
- // Określenie sposobu nakładania tekstur
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- //glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
- TurnOnTheLight();
- }
- void main(void)
- {
- srand(time(NULL));
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
- glutInitWindowSize(700, 700);
- glutCreateWindow("Tekstury");
- glutDisplayFunc(RenderScene);
- glutReshapeFunc(ChangeSize);
- glutMouseFunc(Mouse);
- glutMotionFunc(Motion);
- MyInit();
- glEnable(GL_DEPTH_TEST);
- PrepareModel();
- glutKeyboardFunc(Keys);
- glutMainLoop();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement