LWJGL Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 8 9 [10]
 91 
 on: November 01, 2017, 11:35:52 
Started by Joona - Last post by Joona
Not posting to bugs-section since I'm not sure if I'm just confused about the usage of glVertexArray* -functions.

TL;DR: the triangle I draw on the screen isn't displayed unless I explicitly bind the VAO before using glVertexArrayAttribFormat. GetError() returns the code 1282, GL_INVALID_OPERATION. getVersion returns 4.5.0 NVIDIA 385.41. Using other methods (glVertexAttribPointer, glVertexAttribFormat) to upload the vbo to the vao works.

To my understanding the whole point of the DSA-functions was to not have to explicitly bind the buffers.


I have simple data to represent a triangle in a vbo like so:
Code: [Select]
float size = 1.0f;
float[] triData = new float[]
{
0,      size,
-size, -size,
size, -size
};
FloatBuffer triDataFB = BufferUtils.createFloatBuffer( triData.length );
triDataFB.put( triData );
triDataFB.flip();

int vbo = GL15.glGenBuffers();
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vbo);
GL15.glBufferData(GL15.GL_ARRAY_BUFFER, triDataFB, GL15.GL_STATIC_DRAW);
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);

If I use glVertexAttribPointer, or glVertexAttribFormat to upload the vbo, the triangle will be visible:
Code: [Select]
GL30.glBindVertexArray(vao);
{
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vbo);
GL20.glVertexAttribPointer(0, 2, GL11.GL_FLOAT, false, 0, 0);
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);

GL20.glEnableVertexAttribArray(0);
}
GL30.glBindVertexArray(0);

Code: [Select]
GL30.glBindVertexArray(vao);
{
GL43.glVertexAttribFormat(0, 2, GL11.GL_FLOAT, false, 0);

GL43.glVertexAttribBinding(0, 0);
GL43.glBindVertexBuffer(0, vbo, 0, 2 * Float.BYTES);

GL20.glEnableVertexAttribArray(0);
}
GL30.glBindVertexArray(0);

However, using exactly the same method for uploading data, just with glVertexArray* -functions, the triangle is not shown anymore. The error code 1282, GL_INVALID_OPERATION is given.
Code: [Select]
GL45.glVertexArrayAttribFormat(vao, 0, 2, GL11.GL_FLOAT, false, 0);

GL45.glVertexArrayAttribBinding(vao, 0, 0);
GL45.glVertexArrayVertexBuffer(vao, 0, vbo, 0, 2 * Float.BYTES);

GL45.glEnableVertexArrayAttrib(vao, 0);

For some reason binding the vao momentarily sets the triangle visible again:
Code: [Select]
GL30.glBindVertexArray(vao);
GL45.glVertexArrayAttribFormat(vao, 0, 2, GL11.GL_FLOAT, false, 0);
GL30.glBindVertexArray(0);

GL45.glVertexArrayAttribBinding(vao, 0, 0);
GL45.glVertexArrayVertexBuffer(vao, 0, vbo, 0, 2 * Float.BYTES);

GL45.glEnableVertexArrayAttrib(vao, 0);


main loop:
Code: [Select]
GL30.glBindVertexArray(vao);
program.bind();
while (display.running())
{
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);

GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, 3);

display.draw();
}

shaders:
Code: [Select]
#version 450 core

layout (location = 0) in vec4 pos;

void main()
{
gl_Position = pos;
}
Code: [Select]
#version 450 core

out vec4 oColor;

void main()
{
oColor = vec4(1);
}

Graphics card is GeForce GTX 560 Ti (supports ogl 4.5). Printing the version gives "4.5.0 NVIDIA 385.41".

Edit. using windows7 pro

 92 
 on: October 30, 2017, 06:10:22 
Started by mudlee - Last post by mudlee
Thanks, looks good :)

 93 
 on: October 29, 2017, 20:28:12 
Started by mudlee - Last post by spasi
See 124 and #314.

The problem is C++, which the LWJGL code generator currently does not support. My hope is that Project Panama will become available soon enough that I will never have to deal with C++. If it gets delayed/cancelled, then I don't want to deal with it without more automation than we have now. The plan is to add (C) bindings to clang first, then build a tool that uses those bindings to parse C++ headers and generate corresponding LWJGL template definitions.

This is very low priority, so here's the current roadmap for anyone interested:

- Release 3.1.4 soon (within 10-15 days max). We have enough new content and a couple of critical fixes already.
- Add AMD Tootle bindings.
- Add Steam Audio bindings.
- Add hwloc bindings.
- Release 3.1.5.
- Resume work on ARM/Android (possibly release 3.2.0 if it works out)

Then I'll consider working on C++ bindings.

 94 
 on: October 29, 2017, 19:06:44 
Started by mudlee - Last post by mudlee
Hi guys.

Is there a chance that LWJGL will have a binding for Box2D and/or Bullet? I know there is JBox2D and JBullet, but both are not maintained or not a 1-1 port. It would be great to use like other bindings LWJGL already has :)

 95 
 on: October 28, 2017, 07:36:13 
Started by matan45 - Last post by matan45
there is any faster way to convert BufferedImage to ByteBuffer
then this:
Code: [Select]
public ByteBuffer convertImageData(BufferedImage image) {

int[] pixels = new int[image.getWidth() * image.getHeight()];
image.getRGB(0, 0, image.getWidth(), image.getHeight(), pixels, 0, image.getWidth());

ByteBuffer buffer = BufferUtils.createByteBuffer(image.getWidth() * image.getHeight() * 3);

for (int y = 0; y < image.getHeight(); y++) {
for (int x = 0; x < image.getWidth(); x++) {
int pixel = pixels[y * image.getWidth() + x];
buffer.put((byte) ((pixel >> 16) & 0xFF)); // Red component
buffer.put((byte) ((pixel >> 8) & 0xFF)); // Green component
buffer.put((byte) (pixel & 0xFF)); // Blue component
}
}

buffer.flip();
return buffer;

}

 96 
 on: October 27, 2017, 14:16:39 
Started by MightyGarlic - Last post by quew8
I assume that you have downloaded LWJGL3 but are expecting LWJGL2. LWJGL3 has no org.lwjgl.input package. Input is handled through GLFW.

 97 
 on: October 26, 2017, 04:27:19 
Started by matan45 - Last post by matan45
how can I decoder audio form mp4 file?

 98 
 on: October 23, 2017, 22:33:41 
Started by Marn - Last post by Marn
where is the GLFW jar?

 99 
 on: October 22, 2017, 06:08:34 
Started by Azraton - Last post by matan45
did you make it for 3d space the sat?

 100 
 on: October 20, 2017, 15:03:43 
Started by Marn - Last post by CoDi
The correct namespace is org.lwjgl.glfw, not org.lwjgl.opengl.

Pages: 1 ... 8 9 [10]