Jump to content
  • Advertisement

Devashish Khandelwal

  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Devashish Khandelwal

  • Rank

Personal Information

  • Interests


  • Github

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Devashish Khandelwal


    Yeah, it is the shader's id. #include<string> class Shader { private: unsigned int m_RendererID; public: Shader(); ~Shader(); void Bind() const; void Unbind() const; //set uniforms void SetUniforms4f(const std::string& name, float v1, float v2, float v3, float v4); private: std::string ParseShader(std::string filename); unsigned int CreateShader(const std::string& vertexShader, const std::string& fragmentShader); unsigned int CompileShader(unsigned int type, const std::string& source); unsigned int GetUniformLocation(const std::string& name); };
  2. Devashish Khandelwal


    FRAGMENT SHADER: #version 330 core layout(location = 0) out vec4 color; uniform vec4 u_color; void main() { color = u_color; } AND THIS IS THE FUNCTION WHICH USES IT: unsigned int Shader::GetUniformLocation(const std::string& name) { int location = glGetUniformLocation(m_RendererID, name.c_str()); if (location == -1) { cout << "Warning :uniform" << name << " does not exist"; } return location; } I've handled the situation when location becomes -1 and therefore in the output, it's just showing Warning:uniform u_color does not exist.
  3. Devashish Khandelwal


    So, how do i make the Uniform Active? bdw thanks for the reply
  4. Devashish Khandelwal

    OpenGL Uniforms

    While writing a simple renderer using OpenGL, I faced an issue with the glGetUniformLocation function. For some reason, the location is coming to be -1. Anyone has any idea .. what should I do?
  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!