Menu

GLSceneViewer1.Buffer.RenderToBitmap problem

Help
2021-03-29
2024-02-15
  • Alexander Dev

    Alexander Dev - 2021-03-29

    Hi guys.
    There is some code that worked in older versions
    GLSceneViewer1.Buffer.RenderToBitmap (bmp, Round (96 * 2));
    I got a picture twice the size.
    Now I tried to use it - the labels are displaced. If dpi = 0, then everything is ok!

    Labels are made using TGLAbsoluteHUDText

     
    👍
    1

    Last edit: Alexander Dev 2021-03-29
  • Vitalii

    Vitalii - 2023-07-22

    Same problem! I solved the issue by replacing the "f" factor with 1 (or simply remove "f" from the code lines):
    gl.Translatef(X*1-rci.viewPortSize.cx/2, rci.viewPortSize.cy/2-Y*1, Z);
    and
    gl.Scalef(Scale.DirectX*1, Scale.DirectY*1, 1);

    This code is located in the GLS.HUDObjects.pas, TGLHUDText.RenderTextAtPosition method. I'm not sure if this is the correct solution, it's more of a "quick fix".

     

    Last edit: Vitalii 2023-07-22
  • Ergodata

    Ergodata - 2024-02-15

    Thanks for the quick fix. However if you use both TGLHUDText (sprite) and TGLAbsoluteHUDText (3D object) the scale factor is needed, here is a suggestion, in TGLHUDText.RenderTextAtPosition():

        if Self is TGLAbsoluteHUDText then f := 1  // fix
        else f := rci.renderDPI / 96;              // original code
    
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.