Hello Guest

LWJGL draws nothing to the screen

  • 1 Replies
  • 330 Views
LWJGL draws nothing to the screen
« 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

*

Offline KaiHH

  • ****
  • 260
Re: LWJGL draws nothing to the screen
« Reply #1 on: April 07, 2020, 19:15:16 »
You have two errors in your code:
1.
Change:
Code: [Select]
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementBufferObject);
        glBufferData(GL_ELEMENT_ARRAY_BUFFER, elementBufferObject, GL_STATIC_DRAW);
to:
Code: [Select]
        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.