Closed jakobkmar closed 2 years ago
Hi Jakob,
Thanks for your comment. I will have a look at it. I certainly improves readability, but I need to check the drawbacks. All the examples from the own LWJGL library still use buffers. If I change to that, it may take some time, because buffer usage is spread all over the book.
Best regards.
El vie., 21 feb. 2020 a las 16:46, Jakob K (notifications@github.com) escribió:
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 http://url https://github.com/LWJGL/lwjgl3/issues/175 http://url
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
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/lwjglgamedev/lwjglbook/issues/73?email_source=notifications&email_token=ADMXGJYBWLQWOYECFBSMHBLRD7ZOHA5CNFSM4KZFPX4KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IPKYBYA, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADMXGJ52JK22IXNUSY6BMWDRD7ZOHANCNFSM4KZFPX4A .
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.
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.
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 https://github.com/LWJGL/lwjgl3/issues/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
forglBufferData
ShaderProgram
forglUniformMatrix4fv
(herevalue.get(stack.mallocFloat(16))
can be replaced withvalue.get(new float[16])
Texture
where inloadTexture
aByteBuffer
is still necessary becausestbi_load
does only return this type, but the buffers ofw
h
andchannels
can be replaced with normal arrays