-
Notifications
You must be signed in to change notification settings - Fork 2
/
shaderService.h
93 lines (77 loc) · 2.66 KB
/
shaderService.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
* shaderService.h
*
* Copyright (c) 2015-2016 Dany Vohl, David G. Barnes, Christopher J. Fluke,
* Yuri Benovitski, Tsz Ho Wong, Owen L Kaluza, Toan D. Nguyen.
*
* This file is part of encube.
*
* encube is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* encube is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with encube. If not, see <http://www.gnu.org/licenses/>.
*
* We would appreciate it if research outcomes using encube would
* provide the following acknowledgement:
*
* "Visual analytics of multidimensional data was conducted with encube."
*
* and a reference to
*
* Dany Vohl, David G. Barnes, Christopher J. Fluke, Govinda Poudel, Nellie Georgiou-Karistianis,
* Amr H. Hassan, Yuri Benovitski, Tsz Ho Wong, Owen L Kaluza, Toan D. Nguyen, C. Paul Bonnington. (2016).
* Large-scale comparative visualisation of sets of multidimensional data. PeerJ Computer Science, In Press.
*
*/
#ifndef __ShaderService_H__
#define __ShaderService_H__
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
//#include "s2opengl.h"
#include <GL/glew.h>
//#include <GLUT/glut.h>
#define printOpenGLError() printOglError(__FILE__, __LINE__)
typedef enum {
EVertexShader,
EGeometryShader,
EFragmentShader,
} EShaderType;
typedef struct {
GLuint vsObject;
GLuint gsObject;
GLuint fsObject;
GLuint prgObject;
GLchar* vertexShader;
GLchar* geometryShader;
GLchar* fragmentShader;
int iGS;
int iFS;
} shaderService;
// public call: initialize shaders
int initShaderService(shaderService *ss, char *fileName, int _igs, int _ifs);
// destroy shaders
int destroyShaderService(shaderService *ss);
int install(shaderService *ss, char *fileName);
int readShaderSource(shaderService *ss, char *fileName);
int installShaders(shaderService *ss);
// public functions
GLint getAttriLoc(shaderService *ss, const GLchar* name);
GLint getUniLoc(shaderService *ss, const GLchar* name);
// END: public functions
int shaderSize(char *fileName, int shaderType);
int readShader(char *fileName, int shaderType, char *shaderText, int size);
int printOglError(char* file, int line);
void printShaderInfoLog(GLuint shader);
void printProgramInfoLog(GLuint program);
int testit(shaderService *ss);
#endif