Page 3 of 6 FirstFirst 12345 ... LastLast
Results 21 to 30 of 51

Thread: DirectX GUI Controls

  1. #21

    DirectX GUI Controls

    Yeah i know that problem. When some annoying text baloon pop's up from the system tray, my game usually slows down. Sometimes, it goes from 400/500 FPS to 100/80 FPS.

    It's very weird that your FPS increases when the window is partially covered.
    I guess you have enabled V-Sinc (look at the parameters you pass to D3D when you create your device). That causes your app to run at 60 FPS by default.

    Are the content's of your screen updated when another screen partially covers the window?? If not, i guess that's the reason why your FPS increases, because Direct3d doesn't update the window.

    Maybe you can show me your render loop code?
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  2. #22

    DirectX GUI Controls

    hi, not when partially closed, it has to be fully covered, then after moving it out the way it is running at a much higher framerate...

    dx params:
    [pascal]
    with EParams do begin
    hHandle := h;
    bFullScreen := False;
    bInitDeviceOnCreate := True;
    iResWidth := 800;
    iResHeight := 600;
    iTotalBackBuffer := 1;
    iColorDepth := D3DFMT_A8R8G8B8;
    end;
    [/pascal]

    basically furthur into initilization of my engine i call.

    [pascal]
    Engine.EnterLoop;
    [/pascal]

    which is as follows:

    [pascal]
    procedure TNemesisEngine.EnterLoop;
    var
    msg: TMsg;
    begin
    PeekMessage( msg, 0, 0, 0, PM_NOREMOVE);

    while (WM_QUIT <> msg.message) do begin
    if PeekMessage(msg, 0, 0, 0, PM_REMOVE) then begin
    // Translate and dispatch the message
    TranslateMessage(msg);
    DispatchMessage(msg);
    end;

    Render;
    end;
    end;
    [/pascal]

    and render is:

    [pascal]
    procedure TNemesisEngine.Render;
    var
    i: Integer;
    cont: TNemesisControl;
    curtick: Int64;
    begin
    if (NemRes.FDXDevice = nil) then exit;

    // Clear the backbuffer to black
    NemRes.FDXDevice.Clear(0, nil, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,0), 1.0, 0);

    // begin the scene
    if Succeeded(NemRes.FDXDevice.BeginScene) then begin
    // Rendering of scene objects can happen here

    for i := 0 to NemRes.FComponents.Count-1 do begin
    cont := NemRes.FComponents[i];
    cont.Render;
    end;

    for i := 0 to FStaticControls.Count-1 do begin
    cont := FStaticControls[i];
    cont.Render;
    end;

    // End the scene
    NemRes.FDXDevice.EndScene;
    end;

    // Present the backbuffer contents to the display
    NemRes.FDXDevice.Present(nil, nil, 0, nil);

    //check fps...
    QueryPerformanceCounter(curtick);
    NemRes.iFPS := (curtick - NemRes.iFTPTick) div 1000;
    NemRes.iFTPTick := curtick;
    end;
    [/pascal]

    each control render is a virtual method so its basically just drawing the controls etc, but if i remove the whole draw procedure, it still runs at 60fps.....

    -MM

  3. #23

    DirectX GUI Controls

    Sorry.. i ment the TD3DPresentParameters structure.

    You should try to set PresentationInterval to D3DPRESENT_INTERVAL_IMMEDIATE. That will disable V-Sync. You will get higher framerates, even when you are not covering the window.

    Can you show me your FPS calculation code. There might be a bug in it.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  4. #24

    DirectX GUI Controls

    hi, thanks again for replying, it seems D3DPRESENT_INTERVAL_IMMEDIATE has done the trick, now it runs around 900-1000fps, but the only problem is now when moving the virtual windows it slices the screen, i tried differ interval settings... ie..

    D3DPRESENT_INTERVAL_DEFAULT = $00000000;
    D3DPRESENT_INTERVAL_ONE = $00000001;
    D3DPRESENT_INTERVAL_TWO = $00000002;
    D3DPRESENT_INTERVAL_THREE = $00000004;
    D3DPRESENT_INTERVAL_FOUR = $00000008;

    however, the onlyones that seemed to work is interval_one, default and immediate, the others crashed the application as soon as it started....

    example of screen slice > http://www.meka-meka.com/meka/Nemesis.rar

    thanks again for all your help.

  5. #25

    DirectX GUI Controls

    Sorry i don't know what you mean. I can move your virtual windows here without seeing any artifacts or slices. Do you mean that when moving the upper half of the window is at another position (horizontally) than the lower half?

    This might be because your graphics hardware is slower than mine. Can you give me your specs?

    If it doesn't look good on your machine, i suggest you turn V-Sync on again and find another sollution (i can't think of any yet, if i do i'll let ya know).

    You say your FPS increases when you covered your window. :? Does it restore quickly to a normal number? How do you calculate your FPS?

    It might be an idea to render something that moves (e.g a bouncing rectangle). Cover and uncover your window again. Does the rectangle move faster than normal?? This is a way to determine whether the framerate has actually increased or you FPS-code is not working properly.

    Hope it helps.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  6. #26

    DirectX GUI Controls

    hi, sorry i think i have small prob with my psu, gonna check it out, losing power so it seems lol, and my hardware is deffy fine lol, i run a business selling hardware and software + repairs :-P

    Code:
    CPU&#58; 1.86GHz Core 2 Duo
    Mem&#58; 4GB DDR2 667
    GFX&#58; BFG 7950GT 512MB
    O/S&#58; Windows XP Pro
    
    Monitor&#58; 24" LCD 5ms Response &#40;1920x1200 res&#41;
    im gonna go check out my psu, will post back if all solved, thanks again for tips and help, at least now app works perfect

    *edit* 1 other thing is, atm i use a single png to create texture for buttons etc, however i see many places have a dds file with 3-4 images in to create the somewhat sprite texture or to use the same image for several parts of a quad etc, is there any tutorial on doing this? i cant seem to find one, thanks again

    -MM

  7. #27

    DirectX GUI Controls

    *edit* 1 other thing is, atm i use a single png to create texture for buttons etc, however i see many places have a dds file with 3-4 images in to create the somewhat sprite texture or to use the same image for several parts of a quad etc, is there any tutorial on doing this? i cant seem to find one, thanks again
    Do you mean Tilesets (an image that is composed of multiple smaller images)?? That's quite easy to achieve. So far you only used 0.0 and 1.0's for you texture coordinates (they use U and V instead of X and Y). When you want to render only the upper half of your image, you can use the following coords:

    [pascal]
    //setting up the quad

    //top left vertex (top left on texture)
    Vertex[0].u := 0.0;
    Vertex[0].v := 0.0;
    //top right vertex (top right on texture)
    Vertex[1].u := 1.0;
    Vertex[1].v := 0.0;
    //bottom left vertex (halfway down - left on texture)
    Vertex[2].u := 0.0;
    Vertex[2].v := 0.5;
    //bottom right vertex (halfway down - right on texture)
    Vertex[3].u := 1.0;
    Vertex[3].v := 0.5;
    [/pascal]

    It may take some fiddling before your orientation is right, but i guess you are smart enough to figure that out yourself.

    Good luck with your PSU.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  8. #28

    DirectX GUI Controls

    hi, i solved my PSU issue, ok, so far i've rewritten 70% of my engine, now it is much cleaner and should be quicker, however what i ment with the texture problem is... well for example....



    so instead of loading 2 differ png files for 1 button, with a up state texture and a down state texture, i see many use 1 png file to load the 2 differ textures.

    also wonder if you know why D3DCREATE_SOFTWARE_VERTEXPROCESSING would be better framerate then D3DCREATE_HARDWARE_VERTEXPROCESSING

    with new engine i get now 2300-2600fps on software_vertex proc but with hardware proc i get 350-400fps

    thanks

  9. #29

    DirectX GUI Controls

    also wonder if you know why D3DCREATE_SOFTWARE_VERTEXPROCESSING would be better framerate then D3DCREATE_HARDWARE_VERTEXPROCESSING

    with new engine i get now 2300-2600fps on software_vertex proc but with hardware proc i get 350-400fps
    Hmm.. that's odd. Hardware should be faster than software. Maybe you should update your drivers :? I guess that's a hardware problem or driver problem. Testing your app on different hardware machines might give you a good idea of what's going on. Can you upload it again?

    Can you give me the code you use to set up your quad? Then i can modify it for you to render a part of a texture. (So you can render both sub-images seperately) It isn't that hard. Didn't you understand my explanation about the texture coordinates? :?
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  10. #30

    DirectX GUI Controls

    sorry yes, i mis-understood the above post, i understand now thanks

    since i've rewrote engine it is farrrrr quicker then before, i've made massive changes to it also, the way virtual forms work, there is now what i call a dragbar, and the plain square control, you can setup colour schemes for everything etc.. now it runs average 2900-3500fps



    i will soon upload new test app, i have very many more controls yet to add.....


    *edit*

    i use for drawing fonts >
    F_Font : IID_ID3DXFont;

    is this slow? if i print 2 texts it runs around 3000-3500fps, if i remove 1 label, it runs around 4500fps



    -MM

Page 3 of 6 FirstFirst 12345 ... LastLast

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
  •