-
Notifications
You must be signed in to change notification settings - Fork 0
/
shaderprogram.h
26 lines (20 loc) · 1005 Bytes
/
shaderprogram.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef SHADERPROGRAM_H
#define SHADERPROGRAM_H
#include <GL/glew.h>
#include "stdio.h"
class ShaderProgram {
private:
GLuint shaderProgram; //Uchwyt reprezentujący program cieniujacy
GLuint vertexShader; //Uchwyt reprezentujący vertex shader
GLuint geometryShader; //Uchwyt reprezentujący geometry shader
GLuint fragmentShader; //Uchwyt reprezentujący fragment shader
char* readFile(const char* fileName); //metoda wczytująca plik tekstowy do tablicy znaków
GLuint loadShader(GLenum shaderType,const char* fileName); //Metoda wczytuje i kompiluje shader, a następnie zwraca jego uchwyt
public:
ShaderProgram(const char* vertexShaderFile,const char* geometryShaderFile,const char* fragmentShaderFile);
~ShaderProgram();
void use(); //Włącza wykorzystywanie programu cieniującego
GLuint u(const char* variableName); //Pobiera numer slotu związanego z daną zmienną jednorodną
GLuint a(const char* variableName); //Pobiera numer slotu związanego z danym atrybutem
};
#endif