On Thursday, 1 December 2022 at 00:47:18 UTC, Adam D Ruppe wrote:
On Thursday, 1 December 2022 at 00:39:21 UTC, jwatson-CO-edu wrote:
Is there a way to write a single statement that creates a void pointer that points to an initialized float array?

float[] f = [1,1,1];

some_function_taking_void(f.ptr);

and it just works.

Thank you, that was just the magic I needed!

```d
float[4] arr = [0.1f, 0.1f, 0.1f, 1.0f]; // Init array with values

SetShaderValue(
shader, ambientLoc, arr.ptr, ShaderUniformDataType.SHADER_UNIFORM_VEC4
); //                   ^^^^^^^---void* here
```


Reply via email to