Hi!
Been getting 2 leaks because of vertexShaderSource and fragmentShaderSource but have been able to delete them using:
Is this a known problem with shaders because of glDeleteShader? Please, let me know.
Thank you !
Been getting 2 leaks because of vertexShaderSource and fragmentShaderSource but have been able to delete them using:
delete[] vertexShaderSource;
delete[] fragmentShaderSource;
Been getting HEAP CORRUPTION despite by best efforts.Is this a known problem with shaders because of glDeleteShader? Please, let me know.
Thank you !
bool Shader::loadShader(std::string shaderName, ShaderType shaderType, const char* vertexShaderFile, const char* fragmentShaderFile) {
GLuint vertexShaderID, fragmentShaderID;
m_shaderType = shaderType;
m_shaderID = glCreateProgram();
seekShader(vertexShaderFile);
char* vertexShaderSource = new char[m_shaderCodeLenght + 1];
readShader(vertexShaderFile, vertexShaderSource);
seekShader(fragmentShaderFile);
char* fragmentShaderSource = new char[m_shaderCodeLenght + 1];
readShader(fragmentShaderFile, fragmentShaderSource);
compileShader(vertexShaderID, GL_VERTEX_SHADER, vertexShaderSource);
compileShader(fragmentShaderID, GL_FRAGMENT_SHADER, fragmentShaderSource);
linkShader(m_shaderID, vertexShaderID, fragmentShaderID);
glDeleteShader(vertexShaderID);
glDeleteShader(fragmentShaderID);
delete[] vertexShaderSource; // ???
delete[] fragmentShaderSource; // ???
glUseProgram(0);
return true;
}