Recent

Author Topic: Help: SDL .X11.lock_func in X11  (Read 3281 times)

trn76

  • New Member
  • *
  • Posts: 40
Help: SDL .X11.lock_func in X11
« on: February 09, 2014, 08:51:32 pm »
Hi.

I'm trying to lock the SDL window by using the x11.lock_func() in SDL, but cannot get it to work - getting an exception!
The SDL header is newest pascal translation (v1.40... nothing wrong with it), SDL is working fine.
I am trying this on Udoo (ARM based, debian hardfloat... but ever runtime examples are running fine, so guess SDL libs are good).
Using fpc 2.6.2..

This is my stripped code:

Code: [Select]
uses
  x, xlib, xutil, sdl ++
 
var
  gX11_Lock : procedure();
  fSurfaceSDL: PSDL_Surface;
  fSysInfoSDL : TSDL_SysWMinfo;
  fSDLVideoInfo: PSDL_VideoInfo;
  fPX11Display : PDisplay;
....
begin

    // SDL get videoinfo
    fSDLVideoInfo:= SDL_GetVideoInfo();
    if fSDLVideoInfo = nil then halt;

    fSurfaceSDL := SDL_SetVideoMode(500, 600, 24, SDL_SWSURFACE);

    if fSurfaceSDL = nil then begin
      {$IFDEF Logging}uglog.log.Error('ERROR: SDL could not set videomode, quitting!');{$ENDIF}
      halt;
    end;

    // get system-dependent information about a window
    SDL_VERSION(fSysInfoSDL.version);
    if SDL_GetWMInfo(@fSysInfoSDL) <= 0 then begin
      {$IFDEF Logging}uglog.log.Error('ERROR: SDL SDL_GetWMInfo!');{$ENDIF}
    halt;
    end;

  fPX11Display := XOpenDisplay(nil);
  if fPX11Display = nil then begin
    {$IFDEF Logging}uglog.log.Error('ERROR: Unable to get X11 Display');{$ENDIF}
    halt;
  end;

  // --- now im doing some EGL init, nothing to do with SDL here!

  // ok... the structure seem fine when debbuggin
  pointer(gX11_Lock) := fSysInfoSDL.X11.lock_func;

  // and here it fails:
  gX11_Lock();

end;


Am I calling "gX11_Lock" wrong? ...
Any help here would be nice... driving me nuts - for the time beeing I'm connection EGL->XWindow->GLES.. no problem, but I wanne use EGL->SDL->GLES..

Thanks  8-)

BlueIcaro

  • Hero Member
  • *****
  • Posts: 792
    • Blog personal
Re: Help: SDL .X11.lock_func in X11
« Reply #1 on: March 26, 2014, 12:52:17 am »
Do you have the sdl library avaliable on path of your system, or in the same folder where your programa are running?

Try to run your program step by step to know in which line  you got the exception.

/BLueIcaro

zeljko

  • Hero Member
  • *****
  • Posts: 1596
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Help: SDL .X11.lock_func in X11
« Reply #2 on: March 26, 2014, 12:31:01 pm »
@BlueIcaro: Since when library can be in same dir as application (without LD_LIBRARY_PATH setted up so) under linux ?

trn76

  • New Member
  • *
  • Posts: 40
Re: Help: SDL .X11.lock_func in X11
« Reply #3 on: April 24, 2014, 09:21:03 pm »
Hi, sorry for the late reply.

  // and here it fails:
  gX11_Lock();

so... yes, SDL is working fine, but like I said.... calling the lock function fails (tried on various systems).
Still havent figured it out.

 

TinyPortal © 2005-2018