Page 3 of 3 FirstFirst 123
Results 21 to 29 of 29

Thread: DXDraw.Options: do3D Problems

  1. #21

    DXDraw.Options: do3D Problems

    Hi again

    Finally I managed to solve almost every problem removing the line {$Define DrawHWAcc}. The graphics show in the right way but some problems still remain:

    *If I use undelphix 1.07 when it loads the images with alpha it stays stopped for a moment. I tried to load them all at the beginning, but everytime that in the menu of the game i change a Timage or Canvas (activating an option to change the graphic of the button) is like it looses the memory of the sprites with alpha loaded, and it stops again a time when I try to re-paint then again. The result is tha before entering the circuit I have to load all sprites and takes about 15 seconds doing it. If I use the version 1.06 it doesn't stop and I get the same performance than 1.07 version.

    *The problem with the cutting edges was solved removing the line {$Define DrawHWAcc} but only in the images without alpha, in the images with alpha the problem remains and edges are bud cut.

    *Double precission, activating do3D I had problems with some calculation beacuse of DirectDraw puts the precission mode in simple.I can solve it doing SetPrecisionMode(pmDouble) after the DirectDraw.Inicialize, but it doesn't work in all computers. I think is a problem with permissions, but I didn't try. The solution will be to indicate to the DirectDraw before initializing not to change to simple precission mode, it can be done putting the flag D3DCREATE_FPU_PRESERVE in the call Direct3D.CreateDevice, but I cannot find that call. Where do I indicate that flag??

    As you told me, the limit in the textures is 2048 pixels (when do3d activated) but if I remove the {$Define DrawHWAcc} line then the limit is only for sprites with alpha and only for people with ATI VGA's. The cars in my game are 36x36 pixels and 60 positions that were together in a simple line, the textures were 2160x36. Without alpha it works perfectly, but activating alpha the people with NVIDIA VGA's as no problems, but with ATI the cars shows cut. I solved putting 2 lines of 30 cars : 1080x72 pixels.

    I have the following problems:

    * Cutting edged with sprites with Alpha.
    * Add the flag D3DCREATE_FPU_PRESERVE in the call Direct3D.CreateDevice
    * Stop of some seconds the first time I paint a sprite with alpha with undelphi 1.07 (With 1.06 works well).

    Regards...
    www.kotai.es
    www.remakesonline.com -> Nemesis Online & Bubble Bobble Online & Castlevania Online & Penguin Adventure Online
    www.miniracingonline.com

  2. #22

    DXDraw.Options: do3D Problems

    Double precission problem solved: I put flag DDSCL_FPUPRESERVE in SetCooperativeLevel function

    procedure TCustomDXDraw.SetCooperativeLevel;
    var
    Flags: Integer;
    Control: TWinControl;
    begin
    Control := FForm;
    if Control = nil then
    Control := Self;
    if doFullScreen in FNowOptions then
    begin
    Flags := DDSCL_FULLSCREEN or DDSCL_EXCLUSIVE or DDSCL_ALLOWMODEX or DDSCL_FPUPRESERVE;
    if doNoWindowChange in FNowOptions then
    Flags := Flags or DDSCL_NOWINDOWCHANGES;
    if doAllowReboot in FNowOptions then
    Flags := Flags or DDSCL_ALLOWREBOOT;
    end else
    Flags := DDSCL_NORMAL or DDSCL_FPUPRESERVE;
    DDraw.DXResult := DDraw.IDraw.SetCooperativeLevel(Control.Handle, Flags);
    end;

    Now, only 2 problems:

    * Cutting edged with sprites with Alpha.
    * Stop of some seconds the first time I paint a sprite with alpha with undelphi 1.07 (With 1.06 works well).

    Kotai.
    www.kotai.es
    www.remakesonline.com -> Nemesis Online & Bubble Bobble Online & Castlevania Online & Penguin Adventure Online
    www.miniracingonline.com

  3. #23

    DXDraw.Options: do3D Problems

    I want say: Very good work! Thanks!

    Quote Originally Posted by kotai
    Double precission problem solved: I put flag DDSCL_FPUPRESERVE in SetCooperativeLevel function.
    Please you can try before drawing this function for setting texture filter like:
    Code:
    DXDraw.TextureFilter(Ord(D2D_POINT)); //reset default settings from D2D_LINEAR
    DXImageList.Items.Find('Rev').Draw(DXDraw.Surface, mX, mY, 0);
    Ijcro.

  4. #24

    DXDraw.Options: do3D Problems

    There is a strange loop hole inside dxdraws, but i found a way to fix this WITH hardware acceleration.

    DXDraws.pas, line 1812, I add:

    Var
    DefaultTextureFilter: TD2DTextureFilter = D2D_POINT;

    D2D_FLATCUBIC and D2D_GAUSSIANCUBIC get good results too, and D2D_LINEAR and D2D_ANISOTROPIC get that strange image cutting...

    And after this, i change every stance of D2D_LINEAR to DefaultTextureFilter, you can enabled hardware acceleration again.

    This way, you can swicth to optimal ways that you like, since there is no event to put the texturefilter correctly, (the loophole, every oninitiate have D2D object nullified... ack)

    I also have my own dxsprite unit, with animation corrected and pixel check working perfectly too.

    EDITED: Another good solution, is add a property onto tdxcustomdraw, "TextureFilter" of type TD2DTextureFilter. so, you can select it and will be use correctly inside creations...

  5. #25

    DXDraw.Options: do3D Problems

    when you use
    Code:
    DXDraw.TextureFilter(Ord(D2D_POINT));
    before any command for drawing you can control texture filtering for texture different by source.
    Default value is D2D_LINEAR in DXDraws unit. Property is not defined there for global change the texture filter.

    I will change default value to D2D_POINT in next version 1.08.

    Thank you
    Ijcro.

  6. #26

    DXDraw.Options: do3D Problems

    ijcro... is you that manages the undelphix

    Will be very nice if you add this floating point fix, and the d2d_point texture filtering by default.
    I also have my own spriteengine, with some extra sprites and more event driven (non design supported), and a DXMusic component that also can play mp3 files (and report when the music ends)

  7. #27

    DXDraw.Options: do3D Problems

    What if you disable the transparent color mask, and use a format with alpha channel like .png?

    Regards!
    -Marco

  8. #28

    DXDraw.Options: do3D Problems

    Perfect, I put D2D_POINT in DXDraws and work ok.

    I used undelphix 1.06 and not 1.07 by stop of some seconds the first time I paint a sprite with alpha with undelphi 1.07 (With 1.06 works well).

    I solved other problem, texture with alpha have limit 1024x1024 px for ATI. I have a NVIDIA and limit are 2048 x 2048 but people with ATI say me a problem and I solve it limit texture (with BlendMode := bmBlend) to 1024 x 1024.

    Kotai.
    www.kotai.es
    www.remakesonline.com -> Nemesis Online & Bubble Bobble Online & Castlevania Online & Penguin Adventure Online
    www.miniracingonline.com

  9. #29

    DXDraw.Options: do3D Problems

    OK, I will do some changes. New version is tested now.
    I did large changes in DXSpriteEngine, I hope that it will be OK. And some default values has been changed too.

    Limit of textures can be problem when image has size 4096 px in software mode. I solved it with new property editor for resructuralize of the sub-images (bigger image has to cuted or resized as force). Size is handled by constant named maxVideoBlockSize - it can be set down to 1024 px.

    Any useable code is welcome for better (un)DelphiX, thank you!

    Regards
    Ijcro.

Page 3 of 3 FirstFirst 123

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
  •