LWJGL Forum

Programming => OpenGL => Topic started by: user1992 on April 07, 2020, 18:51:23

Title: LWJGL draws nothing to the screen
Post by: user1992 on April 07, 2020, 18:51:23
Hey guys, im trying to display a quad using OpenGL 4.5, but it draws nothing on the screen. I have VBA, VBO, EBO, shader(compiled and linked), but it only draws the clear color .
Here is my main java class: https://hastebin.com/ehumuqaqap.cpp
Title: Re: LWJGL draws nothing to the screen
Post by: KaiHH on April 07, 2020, 19:15:16
You have two errors in your code:
1.
Change:

        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementBufferObject);
        glBufferData(GL_ELEMENT_ARRAY_BUFFER, elementBufferObject, GL_STATIC_DRAW);

to:

        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementBufferObject);
        glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices, GL_STATIC_DRAW);


And then do not disable the shader by calling glUseProgram(0); // <- will DISABLE the shader.