Jump to content
  • Advertisement

Devashish Khandelwal

Member
  • Content count

    4
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Devashish Khandelwal

  • Rank
    Newbie

Personal Information

  • Interests
    Art
    Design
    DevOps
    Programming

Social

  • Github
    https://github.com/Devashish0312

Recent Profile Visitors

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

  1. Devashish Khandelwal

    Uniforms

    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

    Uniforms

    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

    Uniforms

    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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!