Results 1 to 5 of 5

Thread: Rendertarget not working in low resolution! [SOLVED]

  1. #1
    Legendary Member NecroDOME's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands, Eindhoven
    Posts
    1,059

    Rendertarget not working in low resolution! [SOLVED]

    System: Windows XP, nVidia 6800 SLI
    Compiler/IDE: Turbo Delphi
    API: DirectX 9

    Hi all,

    Im rendering onto a render target texture, but nothing happens when the resolution of my screen is lower that the resolution of my render target.

    For example: My render target is 512x512 and my screen resolution is 800x600 everything is fine. When I set my screen resolution to anything below 512x512 the render target does not get updated!

    The rest of the scene what is NOT rendered to a render target is renderd correctly!

    This is how I create my render target:
    Code:
      if Succeeded( Device.Screen.device.CreateTexture(FParam.Width, FParam.Height, FParam.MipMapCount,
                                  D3DUSAGE_RENDERTARGET,
                                  Necro3DFMTToD3DFMT(FParam.Format),
                                  D3DPOOL_DEFAULT,
                                  Texture,
                                  nil) ) then
      begin
        Loaded := true;
      end else
        Loaded := false;
    The begin-scene code: (the beginning when I try to render to my render target):
    Code:
      if Texture<>nil then
      begin
        FRenderTargetIndex &#58;= Index;
        Device &#58;= TNecro3D_Device9&#40; GetDevice &#41;;
    
        Device.Screen.Device.GetRenderTarget&#40;Index, FOldRenderTarget&#41;;
        Texture.GetSurfaceLevel&#40;0, FRenderTarget&#41;;
        Device.Screen.Device.SetRenderTarget&#40;Index, FRenderTarget&#41;;
        Device.Screen.Device.BeginScene;
        FCanRender &#58;= true;
      end;
    Comment: FCanRender is always true just for testing...

    And this is called whenever I finish rendering to my render target:
    Code:
      if FCanRender then
      begin
        Device &#58;= TNecro3D_Device9&#40; GetDevice &#41;;
        Device.Screen.Device.EndScene;
    
        Device.Screen.Device.SetRenderTarget&#40;FRenderTargetIndex, FOldRenderTarget&#41;;
        FOldRenderTarget &#58;= nil;
        FRenderTarget &#58;= nil;
      end;
    NecroSOFT - End of line -

  2. #2

    Rendertarget not working in low resolution! [SOLVED]

    Are you updating the viewport (IDirect3DDevice9.SetViewport) when rendering to render target? If not, you should do so.

    Also, is nothing rendered to your render target or do you get garbage pixels? Any suspicious output from debug runtime?

  3. #3
    Legendary Member NecroDOME's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands, Eindhoven
    Posts
    1,059

    Rendertarget not working in low resolution! [SOLVED]

    Garbage pixels yeah.

    I also don't set the view port. So I will take a look at that.
    NecroSOFT - End of line -

  4. #4
    Legendary Member NecroDOME's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands, Eindhoven
    Posts
    1,059

    Rendertarget not working in low resolution! [SOLVED]

    Well, it seems to be a problem with the Z-buffer.

    Debug Output: Direct3D9: (ERROR) epthStencil Buffer must be at least as big as the RenderTarget. Process Sandbox.exe (3160)
    Also I don't need to call Device.BeginScene() and Device.EndScene().

    When I maximize the screen everything is OK.
    When I restore it to its normal size, I get this error.
    NecroSOFT - End of line -

  5. #5
    Legendary Member NecroDOME's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands, Eindhoven
    Posts
    1,059

    Rendertarget not working in low resolution! [SOLVED]

    Ok, I fixed it. I just created a new depth surface for my render target.

    Edit: I just tested it without the viewport and it works fine. So, viewport is not needed. Thanks anyway!!
    NecroSOFT - End of line -

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •