Morton Curve pixel buffer PR3

Programming topics can be found here.
Post Reply
User avatar
130802
Posts: 10
Joined: Tue Feb 18, 2014 5:41 pm
Location: Breda

Morton Curve pixel buffer PR3

Post by 130802 » Wed Apr 02, 2014 9:42 pm

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
- Max Oomen 2GA-2PR (Avatar was made by Anthea van Leeuwen)

User avatar
130802
Posts: 10
Joined: Tue Feb 18, 2014 5:41 pm
Location: Breda

Re: Morton Curve pixel buffer PR3

Post by 130802 » Thu Apr 03, 2014 8:31 pm

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
- Max Oomen 2GA-2PR (Avatar was made by Anthea van Leeuwen)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest