@dmelladom wrote:
Hi! I am trying to solve this for a better understaing of pointers, references and how ofPixels and ofVideoGrabbers manage their contents
Let's say I have 3 different videoGrabbers, vidGrab0, vidGrab1 and vidGrab2.vidGrab0.getPixels() returns a pointer to the array where the pixels are stored,
if I want to Access directly to the pixels, I have to use the reference:// code 1)
ofPixels & pixels = vidGrab0.getPixels();That let me acces to any pixel in the pixels array. pixels is an array of ofPixels
I want to store those pointers in an array, that is -if I am right- a pointer to the first pixel of each videoGrabber.
It is my understanding that// code 2)
ofPixels * pixelsArray[3] // this is my array of pointers to ofPixels
pixelsArray[0] = &videoGrab0.getPixels() // I store a reference to the pointerThat compiles
![]()
Later, I will use an auxiliar ofPixel object to mess around with those pixels. And here is where the problem is.
How do I get an array, like in code 1) ?
I guess that the way to do it should beofPixels & pixels = pixelsArray[0]; // since I stored a reference of the pointer in the array
But does simply doesn't work. Can somebody throw some light? Should I approach this using an array of arrays? This isin instead of pixelsArray[3], use pixelsArray[3][] and store the pixels directly?
Thanks a lot!
D!
Posts: 2
Participants: 2