Hello Guest

Vertex array not initialized (New Problem, OpenGL)

  • 24 Replies
  • 251 Views
Re: JVM Error (OpenGL)
« Reply #15 on: June 07, 2018, 19:30:15 »
Would I create the thread in the main class instead then?

*

Offline KaiHH

  • **
  • 97
Re: JVM Error (OpenGL)
« Reply #16 on: June 07, 2018, 19:32:07 »
Would I create the thread in the main class instead then?
No, you would not create ANY thread manually. The thread has already been created by the operating system, which like I said three times now is executing your Java program just fine. It IS ALREADY a thread and you should not do anything like creating yet another useless thread.

Regarding the pastebin: You have A WHOLE LOT of OpenGL errors in your application. You MUST resolve those before continuing. Basically almost all of your calls generate OpenGL errors because you either feed them invalid arguments or they are being executed at a wrong time.

Re: JVM Error (OpenGL)
« Reply #17 on: June 07, 2018, 19:40:24 »
** removed by Spasi **
« Last Edit: June 07, 2018, 20:23:43 by spasi »

*

Offline spasi

  • *****
  • 2006
    • WebHotelier
Re: JVM Error (OpenGL)
« Reply #18 on: June 07, 2018, 20:22:57 »
User bananajoe banned for the above reply.

Re: Vertex array not initialized (New Problem, OpenGL)
« Reply #19 on: June 10, 2018, 18:20:49 »
So I managed to fix most of the errors by redoing the whole code but now I have a new issue:
Code: [Select]
[error][1] Vertex array [0] enabled but not initialized
  Stacktrace: Engine.Renderer.render(Renderer.java:37)
              Game.gameLoop.loop(gameLoop.java:63)
              Game.gameLoop.main(gameLoop.java:19)
How do you initialize a vertex array?

*

Offline KaiHH

  • **
  • 97
Re: Vertex array not initialized (New Problem, OpenGL)
« Reply #20 on: June 10, 2018, 19:02:40 »
How do you initialize a vertex array?
By calling glVertexAttribPointer(...) (or one of its fixed-function pipeline equivalents) while having the VBO bound to GL_ARRAY_BUFFER via glBindBuffer(...).

EDIT: Also please re-download the LWJGLX/debug Addon from https://www.lwjgl.org/customize. There have been changes to improve the error logging.
« Last Edit: June 10, 2018, 19:09:11 by KaiHH »

Re: Vertex array not initialized (New Problem, OpenGL)
« Reply #21 on: June 10, 2018, 19:06:38 »
I do have the pointer, but I changed the GL_ARRAY_BUFFER to GL_ELEMENT_ARRAY_BUFFER because I'm using glDrawElements(), do I have to only use gl array buffer for initializing?

*

Offline KaiHH

  • **
  • 97
Re: Vertex array not initialized (New Problem, OpenGL)
« Reply #22 on: June 10, 2018, 19:08:46 »
If you do indexed rendering with glDrawElements(), then you need both. You need the actual vertex data (which is stored in the vertex attributes that you enable via glEnableVertexArray() and initialize via glVertexAttribPointer()) and you need the element/index buffer, which you bind via glBindBuffer() and GL_ELEMENT_ARRAY_BUFFER.

Re: Vertex array not initialized (New Problem, OpenGL)
« Reply #23 on: June 10, 2018, 19:50:52 »
I'm a little confused on what you mean, here is the part that was in question:
Code: [Select]
GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, vboID);
GL15.glBufferData(GL15.GL_ELEMENT_ARRAY_BUFFER, flipByteBuffer(indice.indices), GL15.GL_DYNAMIC_DRAW);
GL20.glVertexAttribPointer(attributeNumber, 3, GL11.GL_FLOAT, false, 0, 0);
GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0);


*

Offline KaiHH

  • **
  • 97
Re: Vertex array not initialized (New Problem, OpenGL)
« Reply #24 on: June 10, 2018, 20:02:10 »
The element/index array buffer, bound to GL_ELEMENT_ARRAY_BUFFER, is not a vertex attribute. You can only enable and initialize vertex attributes.
Before you continue, please go ahead and search for "OpenGL VBO" tutorials and examples and read them.