Graphics

 View Only
  • 1.  Using xpEngine.GetCurrentFrame fails

    Posted 09-12-2013 17:13
    Hi all,

    I'm trying to get a frame from the first output framebuffer and use that as a material for a quad in a different scene on a second output, using the code below. I thought I had it figured out, but the GetCurrentFrame-function returns False for some reason (and L_xImage is nil). I used xpScene.GetRenderedFrame before successfully, so I guess I don't have to create the xpImage-object. Therefor I can only assume that the dimensions are incorrect, but how can that be: I use the dimensions of the framebuffer itself.

    Note 1: I use Virtual Outputs; maybe that has some effect on the dimensions, but using hardcoded 1024x576 and 720x576 (it's an SD PAL project) didn't work either.

    Note 2: I use Delphi, so the code is somewhat different to .NET, but the basic XPression-control is similar.



    if G_xEngine.GetOutputFrameBuffer(0, L_xOutputFrameBuffer) then begin

    if L_xOutputFrameBuffer.GetCurrentFrame(L_xOutputFrameBuffer.FrameWidth, L_xOutputFrameBuffer.FrameHeight, L_xImage) then begin

    if glob_xEngine.MaterialExistsByName('Material1') then begin

    if glob_xEngine.GetMaterialByName('Material1', L_xMaterial) then begin

    if L_xMaterial.ShaderExistsByName('APITexture') then begin

    if L_xMaterial.GetShaderByName('APITexture', L_xBaseShader) then begin

    (L_xBaseShader as xpAPITextureShader).SetImageData(L_xImage, idt_ARGB);

    end;

    end;

    end;

    end;

    end;

    end;



    Kind regards,

    Gerard


  • 2.  RE: Using xpEngine.GetCurrentFrame fails

    Posted 09-12-2013 18:39
    Hi Gerard,

    GetCurrentFrame is only valid for actual hardware framebuffer outputs.

    You can pass anything you want for the dimensions and it will be scaled to the dimensions you request.

    #XPression