Hello again all,
I’ve made a shader class that will handle all my compiling and error handling, but to my horror, the easiest part decided to stop me from finishing.
I decided to make a struct called ShaderProgram that would contain my two shaders so I can just enable and disable each program to get a desired effect, though I feel this is a good idea, the problem is the glCreateProgram() method, throwing me a memory access violation.
Glew reports My OpenGL version as 4.2.
GLuint Prog = glCreateProgram();
Will, in any class or function, throw the memory violation error.
// This may actually be ignored, if not, feel free to scorn me about any bad code.
My code as follows:
// My include block (Way at the top) (all headers are working and linked)
#pragma once
#include <gl\glew.h>
#include <glm\glm.hpp>
#include <stdio.h>
#include <FlakPath.h> // Simple file-path class
#include <map>
using namespace std;
struct ShaderProgram
{
GLuint mProgram;
SHADER mVertex,mFragment;
void Shader_DualDebug()
{
cout << "
*Vertex*
";
mVertex.Print_Textual_State();
cout << "
*Fragment*
";
mFragment.Print_Textual_State();
}
// **************************************
// Error Occurs Here, inside the method
// **************************************
ShaderProgram(){mProgram = glCreateProgram();}
void Activate(string Vertex,string Fragment,bool _Compile = false, bool _Use = false)
{
mVertex.Set_Data(GL_VERTEX_SHADER,Vertex);
mFragment.Set_Data(GL_FRAGMENT_SHADER,Fragment);
if (_Compile)
{
mVertex.Compile();
mFragment.Compile();
}
if (_Use)
{
mVertex.Attach(mProgram);
mFragment.Attach(mProgram);
}
}
// Error Occurs Here also, on the CreateProgram line (again, a memory error)
ShaderProgram(string Vertex,string Fragment,bool _Compile = false, bool _Use = false)
{
mProgram = glCreateProgram();
Activate(Vertex,Fragment,_Compile,_Use);
}
};
Any help would be much appreciated.