commit project files
This commit is contained in:
1514
Gl_template.c.DONTCOMPILE
Normal file
1514
Gl_template.c.DONTCOMPILE
Normal file
File diff suppressed because it is too large
Load Diff
14
Makefile
Normal file
14
Makefile
Normal file
@@ -0,0 +1,14 @@
|
||||
CC = "C:\\msys64\\mingw64\\bin\\g++.exe"
|
||||
CFLAGS = -I.
|
||||
DEPS = -lopengl32 -lglu32 -lgdi32 -l:glew32.lib
|
||||
LINK = -L. -DGLEW_STATIC
|
||||
OUTPUT = output.exe
|
||||
|
||||
default:
|
||||
$(CC) -g *.cpp $(CFLAGS) $(DEPS) $(LINK) -static -static-libgcc -fno-keep-inline-dllexport -o $(OUTPUT)
|
||||
|
||||
run: default
|
||||
$(OUTPUT)
|
||||
|
||||
clean:
|
||||
rm $(OUTPUT)
|
||||
BIN
RESOURCE.APS
Normal file
BIN
RESOURCE.APS
Normal file
Binary file not shown.
35
RESOURCE.H
Normal file
35
RESOURCE.H
Normal file
@@ -0,0 +1,35 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by resource.rc
|
||||
//
|
||||
#define IDR_MENU 101
|
||||
#define IDD_DIALOG_ABOUT 102
|
||||
#define IDR_TOOLBAR1 104
|
||||
#define IDC_OPENGL_VENDOR 1000
|
||||
#define IDC_OPENGL_RENDERER 1001
|
||||
#define IDC_OPENGL_VERSION 1002
|
||||
#define IDC_OPENGL_EXTENSIONS 1003
|
||||
#define IDC_GLU_VERSION 1005
|
||||
#define IDC_GLU_EXTENSIONS 1006
|
||||
#define IDC_ERROR1 1007
|
||||
#define IDC_ERROR2 1008
|
||||
#define IDC_ERROR3 1009
|
||||
#define IDC_ERROR4 1010
|
||||
#define IDC_ERROR5 1011
|
||||
#define IDC_ERROR6 1012
|
||||
#define ID_FILE_EXIT 40001
|
||||
#define ID_HELP_ABOUT 40002
|
||||
#define ID_BUTTON40003 40003
|
||||
#define ID_LIGHTING_SUNLIGHT 40004
|
||||
#define ID_LIGHTING_AMBIENTLIGHT 40005
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 106
|
||||
#define _APS_NEXT_COMMAND_VALUE 40006
|
||||
#define _APS_NEXT_CONTROL_VALUE 1013
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
44
cube.obj
Normal file
44
cube.obj
Normal file
@@ -0,0 +1,44 @@
|
||||
# Blender 4.2.1 LTS
|
||||
# www.blender.org
|
||||
o Cube
|
||||
v 1.000000 1.000000 -1.000000
|
||||
v 1.000000 -1.000000 -1.000000
|
||||
v 1.000000 1.000000 1.000000
|
||||
v 1.000000 -1.000000 1.000000
|
||||
v -1.000000 1.000000 -1.000000
|
||||
v -1.000000 -1.000000 -1.000000
|
||||
v -1.000000 1.000000 1.000000
|
||||
v -1.000000 -1.000000 1.000000
|
||||
vn -0.0000 1.0000 -0.0000
|
||||
vn -0.0000 -0.0000 1.0000
|
||||
vn -1.0000 -0.0000 -0.0000
|
||||
vn -0.0000 -1.0000 -0.0000
|
||||
vn 1.0000 -0.0000 -0.0000
|
||||
vn -0.0000 -0.0000 -1.0000
|
||||
vt 0.875000 0.500000
|
||||
vt 0.625000 0.750000
|
||||
vt 0.625000 0.500000
|
||||
vt 0.375000 1.000000
|
||||
vt 0.375000 0.750000
|
||||
vt 0.625000 0.000000
|
||||
vt 0.375000 0.250000
|
||||
vt 0.375000 0.000000
|
||||
vt 0.375000 0.500000
|
||||
vt 0.125000 0.750000
|
||||
vt 0.125000 0.500000
|
||||
vt 0.625000 0.250000
|
||||
vt 0.875000 0.750000
|
||||
vt 0.625000 1.000000
|
||||
s 0
|
||||
f 5/1/1 3/2/1 1/3/1
|
||||
f 3/2/2 8/4/2 4/5/2
|
||||
f 7/6/3 6/7/3 8/8/3
|
||||
f 2/9/4 8/10/4 6/11/4
|
||||
f 1/3/5 4/5/5 2/9/5
|
||||
f 5/12/6 2/9/6 6/7/6
|
||||
f 5/1/1 7/13/1 3/2/1
|
||||
f 3/2/2 7/14/2 8/4/2
|
||||
f 7/6/3 5/12/3 6/7/3
|
||||
f 2/9/4 4/5/4 8/10/4
|
||||
f 1/3/5 3/2/5 4/5/5
|
||||
f 5/12/6 1/3/6 2/9/6
|
||||
93
loadOBJ.cpp
Normal file
93
loadOBJ.cpp
Normal file
@@ -0,0 +1,93 @@
|
||||
#include "loadOBJ.h"
|
||||
#include <string>
|
||||
//#include <vector>
|
||||
#include <windows.h>
|
||||
//#include <gl\gl.h>
|
||||
//#include <gl\glu.h>
|
||||
//#include <cstdio>
|
||||
//#include <glm\glm.hpp>
|
||||
|
||||
// using namespace glm;
|
||||
|
||||
bool loadOBJ(const char* path, std::vector <glm::vec3>& out_vertices, std::vector <glm::vec2>& out_uvs, std::vector <glm::vec3>& out_normals){
|
||||
|
||||
std::vector <unsigned int> vertexIndices, uvIndices, normalIndices;
|
||||
std::vector <glm::vec3> temp_vertices;
|
||||
std::vector <glm::vec2> temp_uvs;
|
||||
std::vector <glm::vec3> temp_normals;
|
||||
|
||||
printf("Ladowanie pliku %s...\n", path);
|
||||
|
||||
FILE* file = fopen(path, "r");
|
||||
if (file == NULL) {
|
||||
printf("Impossible to open the file!\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
|
||||
char lineHeader[128];
|
||||
// read the first word of the line
|
||||
int res = fscanf(file, "%s", lineHeader);
|
||||
if (res == EOF) break; // EOF = End Of File. Quit the loop.
|
||||
|
||||
// else: parse lineHeader
|
||||
if (strcmp(lineHeader, "v") == 0) {
|
||||
|
||||
glm::vec3 vertex;
|
||||
fscanf(file, "%f %f %f\n", &vertex.x, &vertex.y, &vertex.z);
|
||||
temp_vertices.push_back(vertex);
|
||||
|
||||
} else if (strcmp(lineHeader, "vt") == 0) {
|
||||
|
||||
glm::vec2 uv;
|
||||
fscanf(file, "%f %f\n", &uv.x, &uv.y);
|
||||
temp_uvs.push_back(uv);
|
||||
|
||||
} else if (strcmp(lineHeader, "vn") == 0) {
|
||||
|
||||
glm::vec3 normal;
|
||||
fscanf(file, "%f %f %f\n", &normal.x, &normal.y, &normal.z);
|
||||
temp_normals.push_back(normal);
|
||||
|
||||
} else if (strcmp(lineHeader, "f") == 0) {
|
||||
|
||||
std::string vertex1, vertex2, vertex3;
|
||||
unsigned int vertexIndex[3], uvIndex[3], normalIndex[3];
|
||||
int matches = fscanf(file, "%d/%d/%d %d/%d/%d %d/%d/%d\n", &vertexIndex[0], &uvIndex[0], &normalIndex[0], &vertexIndex[1], &uvIndex[1], &normalIndex[1], &vertexIndex[2], &uvIndex[2], &normalIndex[2]);
|
||||
|
||||
if (matches != 9){
|
||||
printf("File can't be read by our simple parser : ( Try exporting with other options\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
vertexIndices.push_back(vertexIndex[0]);
|
||||
vertexIndices.push_back(vertexIndex[1]);
|
||||
vertexIndices.push_back(vertexIndex[2]);
|
||||
uvIndices .push_back(uvIndex[0]);
|
||||
uvIndices .push_back(uvIndex[1]);
|
||||
uvIndices .push_back(uvIndex[2]);
|
||||
normalIndices.push_back(normalIndex[0]);
|
||||
normalIndices.push_back(normalIndex[1]);
|
||||
normalIndices.push_back(normalIndex[2]);
|
||||
}
|
||||
|
||||
// For each vertex of each triangle
|
||||
for (unsigned int i = 0; i < vertexIndices.size(); i++) {
|
||||
unsigned int vertexIndex = vertexIndices[i];
|
||||
unsigned int uvIndex = uvIndices[i];
|
||||
unsigned int normalIndex = normalIndices[i];
|
||||
|
||||
glm::vec3 vertex1 = temp_vertices[vertexIndex - 1];
|
||||
glm::vec2 vertex2 = temp_uvs[uvIndex - 1];
|
||||
glm::vec3 vertex3 = temp_normals[normalIndex - 1];
|
||||
|
||||
out_vertices .push_back(vertex1);
|
||||
out_uvs .push_back(vertex2);
|
||||
out_normals .push_back(vertex3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
15
loadOBJ.h
Normal file
15
loadOBJ.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
//#include <string>
|
||||
#include <vector>
|
||||
//#include <windows.h>
|
||||
//#include <gl\gl.h>
|
||||
//#include <gl\glu.h>
|
||||
//#include <cstdio>
|
||||
#include <glm\glm.hpp>
|
||||
|
||||
bool loadOBJ(
|
||||
const char* path,
|
||||
std::vector <glm::vec3>& out_vertices,
|
||||
std::vector <glm::vec2>& out_uvs,
|
||||
std::vector <glm::vec3>& out_normals
|
||||
);
|
||||
799
main.cpp
Normal file
799
main.cpp
Normal file
@@ -0,0 +1,799 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#ifdef _MSC_VER // Check if MS Visual C compiler
|
||||
# pragma comment(lib, "opengl32.lib") // Compiler-specific directive to avoid manually configuration
|
||||
# pragma comment(lib, "glu32.lib") // Link libraries
|
||||
#endif
|
||||
#ifdef _MSC_VER
|
||||
# ifndef _MBCS
|
||||
# define _MBCS
|
||||
# endif
|
||||
# ifdef _UNICODE
|
||||
# undef _UNICODE
|
||||
# endif
|
||||
# ifdef UNICODE
|
||||
# undef UNICODE
|
||||
# endif
|
||||
#endif
|
||||
// #define glewExperimental
|
||||
// #define glewInit
|
||||
// #define glewGenBuffers
|
||||
// #define glewBindBuffer
|
||||
// #define glewBufferData
|
||||
// #define GLEW_STATIC
|
||||
#include <windows.h> // Window defines
|
||||
#include <GL/glew.h>
|
||||
//#include <glew.h>
|
||||
#include <gl/gl.h> // OpenGL
|
||||
#include <gl/glu.h> // GLU library
|
||||
#include <math.h> // Define for sqrt
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include "RESOURCE.H" // About box resource identifiers.
|
||||
#include "szescian.h"
|
||||
#include "loadOBJ.h"
|
||||
#include <vector>
|
||||
#include <glm/glm.hpp>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
using namespace glm;
|
||||
|
||||
#define glRGB(x, y, z) glColor3ub((GLubyte)x, (GLubyte)y, (GLubyte)z)
|
||||
#define BITMAP_ID 0x4D42 // identyfikator formatu BMP
|
||||
#define GL_PI 3.1415
|
||||
|
||||
//using namespace std;
|
||||
|
||||
HPALETTE hPalette = NULL;
|
||||
|
||||
// Application name and instance storeage
|
||||
static LPCTSTR lpszAppName = "GL Template";
|
||||
static HINSTANCE hInstance;
|
||||
|
||||
// Rotation amounts
|
||||
static GLfloat xRot = 0.0f;
|
||||
static GLfloat yRot = 0.0f;
|
||||
static GLfloat zRot = 0.0f;
|
||||
|
||||
|
||||
static GLsizei lastHeight;
|
||||
static GLsizei lastWidth;
|
||||
|
||||
// Opis tekstury
|
||||
BITMAPINFOHEADER bitmapInfoHeader; // nagłówek obrazu
|
||||
unsigned char* bitmapData; // dane tekstury
|
||||
unsigned int texture[2]; // obiekt tekstury
|
||||
|
||||
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
BOOL APIENTRY AboutDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam);
|
||||
|
||||
void SetDCPixelFormat(HDC hDC);
|
||||
|
||||
int polygonmode = 0;
|
||||
char loadCount = 0;
|
||||
|
||||
// Change viewing volume and viewport. Called when window is resized
|
||||
void ChangeSize(GLsizei w, GLsizei h) {
|
||||
GLfloat nRange = 100.0f;
|
||||
GLfloat fAspect;
|
||||
// Prevent a divide by zero
|
||||
if (h == 0) h = 1;
|
||||
|
||||
lastWidth = w;
|
||||
lastHeight = h;
|
||||
|
||||
fAspect = (GLfloat)w / (GLfloat)h;
|
||||
// Set Viewport to window dimensions
|
||||
glViewport(0, 0, w, h);
|
||||
|
||||
// Reset coordinate system
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
|
||||
// Establish clipping volume (left, right, bottom, top, near, far)
|
||||
if (w <= h) glOrtho(-nRange, nRange, -nRange * h / w, nRange * h / w, -nRange, nRange);
|
||||
else glOrtho(-nRange * w / h, nRange * w / h, -nRange, nRange, -nRange, nRange);
|
||||
|
||||
// Establish perspective:
|
||||
/*
|
||||
gluPerspective(60.0f, fAspect, 1.0, 400);
|
||||
*/
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
}
|
||||
|
||||
void SetupRC() {
|
||||
// Light values and coordinates
|
||||
//GLfloat ambientLight[] = { 0.3f, 0.3f, 0.3f, 1.0f };
|
||||
//GLfloat diffuseLight[] = { 0.7f, 0.7f, 0.7f, 1.0f };
|
||||
//GLfloat specular[] = { 1.0f, 1.0f, 1.0f, 1.0f };
|
||||
//GLfloat lightPos[] = { 0.0f, 150.0f, 150.0f, 1.0f };
|
||||
//GLfloat specref[] = { 1.0f, 1.0f, 1.0f, 1.0f };
|
||||
|
||||
|
||||
glEnable(GL_DEPTH_TEST); // Hidden surface removal
|
||||
glFrontFace(GL_CCW); // Counter clock-wise polygons face out
|
||||
//glEnable(GL_CULL_FACE); // Do not calculate inside of jet
|
||||
|
||||
// Enable lighting
|
||||
//glEnable(GL_LIGHTING);
|
||||
|
||||
// Setup and enable light 0
|
||||
//glLightfv(GL_LIGHT0, GL_AMBIENT, ambientLight);
|
||||
//glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseLight);
|
||||
//glLightfv(GL_LIGHT0, GL_SPECULAR, specular);
|
||||
//glLightfv(GL_LIGHT0, GL_POSITION, lightPos);
|
||||
//glEnable(GL_LIGHT0);
|
||||
|
||||
// Enable color tracking
|
||||
//glEnable(GL_COLOR_MATERIAL);
|
||||
|
||||
// Set Material properties to follow glColor values
|
||||
//glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
|
||||
|
||||
// All materials hereafter have full specular reflectivity
|
||||
// with a high shine
|
||||
//glMaterialfv(GL_FRONT, GL_SPECULAR, specref);
|
||||
//glMateriali(GL_FRONT, GL_SHININESS, 128);
|
||||
|
||||
|
||||
// White background
|
||||
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
// Black brush
|
||||
glColor3f(0.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
// LoadBitmapFile
|
||||
// opis: ładuje mapę bitową z pliku i zwraca jej adres.
|
||||
// Wypełnia strukturę nagłówka.
|
||||
// Nie obsługuje map 8-bitowych.
|
||||
unsigned char* LoadBitmapFile(char* filename, BITMAPINFOHEADER* bitmapInfoHeader) {
|
||||
FILE* filePtr; // wskaźnik pozycji pliku
|
||||
BITMAPFILEHEADER bitmapFileHeader; // nagłówek pliku
|
||||
unsigned char* bitmapImage; // dane obrazu
|
||||
int imageIdx = 0; // licznik pikseli
|
||||
unsigned char tempRGB; // zmienna zamiany składowych
|
||||
|
||||
// otwiera plik w trybie "read binary"
|
||||
filePtr = fopen(filename, "rb");
|
||||
if (filePtr == NULL)
|
||||
return NULL;
|
||||
|
||||
// wczytuje nagłówek pliku
|
||||
fread(&bitmapFileHeader, sizeof(BITMAPFILEHEADER), 1, filePtr);
|
||||
|
||||
// sprawdza, czy jest to plik formatu BMP
|
||||
if (bitmapFileHeader.bfType != BITMAP_ID)
|
||||
{
|
||||
fclose(filePtr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// wczytuje nagłówek obrazu
|
||||
fread(bitmapInfoHeader, sizeof(BITMAPINFOHEADER), 1, filePtr);
|
||||
|
||||
// ustawia wskaźnik pozycji pliku na początku danych obrazu
|
||||
fseek(filePtr, bitmapFileHeader.bfOffBits, SEEK_SET);
|
||||
|
||||
// przydziela pamięć buforowi obrazu
|
||||
bitmapImage = (unsigned char*)malloc(bitmapInfoHeader->biSizeImage);
|
||||
|
||||
// sprawdza, czy udało się przydzielić pamięć
|
||||
if (!bitmapImage) {
|
||||
free(bitmapImage);
|
||||
fclose(filePtr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// wczytuje dane obrazu
|
||||
fread(bitmapImage, 1, bitmapInfoHeader->biSizeImage, filePtr);
|
||||
|
||||
// sprawdza, czy dane zostały wczytane
|
||||
if (bitmapImage == NULL) {
|
||||
fclose(filePtr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// zamienia miejscami składowe R i B
|
||||
for (imageIdx = 0; imageIdx < bitmapInfoHeader->biSizeImage; imageIdx += 3) {
|
||||
tempRGB = bitmapImage[imageIdx];
|
||||
bitmapImage[imageIdx] = bitmapImage[imageIdx + 2];
|
||||
bitmapImage[imageIdx + 2] = tempRGB;
|
||||
}
|
||||
|
||||
// zamyka plik i zwraca wskaźnik bufora zawierającego wczytany obraz
|
||||
fclose(filePtr);
|
||||
return bitmapImage;
|
||||
}
|
||||
|
||||
void SetDCPixelFormat(HDC hDC) {
|
||||
int nPixelFormat;
|
||||
|
||||
static PIXELFORMATDESCRIPTOR pfd = {
|
||||
sizeof(PIXELFORMATDESCRIPTOR), // Size of this structure
|
||||
1, // Version of this structure
|
||||
PFD_DRAW_TO_WINDOW | // Draw to Window (not to bitmap)
|
||||
PFD_SUPPORT_OPENGL | // Support OpenGL calls in window
|
||||
PFD_DOUBLEBUFFER, // Double buffered
|
||||
PFD_TYPE_RGBA, // RGBA Color mode
|
||||
24, // Want 24bit color
|
||||
0,0,0,0,0,0, // Not used to select mode
|
||||
0,0, // Not used to select mode
|
||||
0,0,0,0,0, // Not used to select mode
|
||||
32, // Size of depth buffer
|
||||
0, // Not used to select mode
|
||||
0, // Not used to select mode
|
||||
PFD_MAIN_PLANE, // Draw in main plane
|
||||
0, // Not used to select mode
|
||||
0,0,0 }; // Not used to select mode
|
||||
|
||||
// Choose a pixel format that best matches that described in pfd
|
||||
nPixelFormat = ChoosePixelFormat(hDC, &pfd);
|
||||
|
||||
// Set the pixel format for the device context
|
||||
SetPixelFormat(hDC, nPixelFormat, &pfd);
|
||||
}
|
||||
|
||||
std::vector <glm::vec3> vertices;
|
||||
std::vector <glm::vec2> uvs;
|
||||
std::vector <glm::vec3> normals; // Won't be used at the moment.
|
||||
GLuint vertexbuffer;
|
||||
GLuint uvbuffer;
|
||||
|
||||
void RenderScene(void) {
|
||||
if (loadCount == 0){
|
||||
// załaduj model
|
||||
|
||||
// if(!glfwInit()) {
|
||||
// fprintf(stderr, "Failed to initialize GLFW\n");
|
||||
// getchar();
|
||||
// return;
|
||||
// }
|
||||
|
||||
// Initialize GLEW
|
||||
glewExperimental = true; // Needed for core profile
|
||||
if (glewInit() != GLEW_OK) {
|
||||
fprintf(stderr, "Failed to initialize GLEW\n");
|
||||
getchar();
|
||||
// glfwTerminate();
|
||||
return;
|
||||
}
|
||||
|
||||
/* */
|
||||
// Read our .obj file
|
||||
|
||||
bool res = loadOBJ("suzanne.obj", vertices, uvs, normals);
|
||||
/* */
|
||||
|
||||
glGenBuffers(1, &vertexbuffer);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
|
||||
glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(glm::vec3), &vertices[0], GL_STATIC_DRAW);
|
||||
|
||||
glGenBuffers(1, &uvbuffer);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, uvbuffer);
|
||||
glBufferData(GL_ARRAY_BUFFER, uvs.size() * sizeof(glm::vec2), &uvs[0], GL_STATIC_DRAW);
|
||||
|
||||
loadCount++;
|
||||
|
||||
//glClearColor(0.0f, 0.0f, 0.4f, 0.0f);
|
||||
|
||||
|
||||
}
|
||||
|
||||
//float normal[3]; // Storage for calculated surface normal
|
||||
|
||||
// Clear the window with current clearing color
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
// Save the matrix state and do the rotations
|
||||
glPushMatrix();
|
||||
glRotatef(xRot, 1.0f, 0.0f, 0.0f);
|
||||
glRotatef(yRot, 0.0f, 1.0f, 0.0f);
|
||||
glRotatef(zRot, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
// gluLookAt(
|
||||
// 0, 0, 0, // the position of your camera, in world space
|
||||
// 0, 0, 0, // where you want to look at, in world space
|
||||
// 0, 1, 0 // probably glm::vec3(0,1,0), but (0,-1,0) would make you looking upside-down, which can be great too
|
||||
// );
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// MIEJSCE NA KOD OPENGL DO TWORZENIA WLASNYCH SCEN: //
|
||||
/////////////////////////////////////////////////////////////////
|
||||
//szescian();
|
||||
|
||||
//Sposób na odróżnienie "przedniej" i "tylniej" ściany wielokąta:
|
||||
//glPolygonMode(GL_BACK,GL_LINE);
|
||||
//walec(40, 40);
|
||||
//szescian();
|
||||
|
||||
switch (polygonmode) {
|
||||
case 0:
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
break;
|
||||
|
||||
default:
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
}
|
||||
|
||||
{
|
||||
// Clear the screen
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
// Use our shader
|
||||
//glUseProgram(programID);
|
||||
|
||||
// Bind our texture in Texture Unit 0
|
||||
//glActiveTexture(GL_TEXTURE0);
|
||||
//glBindTexture(GL_TEXTURE_2D, Texture);
|
||||
// Set our "myTextureSampler" sampler to use Texture Unit 0
|
||||
//glUniform1i(TextureID, 0);
|
||||
|
||||
// 1rst attribute buffer : vertices
|
||||
glEnableVertexAttribArray(0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
|
||||
glVertexAttribPointer(
|
||||
0, // attribute
|
||||
3, // size
|
||||
GL_FLOAT, // type
|
||||
GL_FALSE, // normalized?
|
||||
0, // stride
|
||||
(void*)0 // array buffer offset
|
||||
);
|
||||
|
||||
// 2nd attribute buffer : UVs
|
||||
glEnableVertexAttribArray(1);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, uvbuffer);
|
||||
glVertexAttribPointer(
|
||||
1, // attribute
|
||||
2, // size
|
||||
GL_FLOAT, // type
|
||||
GL_FALSE, // normalized?
|
||||
0, // stride
|
||||
(void*)0 // array buffer offset
|
||||
);
|
||||
|
||||
// Draw the triangle !
|
||||
glDrawArrays(GL_TRIANGLES, 0, vertices.size() );
|
||||
|
||||
glDisableVertexAttribArray(0);
|
||||
glDisableVertexAttribArray(1);
|
||||
|
||||
// Swap buffers
|
||||
//glfwSwapBuffers(window);
|
||||
//glfwPollEvents();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
szescian nowy;
|
||||
nowy.create(0, 0, 0, 10);
|
||||
nowy.create(-10, 20, 0, 10);
|
||||
nowy.create(25, 10, 0, 10);
|
||||
*/
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, vertices.size());
|
||||
|
||||
/*
|
||||
szescian nowy2;
|
||||
nowy2.create(0, 10, 0, 10);
|
||||
szescian nowy3;
|
||||
nowy3.create(0, 20, -10, 10);
|
||||
*/
|
||||
|
||||
//Uzyskanie siatki:
|
||||
//glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
|
||||
//Wyrysowanie prostokata:
|
||||
//glRectd(-10.0,-10.0,20.0,20.0);
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
// Flush drawing commands
|
||||
glFlush();
|
||||
}
|
||||
|
||||
// If necessary, creates a 3-3-2 palette for the device context listed.
|
||||
HPALETTE GetOpenGLPalette(HDC hDC) {
|
||||
HPALETTE hRetPal = NULL; // Handle to palette to be created
|
||||
PIXELFORMATDESCRIPTOR pfd; // Pixel Format Descriptor
|
||||
LOGPALETTE* pPal; // Pointer to memory for logical palette
|
||||
int nPixelFormat; // Pixel format index
|
||||
int nColors; // Number of entries in palette
|
||||
int i; // Counting variable
|
||||
BYTE RedRange, GreenRange, BlueRange;
|
||||
// Range for each color entry (7,7,and 3)
|
||||
|
||||
|
||||
// Get the pixel format index and retrieve the pixel format description
|
||||
nPixelFormat = GetPixelFormat(hDC);
|
||||
DescribePixelFormat(hDC, nPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
|
||||
|
||||
// Does this pixel format require a palette? If not, do not create a
|
||||
// palette and just return NULL
|
||||
if (!(pfd.dwFlags & PFD_NEED_PALETTE)) return NULL;
|
||||
|
||||
// Number of entries in palette. 8 bits yeilds 256 entries
|
||||
nColors = 1 << pfd.cColorBits;
|
||||
|
||||
// Allocate space for a logical palette structure plus all the palette entries
|
||||
pPal = (LOGPALETTE*)malloc(sizeof(LOGPALETTE) + nColors * sizeof(PALETTEENTRY));
|
||||
|
||||
// Fill in palette header
|
||||
pPal->palVersion = 0x300; // Windows 3.0
|
||||
pPal->palNumEntries = nColors; // table size
|
||||
|
||||
// Build mask of all 1's. This creates a number represented by having
|
||||
// the low order x bits set, where x = pfd.cRedBits, pfd.cGreenBits, and
|
||||
// pfd.cBlueBits.
|
||||
RedRange = (1 << pfd.cRedBits) - 1;
|
||||
GreenRange = (1 << pfd.cGreenBits) - 1;
|
||||
BlueRange = (1 << pfd.cBlueBits) - 1;
|
||||
|
||||
// Loop through all the palette entries
|
||||
for (i = 0; i < nColors; i++) {
|
||||
|
||||
// Fill in the 8-bit equivalents for each component
|
||||
pPal->palPalEntry[i].peRed = (i >> pfd.cRedShift) & RedRange;
|
||||
pPal->palPalEntry[i].peRed = (unsigned char)(
|
||||
(double)pPal->palPalEntry[i].peRed * 255.0 / RedRange);
|
||||
|
||||
pPal->palPalEntry[i].peGreen = (i >> pfd.cGreenShift) & GreenRange;
|
||||
pPal->palPalEntry[i].peGreen = (unsigned char)(
|
||||
(double)pPal->palPalEntry[i].peGreen * 255.0 / GreenRange);
|
||||
|
||||
pPal->palPalEntry[i].peBlue = (i >> pfd.cBlueShift) & BlueRange;
|
||||
pPal->palPalEntry[i].peBlue = (unsigned char)(
|
||||
(double)pPal->palPalEntry[i].peBlue * 255.0 / BlueRange);
|
||||
|
||||
// pPal->palPalEntry[i].peFlags = (unsigned char) NULL;
|
||||
pPal->palPalEntry[i].peFlags = 0;
|
||||
}
|
||||
|
||||
|
||||
// Create the palette
|
||||
hRetPal = CreatePalette(pPal);
|
||||
|
||||
// Go ahead and select and realize the palette for this device context
|
||||
SelectPalette(hDC, hRetPal, FALSE);
|
||||
RealizePalette(hDC);
|
||||
|
||||
// Free the memory used for the logical palette structure
|
||||
free(pPal);
|
||||
|
||||
// Return the handle to the new palette
|
||||
return hRetPal;
|
||||
}
|
||||
|
||||
int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
|
||||
|
||||
MSG msg; // Windows message structure
|
||||
WNDCLASS wc; // Windows class structure
|
||||
HWND hWnd; // Storeage for window handle
|
||||
|
||||
hInstance = hInst;
|
||||
|
||||
// Register Window style
|
||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wc.lpfnWndProc = (WNDPROC)WndProc;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = hInstance;
|
||||
wc.hIcon = NULL;
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
|
||||
// No need for background brush for OpenGL window
|
||||
wc.hbrBackground = NULL;
|
||||
|
||||
wc.lpszMenuName = MAKEINTRESOURCE(IDR_MENU);
|
||||
wc.lpszClassName = lpszAppName;
|
||||
|
||||
// Register the window class
|
||||
if (RegisterClass(&wc) == 0) return FALSE;
|
||||
|
||||
|
||||
// Create the main application window
|
||||
hWnd = CreateWindow(
|
||||
lpszAppName,
|
||||
lpszAppName,
|
||||
|
||||
// OpenGL requires WS_CLIPCHILDREN and WS_CLIPSIBLINGS
|
||||
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
|
||||
|
||||
// Window position and size
|
||||
50, 50,
|
||||
400, 400,
|
||||
NULL,
|
||||
NULL,
|
||||
hInstance,
|
||||
NULL);
|
||||
|
||||
// If window was not created, quit
|
||||
if (hWnd == NULL) return FALSE;
|
||||
|
||||
|
||||
// Display the window
|
||||
ShowWindow(hWnd, SW_SHOW);
|
||||
UpdateWindow(hWnd);
|
||||
|
||||
// Process application messages until the application closes
|
||||
while (GetMessage(&msg, NULL, 0, 0)) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
return msg.wParam;
|
||||
}
|
||||
|
||||
|
||||
// Window procedure, handles all messages for this program
|
||||
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
static HGLRC hRC; // Permenant Rendering context
|
||||
static HDC hDC; // Private GDI Device context
|
||||
|
||||
switch (message) {
|
||||
// Window creation, setup for OpenGL
|
||||
case WM_CREATE:
|
||||
// Store the device context
|
||||
hDC = GetDC(hWnd);
|
||||
|
||||
// Select the pixel format
|
||||
SetDCPixelFormat(hDC);
|
||||
|
||||
// Create palette if needed
|
||||
hPalette = GetOpenGLPalette(hDC);
|
||||
|
||||
// Create the rendering context and make it current
|
||||
hRC = wglCreateContext(hDC);
|
||||
wglMakeCurrent(hDC, hRC);
|
||||
SetupRC();
|
||||
glGenTextures(2, &texture[0]); // tworzy obiekt tekstury
|
||||
|
||||
// ładuje pierwszy obraz tekstury:
|
||||
bitmapData = LoadBitmapFile((char*)"Bitmapy\\checker.bmp", &bitmapInfoHeader);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, texture[0]); // aktywuje obiekt tekstury
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
||||
|
||||
// tworzy obraz tekstury
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, bitmapInfoHeader.biWidth,
|
||||
bitmapInfoHeader.biHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, bitmapData);
|
||||
|
||||
if (bitmapData) free(bitmapData);
|
||||
|
||||
// ładuje drugi obraz tekstury:
|
||||
bitmapData = LoadBitmapFile((char*)"Bitmapy\\crate.bmp", &bitmapInfoHeader);
|
||||
glBindTexture(GL_TEXTURE_2D, texture[1]); // aktywuje obiekt tekstury
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
||||
|
||||
// tworzy obraz tekstury
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, bitmapInfoHeader.biWidth,
|
||||
bitmapInfoHeader.biHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, bitmapData);
|
||||
|
||||
if (bitmapData) free(bitmapData);
|
||||
|
||||
// ustalenie sposobu mieszania tekstury z tłem
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
break;
|
||||
|
||||
// Window is being destroyed, cleanup
|
||||
case WM_DESTROY:
|
||||
// Deselect the current rendering context and delete it
|
||||
wglMakeCurrent(hDC, NULL);
|
||||
wglDeleteContext(hRC);
|
||||
|
||||
// Delete the palette if it was created
|
||||
if (hPalette != NULL) DeleteObject(hPalette);
|
||||
|
||||
// Tell the application to terminate after the window
|
||||
// is gone.
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
|
||||
// Window is resized.
|
||||
case WM_SIZE:
|
||||
// Call our function which modifies the clipping
|
||||
// volume and viewport
|
||||
ChangeSize(LOWORD(lParam), HIWORD(lParam));
|
||||
break;
|
||||
|
||||
|
||||
// The painting function. This message sent by Windows
|
||||
// whenever the screen needs updating.
|
||||
case WM_PAINT:
|
||||
// Call OpenGL drawing code
|
||||
RenderScene();
|
||||
|
||||
SwapBuffers(hDC);
|
||||
|
||||
// Validate the newly painted client area
|
||||
ValidateRect(hWnd, NULL);
|
||||
break;
|
||||
|
||||
// Windows is telling the application that it may modify
|
||||
// the system palette. This message in essance asks the
|
||||
// application for a new palette.
|
||||
case WM_QUERYNEWPALETTE:
|
||||
// If the palette was created.
|
||||
if (hPalette) {
|
||||
int nRet;
|
||||
|
||||
// Selects the palette into the current device context
|
||||
SelectPalette(hDC, hPalette, FALSE);
|
||||
|
||||
// Map entries from the currently selected palette to
|
||||
// the system palette. The return value is the number
|
||||
// of palette entries modified.
|
||||
nRet = RealizePalette(hDC);
|
||||
|
||||
// Repaint, forces remap of palette in current window
|
||||
InvalidateRect(hWnd, NULL, FALSE);
|
||||
|
||||
return nRet;
|
||||
}
|
||||
break;
|
||||
|
||||
// This window may set the palette, even though it is not the
|
||||
// currently active window.
|
||||
case WM_PALETTECHANGED:
|
||||
// Don't do anything if the palette does not exist, or if
|
||||
// this is the window that changed the palette.
|
||||
if ((hPalette != NULL) && ((HWND)wParam != hWnd)) {
|
||||
// Select the palette into the device context
|
||||
SelectPalette(hDC, hPalette, FALSE);
|
||||
|
||||
// Map entries to system palette
|
||||
RealizePalette(hDC);
|
||||
|
||||
// Remap the current colors to the newly realized palette
|
||||
UpdateColors(hDC);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
// Key press, check for arrow keys to do cube rotation.
|
||||
case WM_KEYDOWN:
|
||||
|
||||
switch (wParam) {
|
||||
case VK_UP:
|
||||
xRot -= 5.0f;
|
||||
break;
|
||||
|
||||
case VK_DOWN:
|
||||
xRot += 5.0f;
|
||||
break;
|
||||
|
||||
case VK_LEFT:
|
||||
yRot -= 5.0f;
|
||||
break;
|
||||
|
||||
case VK_RIGHT:
|
||||
yRot += 5.0f;
|
||||
break;
|
||||
|
||||
case 'Q':
|
||||
zRot += 5.0f;
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
zRot -= 5.0f;
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
xRot = 0;
|
||||
yRot = 0;
|
||||
zRot = 0;
|
||||
break;
|
||||
|
||||
case ' ': // 32
|
||||
polygonmode = !polygonmode;
|
||||
break;
|
||||
|
||||
default:
|
||||
std::cout << "debug: nacisnieto nierozpoznany klawisz: " << (int)wParam << "\n";
|
||||
}
|
||||
|
||||
xRot = (const int)xRot % 360;
|
||||
yRot = (const int)yRot % 360;
|
||||
zRot = (const int)zRot % 360;
|
||||
|
||||
InvalidateRect(hWnd, NULL, FALSE);
|
||||
break;
|
||||
|
||||
// A menu command
|
||||
case WM_COMMAND:
|
||||
|
||||
switch (LOWORD(wParam)) {
|
||||
|
||||
// Exit the program
|
||||
case ID_FILE_EXIT:
|
||||
DestroyWindow(hWnd);
|
||||
break;
|
||||
|
||||
// Display the about box
|
||||
case ID_HELP_ABOUT:
|
||||
DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG_ABOUT), hWnd, (DLGPROC)AboutDlgProc);
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
default: // Passes it on if unproccessed
|
||||
return (DefWindowProc(hWnd, message, wParam, lParam));
|
||||
}
|
||||
|
||||
return (0L);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Dialog procedure.
|
||||
BOOL APIENTRY AboutDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam) {
|
||||
|
||||
switch (message) {
|
||||
// Initialize the dialog box
|
||||
case WM_INITDIALOG:
|
||||
int i;
|
||||
GLenum glError;
|
||||
|
||||
// glGetString demo
|
||||
SetDlgItemText(hDlg, IDC_OPENGL_VENDOR, reinterpret_cast<LPCSTR>(glGetString(GL_VENDOR)));
|
||||
SetDlgItemText(hDlg, IDC_OPENGL_RENDERER, (LPCSTR)glGetString(GL_RENDERER));
|
||||
SetDlgItemText(hDlg, IDC_OPENGL_VERSION, (LPCSTR)glGetString(GL_VERSION));
|
||||
SetDlgItemText(hDlg, IDC_OPENGL_EXTENSIONS, (LPCSTR)glGetString(GL_EXTENSIONS));
|
||||
|
||||
// gluGetString demo
|
||||
SetDlgItemText(hDlg, IDC_GLU_VERSION, (LPCSTR)gluGetString(GLU_VERSION));
|
||||
SetDlgItemText(hDlg, IDC_GLU_EXTENSIONS, (LPCSTR)gluGetString(GLU_EXTENSIONS));
|
||||
|
||||
|
||||
// Display any recent error messages
|
||||
i = 0;
|
||||
do {
|
||||
glError = glGetError();
|
||||
SetDlgItemText(hDlg, IDC_ERROR1 + i, (LPCSTR)gluErrorString(glError));
|
||||
i++;
|
||||
} while (i < 6 && glError != GL_NO_ERROR);
|
||||
|
||||
|
||||
return (TRUE);
|
||||
|
||||
break;
|
||||
|
||||
// Process command messages
|
||||
case WM_COMMAND:
|
||||
|
||||
// Validate and Make the changes
|
||||
if (LOWORD(wParam) == IDOK) EndDialog(hDlg, TRUE);
|
||||
break;
|
||||
|
||||
// Closed from sysbox
|
||||
case WM_CLOSE:
|
||||
|
||||
EndDialog(hDlg, TRUE);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
BIN
output.exe
Normal file
BIN
output.exe
Normal file
Binary file not shown.
2975
suzanne.obj
Normal file
2975
suzanne.obj
Normal file
File diff suppressed because it is too large
Load Diff
74
szescian.cpp
Normal file
74
szescian.cpp
Normal file
@@ -0,0 +1,74 @@
|
||||
#include "szescian.h"
|
||||
#include <windows.h>
|
||||
#include <gl\gl.h>
|
||||
#include <gl\glu.h>
|
||||
|
||||
void szescian::create(float x, float y, float z, float KRAWEDZ) {
|
||||
|
||||
this->c_x = x;
|
||||
this->c_y = y;
|
||||
this->c_z = z;
|
||||
|
||||
// Parametry wierzcholkow
|
||||
|
||||
GLfloat sa[3] = { x + 0.0f, y + 0.0f, z + 0.0f };
|
||||
GLfloat sb[3] = { x + KRAWEDZ, y + 0.0f, z + 0.0f };
|
||||
GLfloat sc[3] = { x + KRAWEDZ, y + KRAWEDZ, z + 0.0f };
|
||||
GLfloat sd[3] = { x + 0.0f, y + KRAWEDZ, z + 0.0f };
|
||||
GLfloat se[3] = { x + 0.0f, y + 0.0f, z - KRAWEDZ };
|
||||
GLfloat sf[3] = { x + KRAWEDZ, y + 0.0f, z - KRAWEDZ };
|
||||
GLfloat sg[3] = { x + KRAWEDZ, y + KRAWEDZ, z - KRAWEDZ };
|
||||
GLfloat sh[3] = { x + 0.0f, y + KRAWEDZ, z - KRAWEDZ };
|
||||
|
||||
// Sciany skladowe
|
||||
|
||||
glColor3f(1.0f, 0.0f, 0.0f);
|
||||
glBegin(GL_POLYGON);
|
||||
glVertex3fv(sa);
|
||||
glVertex3fv(sb);
|
||||
glVertex3fv(sc);
|
||||
glVertex3fv(sd);
|
||||
glEnd();
|
||||
|
||||
|
||||
glColor3f(0.0f, 1.0f, 0.0f);
|
||||
glBegin(GL_POLYGON);
|
||||
glVertex3fv(sb);
|
||||
glVertex3fv(sf);
|
||||
glVertex3fv(sg);
|
||||
glVertex3fv(sc);
|
||||
glEnd();
|
||||
|
||||
glColor3f(0.0f, 0.0f, 1.0f);
|
||||
glBegin(GL_POLYGON);
|
||||
glVertex3fv(sf);
|
||||
glVertex3fv(se);
|
||||
glVertex3fv(sh);
|
||||
glVertex3fv(sg);
|
||||
glEnd();
|
||||
|
||||
glColor3f(1.0f, 1.0f, 0.0f);
|
||||
glBegin(GL_POLYGON);
|
||||
glVertex3fv(se);
|
||||
glVertex3fv(sa);
|
||||
glVertex3fv(sd);
|
||||
glVertex3fv(sh);
|
||||
glEnd();
|
||||
|
||||
glColor3f(0.0f, 1.0f, 1.0f);
|
||||
glBegin(GL_POLYGON);
|
||||
glVertex3fv(sd);
|
||||
glVertex3fv(sc);
|
||||
glVertex3fv(sg);
|
||||
glVertex3fv(sh);
|
||||
glEnd();
|
||||
|
||||
glColor3f(1.0f, 0.0f, 1.0f);
|
||||
glBegin(GL_POLYGON);
|
||||
glVertex3fv(sa);
|
||||
glVertex3fv(sb);
|
||||
glVertex3fv(sf);
|
||||
glVertex3fv(se);
|
||||
glEnd();
|
||||
|
||||
}
|
||||
11
szescian.h
Normal file
11
szescian.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
class szescian
|
||||
{
|
||||
private:
|
||||
float c_x{0};
|
||||
float c_y{0};
|
||||
float c_z{0};
|
||||
public:
|
||||
void create(float x, float y, float z, float KRAWEDZ);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user