Dynamic array and OpenGL problem
Bill Baxter
dnewsgroup at billbaxter.com
Sun Jan 13 14:56:55 PST 2008
Mikko Ronkainen wrote:
> Johan Granberg Wrote:
>
>> A dynamic array is a pair of a size and a pointer so if you pass that to
>> opengl which expects the array to be consecutive in memmory opengl will
>> read the length part of the array as if it was part of the data and therfor
>> producing garbage
>
> Ok, thanks. I'm out of ideas now - how should I solve the problem of variable size framebuffer then? I mean when you resize the window, I would like to resize the framebuffer accordingly. I'm now using that static array, and I cannot see any method to resize it. Or alternatively having some sort of conversion before sending dynamic array to opengl?
Just make a 1D array and compute the size yourself.
ubyte[] framebuffer = new ubyte[3*width*height];
Then pass framebuffer.ptr to the OpenGL call.
--bb
More information about the Digitalmars-d-learn
mailing list