Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19

Thread: gamepark x2 wiz

  1. #11

    Re: gamepark x2 wiz

    Thank you thomas. Going to try to build the cross compiler this or next weekend.
    http://3das.noeska.com - create adventure games without programming

  2. #12

    Re: gamepark x2 wiz

    You got an error if you cross compile it. There is a missing file, but this happens after building the cross compiler. In /tmp/fpc-pack is the cross compiler and all compiled units for arm-linux. Copy them to fpc lib directory, mostly in /usr/lib/ or /usr/local/lib/, where the i386 files for fpc386 are.

    I had changed in svn tree "packages/sdl/src/sdl_mixer.pas" before cross compiling, the unit smpeg not working under gp2x. Replace around line 450 this

    Code:
    {$IFNDEF DARWIN}
     5 : ( mp3 : PSMPEG );
    {$ENDIF}
    with this
    Code:
    {$IFNDEF DARWIN}
    {$IFNDEF no_smpeg}
    5 : ( mp3 : PSMPEG );
    {$ENDIF}
    {$ENDIF}
    Copy a local version of fpc.cfg to your develop directory and add following lines to it:

    Code:
    #ifdef GP2X
    #define gp2x
    #endif
    
    #ifdef gp2x
    #define GP2X
    #endif
    
    #ifdef gp2x
    #define no_smpeg
    -Fl/usr/local/devkits/gp2xdev/lib ##// <-- where you have installed you binutils for arm
    -XPgp2x- 
    -Xd 
    -Xr/usr/local/devkits/gp2xdev ##<-- where you have installed you binutils for arm
    #endif
    For gp2xwiz i have started to write an opengl es unit, which loads all functions dynamically, but i got an access exception on gp2xwiz, on windows it works now.

    Thomas

  3. #13

    Re: gamepark x2 wiz

    If you are also working on opengles libs then have a look on this thread: http://www.pascalgamedevelopment.com...p?topic=4909.0
    http://3das.noeska.com - create adventure games without programming

  4. #14

    Re: gamepark x2 wiz

    Thanks, i found your post last week.

    I take your egl.pas and egltypes.pas, rewrite egl.pas using dynamically loading of functions, for better testing, which functions are found or not in installed library.

    I have now three units, which load all opengl es function on gp2xwiz, and most, except 6, egl functions. On Windows i got your sample working, on gp2xwiz it breaks at moment. Maybe I get it running tomorrow.

    Thomas

  5. #15

    Re: gamepark x2 wiz

    Ok, i have no idea why it doesn't work on gp2x wiz.

    - I can compile and execute my opengl es program on wiz
    - I get a device context
    - I can call eglChooseConfig and get a valid configuration

    But calling eglCreateWindowSurface failed with out an error message. The functions seems to be not returning, it terminate the application with out a message.

    I have no access to the device, network or serial, so i couldn't debug it.

    Thomas

  6. #16

    Re: gamepark x2 wiz

    Is it possible to write a log file to the sd card?

    On the gamepark forums there are a few howto's on opengles:
    http://www.gp32x.com/board/index.php...te-on-the-wiz/

    PS does my example use float or integers. My current version uses integers as only that is supported by the mbx-lite.
    http://3das.noeska.com - create adventure games without programming

  7. #17

    Re: gamepark x2 wiz

    I have read this thread and i init opengl es like them.

    Code:
    procedure DoOpenGLES();
    type
     TEGLAttribut   = array[0..128] of EGLint;
    
     procedure AddAttribute(var iPos : Integer; var Attr : TEGLAttribut; aType, aValue : EGLInt);
     begin
      Attr[iPos] := aType; Inc(iPos);
      Attr[iPos] := aValue; Inc(iPos);
     end;
    
    var
     iMajorVersion  : EGLint;
     iMinorVersion  : EGLint;
     iLoop      : Integer;
     iConfigs     : integer;
     eglAttribs    : TEGLAttribut;
    
     myeglDisplay   : EGLDisplay;
     myeglConfig   : EGLConfig;
     myeglSurface   : EGLSurface;
     myeglContext   : EGLContext;
     eglWindow    : NativeWindowType;
     Info       : TSDL_SysWMinfo;
     dc        : LongWord;
    begin
     SDL_VERSION(Info.Version);
     if ( SDL_GetWMInfo(@Info) < 0 ) then begin
      raise Exception.Create('SDL_GetWMInfo failed!');
     end;
    
     iMajorVersion  := 0;
     iMinorVersion  := 0;
     myeglDisplay   := 0;
     myeglConfig   := 0;
     myeglSurface   := nil;
     myeglContext   := nil;
    
    {$IFDEF WIN32}
     eglWindow := Info.window;
     dc    := GetDC(eglWindow);
     if (dc = 0) then begin
      raise Exception.Create('GetDC failed!');
     end;
    {$ELSE}
     nanoGL_Init();
    
     eglWindow := OS_CreateWindow();
     dc    := 0;
    {$ENDIF}
    
     Log.Add('');
     Log.Add('window handle is: %d', eglWindow);
     try
      myeglDisplay := eglGetDisplay(dc);
      if (myeglDisplay = EGL_BAD_DISPLAY) then begin
       raise Exception.Create('eglGetDisplay failed!');
      end;
    
      if (eglInitialize(myeglDisplay, @iMajorVersion, @iMinorVersion) = 0)
      then begin
       raise Exception.Create('eglInitialize failed!');
      end;
    
      iLoop := 0;
      AddAttribute(iLoop, eglAttribs, EGL_RED_SIZE, 5);
      AddAttribute(iLoop, eglAttribs, EGL_GREEN_SIZE, 6);
      AddAttribute(iLoop, eglAttribs, EGL_BLUE_SIZE, 5);
      AddAttribute(iLoop, eglAttribs, EGL_ALPHA_SIZE, 0);
      AddAttribute(iLoop, eglAttribs, EGL_SURFACE_TYPE, EGL_WINDOW_BIT);
      AddAttribute(iLoop, eglAttribs, EGL_NONE, 0);
    
      if (eglChooseConfig(myeglDisplay, @eglAttribs, @myeglConfig, 1, @iConfigs) = 0)
      then begin
       raise Exception.Create('eglChooseConfig failed!');
      end;
    
      if (iConfigs = 0) then begin
       raise Exception.Create('No compatible open gl es mode found!');
      end;
    
      myeglSurface := eglCreateWindowSurface(myeglDisplay, myeglConfig, eglWindow, nil);
      if (myeglSurface = nil) then begin
       if (eglWindow <> 0) then begin
        myeglSurface := eglCreateWindowSurface(myeglDisplay, myeglConfig, 0, @eglAttribs);
       end;
       if (myeglSurface = nil) then begin
        raise Exception.Create('eglCreateWindowSurface failed!');
       end;
      end;
    
      myeglContext := eglCreateContext(myeglDisplay, myeglConfig, nil, nil);
      if (myeglContext = nil) then begin
       raise Exception.Create('myeglContext failed!');
      end;
    
      Log.Add('EGL Init Completed');
    
      eglMakeCurrent(myeglDisplay, myeglSurface, myeglSurface, myeglContext);
    
      for iLoop := 0 to Pred(100) do begin
       if ((iLoop mod 2) = 1) then begin
        glClearColor(0.6, 0.8, 1.0, 1.0); // clear blue
       end else begin
        glClearColor(1.0, 1.0, 0.66, 1.0); // clear yellow
       end;
    
       glClear(GL_COLOR_BUFFER_BIT);
       
       eglSwapBuffers(myeglDisplay, myeglSurface);
       SDL_Delay(10);
      end;
     finally
      if (myeglDisplay <> EGL_BAD_DISPLAY) then begin
       eglMakeCurrent(myeglDisplay, nil, nil, nil);
       // eglDestroySurface(myeglDisplay, myeglSurface);
       // eglDestroyContext(myeglDisplay, myeglContext);
       // eglTerminate(myeglDisplay);
      end;
    
    {$IFDEF WIN32}
      ReleaseDC(eglWindow, dc);
    {$ELSE}
      //
    {$ENDIF}
     end;
    end;
    Code:
    function eglCreateWindowSurface(dpy : EGLDisplay; config : EGLConfig; win: NativeWindowType; const attrib_list: PEGLint) : EGLSurface;
    begin
     if Assigned(peglCreateWindowSurface) then begin
      Result := peglCreateWindowSurface(dpy, config, win, attrib_list);
      Log.Add('eglCreateWindowSurface called');
      Exit;
     end;
    
     raise Exception.CreateFmt(cmsgUnknowProc, ['eglCreateWindowSurface']);
    end;
    I write a log file and after calling eglCreateWindowSurface it stops, no entry is written, that eglCreateWindowSurface was called. On Windows it works.

    So, it seems to be, that called function, in peglCreateWindowSurface, was not returning.

    Thomas

  8. #18

    Re: gamepark x2 wiz

    It is past christmas and still no gamepark wiz delivered by the postman :-( . Luckily i did not pay in advance and opted to pay the postman when it is deliverd :-) .
    For me i give up on the gamepark wiz and go with the beagleboard. Development for that goes a bit slow but hello world from freepascal works and so does dynamic calling libraries.

    @KidPaddle are you sure the ogles .so files can be found from your application. I made mistakes with that ending up with the .so files not found and getting thing like you experience... If you have a hello world working you can use that to output text on screen whilst preparing opengles and detect what is happening ...
    http://3das.noeska.com - create adventure games without programming

  9. #19

    Re: gamepark x2 wiz

    I'm sure. I load dynamically around 160 opengl es functions and i can call some of them. I will make a new try, someone has make a Ethernet over USB and now debugging is much easier.

    Thomas

Page 2 of 2 FirstFirst 12

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
  •  
Comodo SSL