Results 1 to 3 of 3

Thread: OpenGL shaders not properly rendering from buffers

  1. #1
    Newbie Newbie
    Join Date
    Jan 2019
    Posts
    1

    OpenGL shaders not properly rendering from buffers

    Hello,

    This is my first time posting here. I am currently trying to develop on OpenGL (ft. GLFW) program in C. My intent with this program is to render a series of 2-dimensional squares in a window, that will all be different colors. I set the default background color to a neon blue color for error testing. Also, before I set-up the color-chaning code, I set all of the squares to a full-blue color to make sure it worked. However, rather than a full-blue screen, I saw a neon-blue screen. I believe that either my shaders are disfunctional or I have improperly set up my buffers for reading. I am relatively new to OpenGL, so I don't know how to properly feed buffers into my shaders. What am I doing wrong?

    Here is my source code: https://pastebin.com/Wsu3ZTSB

  2. #2
    Senior Member Regular Contributor
    Join Date
    Oct 2014
    Posts
    109
    Not sure here if there isn't a default VAO but i didn't see you generating one. Try adding one before buffer creation
    Code :
    GLuint VAO;
    glCreateVertexArrays(1, &VAO);
    glBindVertexArray(&VAO);

  3. #3
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    3,103
    Quote Originally Posted by ProgrammerX View Post
    Not sure here if there isn't a default VAO
    The code uses the core profile:
    Code :
    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
    which doesn't have a default VAO.

    glVertexAttribPointer() and glEnableVertexAttrib() array should both generate GL_INVALID_OPERATION errors if called when no VAO is bound.

Similar Threads

  1. Shaders not attaching properly when linking.
    By SpacePotato in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 11-19-2018, 11:20 AM
  2. OpenGL VAO and shaders not rendering
    By wlad031 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 06-02-2016, 04:20 AM
  3. Compute shaders not working properly
    By Gefest in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 12-04-2015, 04:52 PM
  4. Geometry shaders not passing flat data properly
    By BenFoppa in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 09-21-2014, 05:05 PM
  5. How to properly create Read and Write Buffers:
    By Gamingdrake in forum OpenCL
    Replies: 7
    Last Post: 06-10-2011, 10:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean