Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No need for off-heap Buffers in LWJGL 3 #73

Closed
jakobkmar opened this issue Feb 21, 2020 · 3 comments
Closed

No need for off-heap Buffers in LWJGL 3 #73

jakobkmar opened this issue Feb 21, 2020 · 3 comments

Comments

@jakobkmar
Copy link

jakobkmar commented Feb 21, 2020

The tutorial uses Buffers allocated in off-heap a lot.
But this is not necessary since LWJGL 3.
https://github.com/LWJGL/lwjgl3/releases/tag/3.0.0
LWJGL/lwjgl3#175

So in a lot of cases it would be easier to just use arrays.

I have currently only followed the tutorial to Loading more complex models and the following are parts where I remember Buffers being used:

  • Mesh for glBufferData
  • ShaderProgram for glUniformMatrix4fv (here value.get(stack.mallocFloat(16)) can be replaced with value.get(new float[16])
  • Texture where in loadTexture a ByteBuffer is still necessary because stbi_load does only return this type, but the buffers of w h and channels can be replaced with normal arrays
@lwjglgamedev
Copy link
Owner

lwjglgamedev commented Feb 21, 2020 via email

@lwjglgamedev
Copy link
Owner

Hi Jakob,

It seems that Hotspot Critical Natives is considered an undocumented feature with some bugs. You can see some thoghts about this from Spasi here:

So, by now I would not use them, at least in the initialization code, which would get little benefit from this change. In any case, I would leave this open until LWGL 3.3 is released, beacuse it is supposed to get some updates on this issue. Plesae, let me know your view on this.

Best regards.

@jakobkmar
Copy link
Author

Hey,

after reading through this I would leave this issue here open until the release of LWJGL 3.3 and then look at it again.
I think it is more important that this tutorial uses practices which work than having good readability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants