digitalmars.D.learn - Having trouble porting basic GLFW C++ example to D
- Matt Jones (5/5) Oct 06 2017 I've been trying to port a basic GLFW C++ example to D. The C++
- Joakim (13/18) Oct 06 2017 I ran into this myself, took me awhile to track it down. I too
- Matt Jones (3/10) Oct 06 2017 Ah. I should have remembered that problem. Thanks. I'll see if
- Matt Jones (2/16) Oct 06 2017 Nice! That worked. Thanks.
I've been trying to port a basic GLFW C++ example to D. The C++ version shows the textures correctly. But the D version shows nothing. The code is almost identical. Does anyone know why the D version does not work? https://github.com/workhorsy/d_glfw
Oct 06 2017
On Saturday, 7 October 2017 at 03:12:09 UTC, Matt Jones wrote:I've been trying to port a basic GLFW C++ example to D. The C++ version shows the textures correctly. But the D version shows nothing. The code is almost identical.Heh, that's the problem.Does anyone know why the D version does not work? https://github.com/workhorsy/d_glfwI ran into this myself, took me awhile to track it down. I too took the size of dynamic arrays this way: https://github.com/workhorsy/d_glfw/blob/master/dlang/source/main.d#L158 https://github.com/workhorsy/d_glfw/blob/master/dlang/source/main.d#L161 That will give you 2 words for a slice or dynamic array, the length and pointer. What you want is the length of the array https://github.com/joakim-noah/android/blob/master/samples/Teapot/jni/TeapotRenderer.d#L192 multiplied by the size of the element https://github.com/joakim-noah/android/blob/master/samples/Teapot/jni/TeapotRenderer.d#L195 Sizeof works for static arrays, but is different for slices: that's likely your problem.
Oct 06 2017
On Saturday, 7 October 2017 at 03:47:27 UTC, Joakim wrote:On Saturday, 7 October 2017 at 03:12:09 UTC, Matt Jones wrote:Ah. I should have remembered that problem. Thanks. I'll see if that fixes it.[...]Heh, that's the problem.[...]I ran into this myself, took me awhile to track it down. I too took the size of dynamic arrays this way: [...]
Oct 06 2017
On Saturday, 7 October 2017 at 04:24:07 UTC, Matt Jones wrote:On Saturday, 7 October 2017 at 03:47:27 UTC, Joakim wrote:Nice! That worked. Thanks.On Saturday, 7 October 2017 at 03:12:09 UTC, Matt Jones wrote:Ah. I should have remembered that problem. Thanks. I'll see if that fixes it.[...]Heh, that's the problem.[...]I ran into this myself, took me awhile to track it down. I too took the size of dynamic arrays this way: [...]
Oct 06 2017