Page 1 of 1

Morton Curve pixel buffer PR3

Posted: Wed Apr 02, 2014 9:42 pm
by 130802
I have been trying to optimize the data layout of the pixel buffer using the morton curve, but I have a few questions on how to draw the correct image on the screen.

I know that the template copies the pixel buffer to the GPU every frame. Is there a way to let openGL convert the image to a normal image or do I have to do this my self? I also read something about using a fragment shader to convert back to the original coordinates as the image is drawn. I also don't know if we are allowed to use shaders, because shaders are a hardware acceleration based solution.

I know that the size of the screen buffer has to be a power of two for this optimzation to work. Won't increasing the size of the screenbuffer give me a negative result, because it has to copy more data to the GPU?

I hope someone will be able to answer some of my questions

-Max Oomen

Re: Morton Curve pixel buffer PR3

Posted: Thu Apr 03, 2014 8:31 pm
by 130802
So I have played around with the morton curve. I found a way to convert the swizzled frame buffer back to the original image. I am doing this with a simple for loop, which takes around 2.7 million cycles I don't know if there is a faster way.

The problem I have right now is that I don't know how to draw a swizzled texture onto the swizzle framebuffer. Right now I am just looping through the original image, calculate the index on the pixel buffer and plot the pixel. Calculating the index on the pixel buffer consists out of 2 array accesses and an or operation. I think I am doing this completely the wrong way, but I can't think of another way.

It would be great if someone could explain me how to draw a swizzled texture onto another swizzled texture.

- Max Oomen