For some reason I can apply my uniforms to shaders in one place but not another

I actually did the right debugging to find this. I am doing a section on lighting

This is a lesson that I am following Youtube OpenGL

this is the shader:

#version 330 core

struct Material{
vec3 ambient;
vec3 diffuse;
vec3 specular;
float shineness;
};

struct Light{
vec3 position;
vec3 ambient
vec3 diffuse;
vec3 specular;
};

in vec3 frag_pos;
in vec3 normal;
in vec2 texCoord;
out vec4 frag_color;

//uniform sampler2D texture1;
//uniform sampler2D texture2;

uniform Material material;
uniform Light light;
uniform vec3 viewPos;
uniform vec3 Lightambient;
void main(){
	vec3 ambient = material.ambient * light.ambient;
	//vec3 ambient = vec3(0.75);
	vec3 norm = normalize(normal);
	vec3 lightDir = normalize(light.position - frag_pos);
	float diff = max(dot(norm, light.position), 0.0);
	vec3 diffuse = light.diffuse * diff * material.diffuse;
	vec3 viewDir = normalize(viewPos - frag_pos);
	vec3 reflectDir = reflect(-lightDir, norm);
	float specular = pow(max(dot(viewDir, reflectDir), 0), 128 * material.shineness);
	vec3 specu = light.specular * specular * material.specular;
	frag_color = vec4(vec3(Lightambient + diffuse + specular ), 1.0);
	//frag_color = vec4(material.specular, 1);
}

what I know is that I got the case right because he uses the same name for things. As you can see the last line I tested the material property I also tested the light property which comes up with just Black. Of course these are used in different classes which I think have something to do with it.

part of the main is

Cube cube(Material::emerald, glm::vec3(0, 0, -1), glm::vec3(0.75f));
	cube.init();

	Lamp1 lamp(glm::vec3(1.0f), glm::vec3(1.0f, 1.0f, 1.0f), glm::vec3(1.0f), glm::vec3(1.0f), glm::vec3(-1, -0.5, -0.5), glm::vec3(0.25f));
	lamp.init();
	shade.setUniform("light.position", lamp.position);
	shade.setUniform("viewPos", cam.cameraPos);
	shade.setUniform("Lightambient", lamp.ambient);
	shade.setUniform("light.diffuse", lamp.diffuse);
	shade.setUniform("light.specular", lamp.specular);
	double lastTime = 0;
	while (!scrn.shouldClose()) {
		double currentTime = glfwGetTime();
		deltaTime = currentTime - lastTime;
		lastTime = currentTime;
		processInput();
		scrn.update();
		shade.activate();
		

		//glm::mat4 trans(1.0f);
		//trans = glm::rotate(trans, glm::radians((float)glfwGetTime() / 1.0f), glm::vec3(0, 0, 1));

		
		glm::mat4 view = glm::mat4(1.0);

		glm::mat4 projection = glm::mat4(1.0);
		
		
		view = cam.getViewMatrix();
		projection = glm::perspective(glm::radians(cam.getZoom()), (float)width / (float)height, 0.1f, 100.0f);

		shade.activate();
		shade.setUniform("viewPos", cam.cameraPos);
		shade.setUniform("view", view);
		shade.setUniform("projection", projection);
		cube.render(shade);
		
		lampShade.activate();
		lampShade.setUniform("view", view);
		lampShade.setUniform("projection", projection);
		lamp.render(lampShade);
		glDrawArrays(GL_TRIANGLES, 0, 36);
		//glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
		
		scrn.newFrame();

	}

the light:

#include "Cube.hpp"

class Lamp1 : public Cube {
public:
	glm::vec3 lightColor;
	glm::vec3 ambient;
	glm::vec3 diffuse;
	glm::vec3 specular;
	Lamp1(glm::vec3 lig, glm::vec3 amb, glm::vec3 dif, glm::vec3 spec, glm::vec3 pos, glm::vec3 siz) // add material
		:lightColor(lig), ambient(amb), diffuse(dif), specular(spec), Cube(Material::white_plastic, pos, siz)
	{
		
	}
	void render(Shader shade) {
		shade.setUniform("lightColor", lightColor);
		Cube::render(shade);
	}
};

the cube:

#include "../Model.h"
#include "../material.h"

class Cube : public Model {
public:
	glm::vec3 position;
	glm::vec3 size;
    Material material;
	Cube(Material material, glm::vec3 pos, glm::vec3 siz) // add material
		:material(material), position(pos), size(siz)
	{}
	void init() {
		int numVerts = 36;
        float vertices[] = {
            // position                 normal              texcoord
            -0.5f, -0.5f, -0.5f,     0.0f,  0.0f, -1.0f,    0.0f, 0.0f,
             0.5f, -0.5f, -0.5f,     0.0f,  0.0f, -1.0f,    1.0f, 0.0f,
             0.5f,  0.5f, -0.5f,     0.0f,  0.0f, -1.0f,    1.0f, 1.0f,
             0.5f,  0.5f, -0.5f,     0.0f,  0.0f, -1.0f,    1.0f, 1.0f,
            -0.5f,  0.5f, -0.5f,     0.0f,  0.0f, -1.0f,    0.0f, 1.0f,
            -0.5f, -0.5f, -0.5f,     0.0f,  0.0f, -1.0f,    0.0f, 0.0f,

            -0.5f, -0.5f,  0.5f,     0.0f,  0.0f,  1.0f,    0.0f, 0.0f,
             0.5f, -0.5f,  0.5f,     0.0f,  0.0f,  1.0f,    1.0f, 0.0f,
             0.5f,  0.5f,  0.5f,     0.0f,  0.0f,  1.0f,    1.0f, 1.0f,
             0.5f,  0.5f,  0.5f,     0.0f,  0.0f,  1.0f,    1.0f, 1.0f,
            -0.5f,  0.5f,  0.5f,     0.0f,  0.0f,  1.0f,    0.0f, 1.0f,
            -0.5f, -0.5f,  0.5f,     0.0f,  0.0f,  1.0f,    0.0f, 0.0f,

            -0.5f,  0.5f,  0.5f,    -1.0f,  0.0f,  0.0f,    1.0f, 0.0f,
            -0.5f,  0.5f, -0.5f,    -1.0f,  0.0f,  0.0f,    1.0f, 1.0f,
            -0.5f, -0.5f, -0.5f,    -1.0f,  0.0f,  0.0f,    0.0f, 1.0f,
            -0.5f, -0.5f, -0.5f,    -1.0f,  0.0f,  0.0f,    0.0f, 1.0f,
            -0.5f, -0.5f,  0.5f,    -1.0f,  0.0f,  0.0f,    0.0f, 0.0f,
            -0.5f,  0.5f,  0.5f,    -1.0f,  0.0f,  0.0f,    1.0f, 0.0f,

             0.5f,  0.5f,  0.5f,     1.0f,  0.0f,  0.0f,    1.0f, 0.0f,
             0.5f,  0.5f, -0.5f,     1.0f,  0.0f,  0.0f,    1.0f, 1.0f,
             0.5f, -0.5f, -0.5f,     1.0f,  0.0f,  0.0f,    0.0f, 1.0f,
             0.5f, -0.5f, -0.5f,     1.0f,  0.0f,  0.0f,    0.0f, 1.0f,
             0.5f, -0.5f,  0.5f,     1.0f,  0.0f,  0.0f,    0.0f, 0.0f,
             0.5f,  0.5f,  0.5f,     1.0f,  0.0f,  0.0f,    1.0f, 0.0f,

            -0.5f, -0.5f, -0.5f,     0.0f, -1.0f,  0.0f,    0.0f, 1.0f,
             0.5f, -0.5f, -0.5f,     0.0f, -1.0f,  0.0f,    1.0f, 1.0f,
             0.5f, -0.5f,  0.5f,     0.0f, -1.0f,  0.0f,    1.0f, 0.0f,
             0.5f, -0.5f,  0.5f,     0.0f, -1.0f,  0.0f,    1.0f, 0.0f,
            -0.5f, -0.5f,  0.5f,     0.0f, -1.0f,  0.0f,    0.0f, 0.0f,
            -0.5f, -0.5f, -0.5f,     0.0f, -1.0f,  0.0f,    0.0f, 1.0f,

            -0.5f,  0.5f, -0.5f,     0.0f,  1.0f,  0.0f,    0.0f, 1.0f,
             0.5f,  0.5f, -0.5f,     0.0f,  1.0f,  0.0f,    1.0f, 1.0f,
             0.5f,  0.5f,  0.5f,     0.0f,  1.0f,  0.0f,    1.0f, 0.0f,
             0.5f,  0.5f,  0.5f,     0.0f,  1.0f,  0.0f,    1.0f, 0.0f,
            -0.5f,  0.5f,  0.5f,     0.0f,  1.0f,  0.0f,    0.0f, 0.0f,
            -0.5f,  0.5f, -0.5f,     0.0f,  1.0f,  0.0f,    0.0f, 1.0f
        };

		vector<unsigned int> induces(numVerts);
		for (int i = 0; i < numVerts; i++) {
			induces[i] = i;
		}
		Texture tex1("images/airplane_512x512.png", "texture0");
		tex1.load();
		Texture tex2("images/tunnel.bmp", "texture1");
		tex2.load();
		meshes.push_back(Mesh(Vertex::genList(vertices, numVerts), induces, { tex1, tex2 }));
	}
	void render(Shader shade) {
		glm::mat4 model(glm::mat4(1.0f));
		model = glm::translate(model, position);
		model = glm::rotate(model, (float)glfwGetTime() * glm::radians(-55.0f), glm::vec3(0.5f));
		model = glm::scale(model, size);
		
		shade.setUniform("model", model);
        shade.setUniform("material.ambient", material.ambient);
        shade.setUniform("material.diffuse", material.diffuse);
        shade.setUniform("material.specular", material.specular);
        shade.setUniform("material.shineness", material.shininess);
		Model::render(shade);
	}
};

In the future, please don’t post code with GL calls buried in a bunch of wrappers. It’s not a given or necessarily even obvious what those do.

Here though, we can guess. Notice anything about the above subset?

Do you see a shade.activate() before setting up the light.* uniforms?

You need to bind the shader program before you can set old-style global-scope uniforms using glUniform…().

By contrast, note that you do not need to bind the program first if you instead use a Direct State Access (DSA) API call for that, like glProgramUniform…().

I would suggest that you stop burying GL calls within abstractions until you really lock-in how OpenGL work. Then add the abstractions that make sense from a performance perspective. Fewer abstractions is typically better, from a code clarity and performance perspective.