Weird problem using multiple shader programs

Hey guys,
I’m currently trying to use 2 different shader programs.
But I have a weird problem:
Here my OpenGL initialization code


glewExperimental = GL_TRUE;
		glewInit();
                //loads the given vertex shader
		auto d_vertex_shader = xEngine->asset_manager().get_asset<asset::shader>("std.vs");
                //loads the given fragment shader
		auto d_fragment_shader = xEngine->asset_manager().get_asset<asset::shader>("std.fs");
		auto d_program = std::make_shared<graphics::shader_program>("default", d_vertex_shader, d_fragment_shader, "out_color");

		d_program->set_uniform<glm::mat4>("projection", glm::perspective(glm::radians(45.0f), 4.0f/3.0f, 0.1f, 1000.0f));

		auto f_vertex_shader = xEngine->asset_manager().get_asset<asset::shader>("frame.vs");
		auto f_fragment_shader = xEngine->asset_manager().get_asset<asset::shader>("frame.fs");
		auto f_program = std::make_shared<graphics::shader_program>("frame", f_vertex_shader, f_fragment_shader, "out_color");

Heres the construction of a shaderprogram


shader_program::shader_program(std::string name, asset::shared_shader v, asset::shared_shader gOrf, std::string data_location)
    {
		if(v->shader_type() != gOrf->shader_type() && (v->shader_type() == GL_VERTEX_SHADER || gOrf->shader_type() == GL_VERTEX_SHADER)){
            std::cout << "Program erfolgreich gelinkt" << std::endl;
            program = glCreateProgram();
	    glAttachShader(program, v->id());
            glAttachShader(program, gOrf->id());
	    shader_[v->shader_type()] = v;
	    shader_[gOrf->shader_type()] = gOrf;
            glBindFragDataLocation(program, 0, data_location.c_str());
            glLinkProgram(program);
            glUseProgram(program);
            xEngine->rendering_system().register_program(name, std::make_shared<shader_program>(*this));
        }
    }

My programs have the ids 3 and 6.
Whenever I use glUseProgram((3 or 6)) it doesn’t work.
Only the last program initialized is used entirely.

I hope you know this problem.
Thank you :wink:

You don’t appear to be checking the link status of your program.

Beyond that, there’s not much point in asking other people to debug your code based upon isolated fragments. More often than not, the problem lies in the code which wasn’t posted.

And if your program is sufficiently complex that OOP makes sense, it’s too complex to expect other people to familiarise themselves with it. So don’t use OOP unless you’re confident that you sort out any problems yourself.

Re-write it in C, and if the problem doesn’t vanish or become obvious (which it probably will), post that.