Jump to content
  • Advertisement
Sign in to follow this  

Declare 2d array (800x640) in XNA

This topic is 2162 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

6 images 800x640 need to be rendered from a point of view, and based on these images one new image 800x640, a sort of fish-eye view, should be created.
At the moment the application draw each image and read the colors by calling this RenderTarget2D.GetData<Color> method and based on each pixel position it calculates new position for that final image. It works fine.
but since calling RenderTarget2D.GetData reduces the performance I tried to declare a 800x640 array in shader and then render 6 images consecutively. Then in pixel shader find the new coordinate of the new fish-eye view image.
    float4 PSTooBasic(VertexPSInput pin) : COLOR
        int xCoord = GetWaldXCoordinate(pin.PositionWS.x); 
        int yCoord = GetWaldYCoordinate(pin.PositionWS.y);
        WaldPixs[xCoord][yCoord] = 1; 
        return BlackColor;
But this array declaration line:
uniform int WaldPixs[800][640];
gives this compile error: error X3059: 'WaldPixs': array dimension must be between 1 and 65536
Any suggestion or workaround?

Share this post

Link to post
Share on other sites

I don't think this works with XNA, but with DirectX you could use constant buffers. Actually, if you use cbuffer you will find that it has similar limits on size. A tbuffer is something you might wish to look into .It should be able to handle up to 128 MiB.


But maybe you should try to render to some render targets. Draw to some render targets and use a full screen quad that samples those targets to compute what you need. The you can use the result in another full screen quad if needed. Or 800x640 in your case, not fullscreen.

Share this post

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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!