• Advertisement
Sign in to follow this  

pixel perfect screen doubling/scaling

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

I'm using visual c++ 2008 and my own directx wrapped 2d engine. I have a problem: whenever I try to create a 400x300 sized backbuffer surface, my program dies because my hardware doesn't like it. I need to create a new 400x300 buffer surface, draw to it, then dump these pixels into regular backbuffer with 2x the resolution. However, in doing this my project requires that the pixels remain 100% intact as I'm using pixel art and it just cannot get blurred or filtered in any way, shape, or form- this means dxsprite is out of the question. thanks.

Share this post


Link to post
Share on other sites
Advertisement
There shouldn't be any problem in windowmode, for fullscreen mode you would have to use a common resolution like 1280x1024 and then only use a small region of it - or upscale with the filters set to D3DTEXF_POINT to remove interpolation artifacts in your pixelart.

Share this post


Link to post
Share on other sites
I need to make it full screen 800x600, then scale a 400x300 buffer into it. It needs to absolutely work like it's in 400x300 full screen exclusive. There is no work around, otherwise everything is far too small to see, and as I said above- the scaling needs to turns every 1x1 pixel into a same coloured 2x2 series of pixels to keep the pixels perfect- this means no interpolation.

I was thinking of rendering a buffer unto a triangle plain with no filtering/lighting/etc, then simply moving our vertexes into the proper location.

jfox- I will look at D3DTEXF_POINT, thanks.

Share this post


Link to post
Share on other sites
StretchRect should work well for this scaling. Just create a 400x300 render target, render into it, then StrechRect it onto the back buffer.

Share this post


Link to post
Share on other sites
If you use ID3DXSprite, you can just do:

pSprite->SetTransform(D3DXMatrixScaling(2, 2, 2));

It'll automatically scale everything by 2 times. Coords, Sizes, etc. The display area will look and act like a 400x300 surface area, but if you do things like rotations and such, it'll look a lot clearer (since you really have twice as many pixels) than just stretching a smaller target to the backbuffer.

And even if you're not using ID3DXSprite, you can just go on the device itself:

pDevice->SetTransform(D3DXMatrixScaling(2, 2, 2));

Used with D3DTEXF_POINT, it'll look pretty nice.

[Edited by - Flimflam on December 21, 2008 5:28:39 PM]

Share this post


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

  • Advertisement