Jump to content
  • Advertisement
Sign in to follow this  
Jacob Jingle

OpenGL glCreateProgram Access Violation

This topic is 2497 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Can anyone please explain to me why I'm getting a "First-chance exception at 0x58b240b0 in control.exe: 0xC0000005: Access violation reading location 0x0000000001fbe4" for the unordered map below?


class Pipeline
{
public:
GLuint LoadShaderProg(std::string name)
{
GLuint program = OpenGL::glCreateProgram();
m_shadProgs.insert(std::pair<std::string, GLuint>(name, program)); //comment this out and I get no error and program works fine
return program;
}
std::unordered_map<std::string, GLuint> m_shadProgs;
}


Thx ahead of time for help,
JJ

Share this post


Link to post
Share on other sites
Advertisement
If your Pipeline instance definitely valid? I.e. you're not trying to call LoadShaderProg on an invalid pointer? How do you call LoadShaderProg?

Share this post


Link to post
Share on other sites

If your Pipeline instance definitely valid? I.e. you're not trying to call LoadShaderProg on an invalid pointer? How do you call LoadShaderProg?

Yes, but for some reason just inserting it into the map makes it invalid. If I comment out the line with the insert then my program works fine. I just don't understand.


namespace program
{
enum type
{
VERT,
GEOM,
FRAG,
MAX
};
}

class Pipeline
{
public:
GLuint LoadShaderProg(std::string name)
{
GLuint program = OpenGL::glCreateProgram();
m_shadProgs.insert(std::pair<std::string, GLuint>(name, program)); //comment this out and I get no error and program works fine
return program;
}
std::unordered_map<std::string, GLuint> m_shadProgs;
}
class Rect
{
Public:
void CreateStages()
{
m_programIDs[program::VERT] = m_pipe.LoadShaderProg(std::string("min.vert"));
m_programIDs[program::FRAG] = m_pipe.LoadShaderProg(std::string("min.frag"));

glUseProgramStages(m_pipelineID, GL_VERTEX_SHADER_BIT, m_programIDs[program::VERT]);
glUseProgramStages(m_pipelineID, GL_FRAGMENT_SHADER_BIT, m_programIDs[program::FRAG]);
}
Pipeline m_pipe;
GLuint m_programIDs[program::MAX];
GLuint m_pipelineID;
};

Share this post


Link to post
Share on other sites
Hmmm, I deleted out most of the code in Pipeline and now just declaring the it(below) causes the same error....


class Pipeline
{
public:
std::unordered_map<std::string, GLuint> m_shadProgs;
};


I get same error if I change it to vector, etc. I dunno, heap corruption?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!