feature/imgui-sdl
Last change
on this file was 0b1b52d, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 5 years ago |
In openglgame, port over the functionality to specify and initialize varying attributes
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[3de31cf] | 1 | #ifndef _GRAPHICS_PIPELINE_OPENGL_H
|
---|
| 2 | #define _GRAPHICS_PIPELINE_OPENGL_H
|
---|
| 3 |
|
---|
[0b1b52d] | 4 | #include "graphics-pipeline.hpp"
|
---|
| 5 |
|
---|
| 6 | #include <vector>
|
---|
| 7 |
|
---|
[3de31cf] | 8 | #include <GL/glew.h>
|
---|
| 9 |
|
---|
[0b1b52d] | 10 | enum VaryingAttribType {
|
---|
| 11 | ATTRIB_OBJECT_VARYING,
|
---|
| 12 | ATTRIB_POINT_VARYING,
|
---|
| 13 | };
|
---|
| 14 |
|
---|
| 15 | // TODO: Might be better to create a different struct for uniform attributes
|
---|
| 16 | struct VaryingAttribInfo {
|
---|
| 17 | VaryingAttribType attribType;
|
---|
| 18 | GLuint index;
|
---|
| 19 | GLint size;
|
---|
| 20 | GLenum type;
|
---|
| 21 | // UniformType uniType;
|
---|
| 22 | GLuint buffer; // For uniforms, this is the uniform location
|
---|
| 23 | size_t fieldOffset;
|
---|
| 24 | // GLfloat* data; // pointer to data source for uniform attributes
|
---|
| 25 | };
|
---|
[3de31cf] | 26 |
|
---|
| 27 | class GraphicsPipeline_OpenGL : public GraphicsPipeline {
|
---|
| 28 | public:
|
---|
[0b1b52d] | 29 | GraphicsPipeline_OpenGL(Viewport viewport);
|
---|
[3de31cf] | 30 | ~GraphicsPipeline_OpenGL();
|
---|
| 31 |
|
---|
[0b1b52d] | 32 | void addVaryingAttribute(VaryingAttribType attribType, GLint size, GLenum type, size_t fieldOffset);
|
---|
[3de31cf] | 33 | void createPipeline(string vertShaderFile, string fragShaderFile);
|
---|
| 34 |
|
---|
| 35 | private:
|
---|
| 36 | GLuint shaderProgram;
|
---|
| 37 | GLuint vao;
|
---|
| 38 | unsigned int numPoints;
|
---|
| 39 |
|
---|
[0b1b52d] | 40 | vector<VaryingAttribInfo> varyingAttribs;
|
---|
| 41 |
|
---|
[3de31cf] | 42 | GLuint loadShaderProgram(string vertShaderFile, string fragShaderFile);
|
---|
| 43 | GLuint loadShader(GLenum type, string file);
|
---|
| 44 | };
|
---|
| 45 |
|
---|
| 46 | #endif // _GRAPHICS_PIPELINE_OPENGL_H
|
---|
Note:
See
TracBrowser
for help on using the repository browser.