Page 2 of 7 FirstFirst 1234 ... LastLast
Results 11 to 20 of 62

Thread: Final3D SDL Engine 2007

  1. #11

    Final3D SDL Engine 2007

    Quote Originally Posted by andygfx
    1) About SDL_GetRelativeMouseState. If i now control scene on slow PC, work good, but on my C2D 2.6, mouse FreeLook sometimes jump about big delta

    2) I have good eues, but ]http://jedi-sdl.pascalgamedevelopment.com/files/JEDI-SDLFullSetup.exe[/url]
    1. What is a C2D 2.6?

    2. That link is where the latest build is kept. So what you installed should be fine.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  2. #12

    Final3D SDL Engine 2007

    Core 2 Duo x6700 2.6MHz sorry it was bad shortcut

    Yes latest JEDI work fine

    Now i try fix problem with mouse delta for freelook, because if VSync is ON the is speed OK, but if is OFF is slow. I think that i must calc Delta Tick Count for correct calc on different FPS. I any tutorial about TickCount and movement?

    Currently i have my timer helper class writed so:

    Code:
    unit F3D_Timer;
    &#123;******************************************************************************&#125;
    &#123; F3D_TIMER&#58;
    &#123;******************************************************************************&#125;
    interface
    
    uses  gl,sdl;
    
    type TProcedureEvent = procedure of object;
    &#123; The type of event that is called by the timer. &#125;
    Type TF3D_TimerEvent = procedure&#40;Sender&#58; TObject; FrameTime&#58; Single&#41; of object;
    
    
    Type TF3D_Timer = class
    
         private
                m_lastTick &#58; integer;
                m_fpsDuration &#58; single;
                m_fpsFrames &#58; integer;
                m_fps &#58; integer;
                ElapsedTime&#58;single;
         public
    
               constructor Create&#40;&#41;;
               destructor  Destroy;
               function  GetElapsedTime&#58; Single;
               function GetTickCount&#58; Integer;
               function GetFPS&#58; Integer;
               procedure Update&#40;&#41;;
    
      end;
    
    
    
    implementation
    
    uses F3Dlib;
    
    &#123;******************************************************************************&#125;
    &#123; F3D_TIMER&#58;
    &#123;******************************************************************************&#125;
    
    constructor TF3D_Timer.Create&#40;&#41;;
    begin
      inherited Create;
      m_lastTick &#58;= 0;
    end;
    
    &#123;******************************************************************************&#125;
    &#123; F3D_TIMER&#58;
    &#123;******************************************************************************&#125;
    
    destructor TF3D_Timer.Destroy;
    begin
    
      inherited destroy;
    end;
    
    &#123;******************************************************************************&#125;
    &#123; F3D_TIMER&#58;
    &#123;******************************************************************************&#125;
    function TF3D_Timer.GetFPS&#58; Integer;
    begin
         result&#58;=self.m_fps;
    end;
    
    
    &#123;******************************************************************************&#125;
    &#123; F3D_TIMER&#58;
    &#123;******************************************************************************&#125;
    function TF3D_Timer.GetTickCount&#58; Integer;
    begin
         result&#58;=m_lastTick;
    end;
    
    
    &#123;******************************************************************************&#125;
    &#123; F3D_TIMER&#58;
    &#123;******************************************************************************&#125;
    function TF3D_Timer.GetElapsedTime&#58; Single;
    begin
         result&#58;=ElapsedTime*100;
    end;
    
    &#123;******************************************************************************&#125;
    &#123; F3D_TIMER&#58;
    &#123;******************************************************************************&#125;
    procedure TF3D_Timer.Update;
    var
    tick &#58; integer;
    begin
      // get the current tick value
      tick &#58;= SDL_GetTicks;
      // calculate the amount of elapsed seconds
      ElapsedTime &#58;= &#40; tick - m_lastTick &#41; / 1000.0;
      if ElapsedTime = 0 then
        exit;
      // adjust fps counter
      m_fpsDuration &#58;= m_fpsDuration + ElapsedTime;
      if &#40; m_fpsDuration >= 1.0 &#41; then
      begin
        m_fps &#58;= round&#40; m_fpsFrames / m_fpsDuration &#41;;
        m_fpsDuration &#58;= 0.0;
        m_fpsFrames &#58;= 0;
      end;
      m_lastTick &#58;= tick;
      inc&#40; m_fpsFrames &#41;;
      glFlush&#40;&#41;;
    end;
    
    
    end.
    C2D X6800, 4GBRAM, NV8800GTX, Vista x64 Ultimate

  3. #13

    Final3D SDL Engine 2007

    Quote Originally Posted by technomage
    Dom - The Input manager needs to be updated to include this, I'll mail you the code. (my cvs still isn't working)
    I'm sure I had implemented this at some point. But maybe I over wrote it. I'll try and check it in tonight after I compare what I currently have.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  4. #14

    Final3D SDL Engine 2007

    OK. THX. I will continue on F3D in tonight too (>22:00 CET ) If i don't forget, I switch my ICQ ON.

    Now i must go play with my little daughter (she has 7 month) ....
    C2D X6800, 4GBRAM, NV8800GTX, Vista x64 Ultimate

  5. #15

    Final3D SDL Engine 2007

    It's all checked in Dean.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  6. #16

    Final3D SDL Engine 2007

    Just now i one hour find which extension i need for ARB vertex/fragment shader

    for this now i have:

    // reset
    if (ProgramObject <> 0) then glDeleteObjectARB(ProgramObject);
    if (VertexShaderObject <> 0) then glDeleteObjectARB(VertexShaderObject);
    if (FragmentShaderObject <> 0) then glDeleteObjectARB(FragmentShaderObject);

    for this i can't find neede extension:

    // create
    ProgramObject := glCreateProgramObjectARB();
    VertexShaderObject := glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB);
    FragmentShaderObject := glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);
    C2D X6800, 4GBRAM, NV8800GTX, Vista x64 Ultimate

  7. #17

    Final3D SDL Engine 2007

    hehe. I have now all needed.

    'GL_ARB_vertex_program',
    'GL_ARB_vertex_shader',
    'GL_ARB_fragment_shader',
    'GL_ARB_shader_objects',
    'GL_ARB_shading_language_100',
    C2D X6800, 4GBRAM, NV8800GTX, Vista x64 Ultimate

  8. #18

    Final3D SDL Engine 2007

    New release ver. 0.09 with billboard sample / GLSL shader

    Features:

    WinXP x86/ Vista x64 / Linux (not tested)
    OpenGL 2.0
    SDL lib
    pascal language
    Viewport class
    HUD class
    Texture Factory class (currently is used DevIL lib)
    Font class
    Font Manager class (accept Nitrogen Font Studio 4 file - tga/composit)
    Image Manager class (will be used for GUI)
    SDL Input control class
    Movement control class
    Camera class
    Billboard Manager (new)
    Material manager (new)
    Material Event Manager (new)
    Surface Manager (new)
    GLSL (new)
    Shader Manager (new)


    ToDo:

    Skined GUI
    GUI Manager
    Scene loader
    VBO class
    LUA wrapper for all classes
    Sprite2D/3D Manager
    Documentation

    SRC/BIN from http://final3d.intelligentdevelopment.sk/
    C2D X6800, 4GBRAM, NV8800GTX, Vista x64 Ultimate

  9. #19

    Final3D SDL Engine 2007

    I see you've written your own control class. Are you aware that JEDI-SDL ships with it's own SDL Input Manager that should handle Keyboard, Mouse and Joysticks. Have a look at sdlinput.pas. It may save you some time.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  10. #20

    Final3D SDL Engine 2007

    [1]


    It's not fully true, because my Input class is only simple extension on existinng SDLInput.

    Code:
    type TF3D_Input = class
    
         private
            delta   &#58; TF3D_Vector2f;
            old_pos &#58; TPoint;
            Manager &#58; TSDLInputManager;
         public
         constructor create;
         destructor destroy;
         procedure Update&#40;&#41;;
         function IsKeyDown&#40;key&#58;integer&#41;&#58;boolean;
         function IsButtonDown&#40;btn&#58;integer&#41;&#58;boolean;
         function IsKeyUp&#40;key&#58;integer&#41;&#58;boolean;
         procedure ShowInfo&#40;sx&#58; integer; sy&#58; integer&#41;;
         function GetMouseDelta&#58;TF3D_Vector2f;
    
    
    
    end;
    
    implementation
    
    uses F3Dlib;
    
    &#123;******************************************************************************&#125;
    &#123; F3D INPUT CONTROL&#58;
    &#123;******************************************************************************&#125;
    constructor TF3D_Input.create;
    begin
      inherited create;
      Manager &#58;= TSDLInputManager.Create&#40;&#91;itKeyBoard, itMouse, itJoystick&#93;&#41;;
    end;
    
    &#123;******************************************************************************&#125;
    &#123; F3D INPUT CONTROL&#58;
    &#123;******************************************************************************&#125;
    destructor TF3D_Input.destroy;
    begin
      inherited destroy;
    end;
    
    &#123;******************************************************************************&#125;
    &#123; F3D INPUT CONTROL&#58;
    &#123;******************************************************************************&#125;
    procedure TF3D_Input.Update&#40;&#41;;
    var dx,dy&#58;integer;
    begin
    
       SDL_GetRelativeMouseState&#40;dx,dy&#41;;
       delta.x &#58;= dx;
       delta.y &#58;= dy;
    
       self.Manager.UpdateInputs&#40;F3D.SDL.event&#41;;
    
    end;
    
    &#123;******************************************************************************&#125;
    &#123; F3D INPUT CONTROL&#58; KEY DOWN
    &#123;******************************************************************************&#125;
    function TF3D_Input.IsKeyDown&#40;key&#58;integer&#41;&#58;boolean;
    begin
    
          if self.Manager.KeyBoard.IsKeyDown&#40;key&#41; then result&#58;=true
                                                 else result&#58;=false;
    
    end;
    
    
    &#123;******************************************************************************&#125;
    &#123; F3D INPUT CONTROL&#58; MOUSE BUTTON DOWN
    &#123;******************************************************************************&#125;
    function TF3D_Input.IsButtonDown&#40;btn&#58;integer&#41;&#58;boolean;
    begin
    
          if self.Manager.Mouse.MouseIsDown&#40;btn&#41; then result&#58;=false
                                                 else result&#58;=true;
    
    end;
    
    &#123;******************************************************************************&#125;
    &#123; F3D INPUT CONTROL&#58;  KEY UP
    &#123;******************************************************************************&#125;
    function TF3D_Input.IsKeyUp&#40;key&#58;integer&#41;&#58;boolean;
    begin
    
          if self.Manager.KeyBoard.IsKeyDown&#40;key&#41; then result&#58;=true
                                                 else result&#58;=false;
    
    
    
    end;
    
    &#123;******************************************************************************&#125;
    &#123; F3D INPUT CONTROL&#58; Get Delta mouse move
    &#123;******************************************************************************&#125;
    function TF3D_Input.GetMouseDelta&#58;TF3D_Vector2f;
    begin
         result&#58;=self.delta;
    end;
    
    
    &#123;******************************************************************************&#125;
    &#123; F3D INPUT CONTROL&#58; DrawINFO
    &#123;******************************************************************************&#125;
    procedure TF3D_Input.ShowInfo&#40;sx&#58; integer; sy&#58; integer&#41;;
    var BTN_0, BTN_1, BTN_2&#58; integer;
        WHEEL_UP,WHEEL_DOWN&#58;integer;
    begin
         if &#40;not F3D.Config.use_infoscreen&#41; then exit;
    
        glDisable&#40;GL_TEXTURE_2D&#41;;
        glEnable&#40;GL_BLEND&#41;;
        glBlendFunc&#40;GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA&#41;;
        glColor4f&#40;0, 0, 0, 0.5&#41;;
        F3D.Draw.Rectangle&#40;sx - 8, sy - 4, sx + 256 + 16, sy + 84&#41;;
    
        glDisable&#40;GL_BLEND&#41;;
    
        BTN_0 &#58;= 0;
        if self.Manager.Mouse.MouseIsUp&#40;SDL_BUTTON_LEFT&#41; then BTN_0 &#58;= 1;
        BTN_1 &#58;= 0;
        if self.Manager.Mouse.MouseIsUp&#40;SDL_BUTTON_MIDDLE&#41; then BTN_1 &#58;= 1;
        BTN_2 &#58;= 0;
        if self.Manager.Mouse.MouseIsUp&#40;SDL_BUTTON_RIGHT&#41; then BTN_2 &#58;= 1;
        WHEEL_UP&#58;=0;
        WHEEL_DOWN&#58;=0;
        if self.Manager.Mouse.MouseIsDown&#40;SDL_BUTTON_WHEELUP&#41; then WHEEL_UP &#58;= 1;        // ??????????
        if self.Manager.Mouse.MouseIsDown&#40;SDL_BUTTON_WHEELDOWN&#41; then WHEEL_DOWN &#58;= 1;    // ??????????
    
        glDisable&#40;GL_BLEND&#41;;
        F3D.Hud.SetFontColor&#40;'CourierNew', SetColor4f&#40;1, 0.5, 0, 1&#41;&#41;;
        F3D.Hud.Print&#40;'CourierNew', sx, sy + 13 * 0, 'MOUSE CONTROL&#58;'&#41;;
        F3D.Hud.SetFontColor&#40;'CourierNew', SetColor4f&#40;1, 1, 1, 1&#41;&#41;;
        F3D.Hud.Print&#40;'CourierNew', sx, sy + 13 * 1, format&#40;'MOUSE DELTA    &#58; %8.4f %8.4f ', &#91;self.delta.x,self.delta.y&#93;&#41;&#41;;
        F3D.Hud.Print&#40;'CourierNew', sx, sy + 13 * 2, format&#40;'MOUSE POS      &#58; %4d %4d ', &#91;self.Manager.Mouse.MousePosition.X, self.Manager.Mouse.MousePosition.Y&#93;&#41;&#41;;
        F3D.Hud.Print&#40;'CourierNew', sx, sy + 13 * 3, format&#40;'MOUSE BTN      &#58; &#91;%1d&#93;&#91;%1d&#93;&#91;%1d&#93; ', &#91;BTN_0, BTN_1, BTN_2&#93;&#41;&#41;;
        F3D.Hud.Print&#40;'CourierNew', sx, sy + 13 * 4, format&#40;'MOUSE WHEEL UP &#58; &#91;%1d&#93;  ', &#91;WHEEL_UP&#93;&#41;&#41;;
        F3D.Hud.Print&#40;'CourierNew', sx, sy + 13 * 5, format&#40;'MOUSE WHEEL DW &#58; &#91;%1d&#93;  ', &#91;WHEEL_DOWN&#93;&#41;&#41;;
    end;
    end.

    [2]

    I found problem with mouse delta and LAG values answer i found in vry good document which help me. Here is part:

    Timers
    Timers are not something every game uses so you might be wondering why I’m covering them in this article. Trying to get SDL timers to work caused me a lot of aggravation and I spent hours trying to figure out what the problem was. I’m writing about SDL timers to save you the aggravation I went through.
    A timer is a function the operating system calls periodically. You get to specify how often the timer fires, which is how often the operating system calls the timer. Use a timer when you want to do something repeatedly in your program at regular time intervals.



    ... now i have implemented USER TIMER and all is OK. Tonight will be released as ver 0.10

    part of code:

    Code:
    function SDLLoop&#40;interval&#58; Uint32; param&#58; Pointer &#41;&#58; Integer;
    var event&#58;TSDL_Event;
    begin
         event.type_ &#58;= SDL_USEREVENT;
         event.user.code &#58;= RUN_FINAL3D_LOOP;
         event.user.data1 &#58;=0;
         event.user.data2 &#58;=0;
    
         SDL_PushEvent&#40;@event&#41;;
         
         result &#58;= interval;
    end;
    
    ....
    
    
      // initialize timer
       SDL_Init&#40;SDL_INIT_TIMER&#41;;
       self.Timer &#58;=  SDL_AddTimer&#40;20,@SDLLoop,nil&#41;;
    
    
    ....
    
    begin
    
        F3D &#58;= TF3D.Create&#40;&#41;;
        F3D.Initialize&#40;&#41;;
    
        APP_DO_INIT&#40;&#41;;
    
        Done &#58;= False;
    
        while &#40; not Done &#41; do
        begin
             while &#40; SDL_PollEvent&#40; @F3D.SDL.event &#41; = 1 &#41; do
             begin
                  case F3D.SDL.event.type_ of
                       SDL_QUITEV &#58; Done &#58;= true;
                       SDL_USEREVENT &#58;
                       begin
                            APP_DO_LOOP&#40; F3D.SDL.event.user.code&#41;;
                       end;
    
                  end;
    
             end;
        end;
        SDL_QUIT;
        Halt&#40;0&#41;;
    end.
    
    
    ....
    
    
    
    procedure APP_DO_LOOP&#40; code &#58; integer &#41;;
    begin
      case code of
        RUN_FINAL3D_LOOP &#58; APP_DO_RENDER&#40;&#41;;
        end;
    end;
    [3]

    WHEEL_UP and WHEEL_DOWN return always 1 ((
    C2D X6800, 4GBRAM, NV8800GTX, Vista x64 Ultimate

Page 2 of 7 FirstFirst 1234 ... 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
  •