PDA

View Full Version : gldrawpixel for using openMP



sagob
10-07-2010, 04:23 AM
Hi all, my first post here. I need help

I got a char image [3][256][256] and i have

void display(void){
int iter;

glClear(GL_COLOR_BUFFER_BIT);
glRasterPos2i(0, 0);

for(iter=0; iter<200; iter++){
newimage(&amp;iter, &amp;Image[0][0][0]);//here's the problem
glDrawPixels(ImageWidth, ImageHeight, GL_RGB, GL_UNSIGNED_BYTE, Image);
glutSwapBuffers();
}
}

i need to draw something for later prossesing in parallel
my problem is the newimage function how can i store data to the char Image [3][256][256], i'm supose to use complex numbers to calculate the pixel to draw (that part complex numbers i allready calculate) but how do i store in Image i was trying with glVertex2d, anyone can help me.

Sorry for long post

PascalM123
10-08-2010, 02:40 AM
Because your image is a multi-dimensional array, you can fill it like this:

int i, j, k;
for(i = 0; i < 3; i++) {
for(j = 0; j < 256; j++) {
for(k = 0; k < 256; k++) {
image[i][j][k] = some calculation;
}
}
}

If you want your function to be more robust, you can give for example the size in each dimension along (so your image also works if it is [2][128[128] for example).

Is this what you were trying to get at?

sagob
10-11-2010, 03:57 PM
Yes m8 thank's i try another way to calculate and got the same result as you posted teh only diference is image [0][i][j] = (something like k*255) i dont know why i needed the 3 dimension array since i don't use one dimension, but ok.
thx