• Advertisement
Sign in to follow this  

C++ TBB simple/silly 2D->1D array question

This topic is 1748 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So I've got mandelbrot running in OpenCL: I am to compare it to Intels TBB.

 

This is something I really should know by now and I feel silly asking.

 

I have a struct that represents an RGBA pixel, and I create a buffer of them - a bitmap

BGRA8* buffer = (BGRA8*)malloc( width * height * sizeof(BGRA8) );

Then I iterate through x and y doing whatever using parallel_for

 

Where do I put my x, y in terms of

buffer[ index ]

?

 

Thanks in advance, I know this is a silly question!

Share this post


Link to post
Share on other sites
Advertisement

You would access it by the same way you access anything:  by the way you defined it in your struct, except that you don't use this "->" you use this ".". 

 

buffer [index].x

Share this post


Link to post
Share on other sites

For some reason I assumed that buffer was a pointer to bytes and not a pointer to BGRA8. That was a mistake on my part. I have edited my previous answer to take that into account.

 

Sorry for the mistake.

Edited by Deortuka

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement