Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


SetRenderTarget in Windowed mode...

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

How would I go about reverting from a SetRenderTarget to a texture in windowed mode? In fullscreen mode I simply grab the backbuffer or use GetRenderTarget(&SomeSurface), but in windowed mode when I do the same thing the entire screen (minus the task bar) is rendered to instead of the window. Am I just going to have to render to a seperate surface of the same size & format, etc, and StretchRects to the backbuffer, or is there another (easier) way?

Share this post

Link to post
Share on other sites
Nope, I wasn't even aware of the viewport. However, I just tried it, and it's still taking the whole screen (minus anything in front of it) even though I specifically only clear the window's rectangle, and set the viewport to the window's rectangle.

m_Device->SetRenderTarget(0, m_RenderSurface);
//Right here is my either set stencil depth or create a stencil depth and set. It's unnecessary.

view.X = m_Viewport.left;
view.Y = m_Viewport.top;
view.Width = m_Viewport.right;//This and the next are just temporary until I create a RECT that looks correct.

view.Height = m_Viewport.bottom;//As it stands, bottom isn't the bottom of the 'port, it's the bottom - top, ie, the height.

view.MinZ = 0.0f;
view.MaxZ = 1.0f;
D3DRECT viewrect;
viewrect.x1 = m_Viewport.left;
viewrect.x2 = m_Viewport.left + m_Viewport.right;
viewrect.y1 = m_Viewport.top;
viewrect.y2 = m_Viewport.top + m_Viewport.bottom;

Anyone see anything wrong with the above?
Edit: Oh, and just for the record, I've stepped through the debugger and m_Viewport is set correctly when it goes through this segment of code.

[edited by - Erzengeldeslichtes on April 5, 2004 7:41:59 PM]

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
in DirectX8 Window modes can use this

m_pD3DDevice->CreateAdditionalSwapChain(&d3dpp, &m_pSwapChain);

m_pSwapChain->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &m_pBackBuffer);

m_pD3DDevice->SetRenderTarget(m_pBackBuffer, NULL);

m_pSwapChain->Present(NULL, NULL, m_hWnd, NULL);

Made In Taiwan

Share this post

Link to post
Share on other sites
That didn''t work... In fullscreen mode it simply dies, and in windowed mode it renders the same as before. I''ve noticed that it seems to center the scene around the center of the viewport, but even so renders well outside the viewport...

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!