i don’t know how to dynamic allocate a 3dimensional array to a variable.
my program will need to change the dimension of an array base on what user input so that it can display a bezier surface correctly. Can anyone help
is it glMap2f() function can accept 3dimension data type only, or we can create our own data type. If yes how?
You can’t dynamically create a 3-dimensional array where the memory is contiguous. (Well, there’s a bit of a trick where you can sort of do this.) glMap2f requires the memory to be contiguous.
A few options you can use:
Create a single dimension array, and calculate the indices yourself. (If you do this, then you can set your dynamic 3d array to point to the appropriate address locations of the 1d array, which is the trick I mentioned above.)
Create a struct with 3 floats and make an array of that struct.