Page 1 of 1

[Irrlicht 1.8, MacOSX, OpenGL] EXC_BAD_ACCESS in CursorCtrl

Posted: Tue Apr 30, 2013 11:16 am
by Masterhawk
Hey folks,

due to my masterthesis I need my current project compiling under MacOSX. So I created a virtual machine with MacOSX since I don't own a Mac myself. I downloaded the current Irrlicht release 1.8 and tried to compile the tutorials with Xcode.
I noticed that all tutorials are build successfully but only work when using the EDT_SOFTWARE renderer. So I tried to compile examples from opengl-tutorial.org to assure that OpenGL is installed correctly. These tutorials work like charm.

When I try to launch the HelloWorld.app and watch it with a debugger it says me there is a EXC_BAD_ACCESS exception in CIrrDeviceMacOSX::storeMouseLocation()

Code: Select all

void CIrrDeviceMacOSX::storeMouseLocation()
{
    int x,y;
 
    if (Window != NULL)
    {
        NSPoint p;
        p = [NSEvent mouseLocation];
        p = [Window convertScreenToBase:p];
        x = (int)p.x;
        y = DeviceHeight - (int)p.y;
    }
    else
    {
        CGEventRef ourEvent = CGEventCreate(NULL);
        CGPoint point = CGEventGetLocation(ourEvent);
        CFRelease(ourEvent);
 
        x = (int)point.x;
        y = (int)point.y;
 
        const core::position2di& curr = ((CCursorControl *)CursorControl)->getPosition(); //<-- HERE THE EXC_BAD_ACCESS OCCURS!!!!!
        if (curr.X != x || curr.Y != y)
        {
            // In fullscreen mode, events are not sent regularly so rely on polling
            irr::SEvent ievent;
            ievent.EventType = irr::EET_MOUSE_INPUT_EVENT;
            ievent.MouseInput.Event = irr::EMIE_MOUSE_MOVED;
            ievent.MouseInput.X = x;
            ievent.MouseInput.Y = y;
            postEventFromUser(ievent);
        }
    }
 
    ((CCursorControl *)CursorControl)->updateInternalCursorPosition(x,y);
}
The error occurs in createDevice which is called this way

Code: Select all

IrrlichtDevice* device = createDevice( video::EDT_OPENGL, dimension2d<u32>(640,480), 16, false, false, false, 0);
This even occurs with the latest svn/trunk version.

The complete console output is:
Irrlicht Engine version 1.9.0
Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64
No doublebuffering available.
(lldb)
Is this a known problem or am I doing anything wrong?

EDIT: I'm using MacOSX 10.8.3

Re: [Irrlicht 1.8, MacOSX, OpenGL] EXC_BAD_ACCESS in CursorC

Posted: Tue Apr 30, 2013 11:26 am
by hybrid
Looks like the driver does not exit properly. The warning about doublebuffer looks like the window is not properly created, hence the pointer used in the method is probably invalid, but not properly cleared initially. But even a fix for this would only result in a video driver being null. Maybe try different settings in the creation parameters, e.g. 32bit framebuffer or fullscreen app to check how you can successfully create a driver here.

Re: [Irrlicht 1.8, MacOSX, OpenGL] EXC_BAD_ACCESS in CursorC

Posted: Tue Apr 30, 2013 11:39 am
by Masterhawk
Maybe it is a problem with the virtual machine. I uploaded a zipped package which contains a few compiled examples in the bin/MacOSX directory.
It would be nice if somebody could check these binaries work on real Mac

DOWNLOAD: https://dl.dropboxusercontent.com/u/625 ... macosx.zip

Thx in advance

Re: [Irrlicht 1.8, MacOSX, OpenGL] EXC_BAD_ACCESS in CursorC

Posted: Tue Apr 30, 2013 4:36 pm
by Nadro
I'll check it when I'll back to home.

Re: [Irrlicht 1.8, MacOSX, OpenGL] EXC_BAD_ACCESS in CursorC

Posted: Wed May 01, 2013 12:30 pm
by Nadro
Examples doesn't work properly - crash at start. I checked it on MacOSX 10.7.

As I remember v1.8 has some problems with compilation on some OSX versions (it's already fixed in trunk). If you can try please check trunk from SVN.

BTW. If you want to check under your vm precompiled binary which use Irrlicht (rev4451), you can download eg. BuggyRace (tested with many OSX configs): http://nbkgamestudio.pl/downloads/buggy ... _1_osx.dmg
Maybe vm has got some problems with OGL.

Re: [Irrlicht 1.8, MacOSX, OpenGL] EXC_BAD_ACCESS in CursorC

Posted: Wed May 01, 2013 1:50 pm
by Masterhawk
Nadro wrote:Examples doesn't work properly - crash at start. I checked it on MacOSX 10.7.

As I remember v1.8 has some problems with compilation on some OSX versions (it's already fixed in trunk). If you can try please check trunk from SVN.

BTW. If you want to check under your vm precompiled binary which use Irrlicht (rev4451), you can download eg. BuggyRace (tested with many OSX configs): http://nbkgamestudio.pl/downloads/buggy ... _1_osx.dmg
Maybe vm has got some problems with OGL.
Thanks for your testing. I've already tried the current svn trunk version without success.
Maybe it really is something with the params of createDevice() as hybrid said, but I tried nearly all possibilities. Are you able to compile the first example with OPENGL driver? Which setting do you use. Maybe it is something with my xcode setup or something.

But first, I will give a try on buggy race.

EDIT: "Buggy Race quit unexpectedly", so it seems to have the same problems

Re: [Irrlicht 1.8, MacOSX, OpenGL] EXC_BAD_ACCESS in CursorC

Posted: Wed May 01, 2013 5:16 pm
by Nadro
So it looks like vm have some problems with OGL driver, because BuggyRace was tested on different Macs with different OSX versions and it works fine (however this game wasn't tested with OSX 10.8, so maybe this OSX version require some changes in Irrlicht, but at now I don't have an access to this OS). In next month I'll upgrade my OSX version to 10.8 and I'll check Irrlicht on this system.

Re: [Irrlicht 1.8, MacOSX, OpenGL] EXC_BAD_ACCESS in CursorC

Posted: Thu May 02, 2013 11:39 am
by Masterhawk
Nadro wrote:So it looks like vm have some problems with OGL driver, because BuggyRace was tested on different Macs with different OSX versions and it works fine (however this game wasn't tested with OSX 10.8, so maybe this OSX version require some changes in Irrlicht, but at now I don't have an access to this OS). In next month I'll upgrade my OSX version to 10.8 and I'll check Irrlicht on this system.
I've sent the BuggyRace-Link to a friend of mine with the request of testing it. I assume that he uses 10.8.x. I'm curious if it is a 10.8 problem or if it's just my vm

Re: [Irrlicht 1.8, MacOSX, OpenGL] EXC_BAD_ACCESS in CursorC

Posted: Thu May 02, 2013 2:21 pm
by Nadro
Thanks, if it's problem related to Irrlicht I'll be able to fix it in next month. Anyway I think that problem is related to vm, but we must w8 for more infos in this case.

Re: [Irrlicht 1.8, MacOSX, OpenGL] EXC_BAD_ACCESS in CursorC

Posted: Fri May 03, 2013 10:30 am
by Masterhawk
The game works on a non-virtual Mac OS X mit 10.8.3!

Re: [Irrlicht 1.8, MacOSX, OpenGL] EXC_BAD_ACCESS in CursorC

Posted: Fri May 03, 2013 4:29 pm
by Nadro
Thanks for info. It looks like you have to switch to non-vm MacOSX to develop games with Irrlicht. I think that only simple OGL stuff is supported in vm.

Re: [Irrlicht 1.8, MacOSX, OpenGL] EXC_BAD_ACCESS in CursorC

Posted: Fri May 03, 2013 4:41 pm
by hybrid
Ok, if possible, please check out this code change in the VM. In OSXDevice constructor add a VideoDriver=NULL in line 517 or in the init list. Then check after device creation if the driver is still NULL. Seems like the OSX device signals an error this way. If it is NULL the window creation failed, otherwise it's a problem with the OGL driver. Since both parts are opengl related, it still could be both.

Re: [Irrlicht 1.8, MacOSX, OpenGL] EXC_BAD_ACCESS in CursorC

Posted: Fri May 03, 2013 10:17 pm
by Masterhawk
Well, I guess I know why I'm getting the EXC_BAD_ACCESS error.
The createWindow() function fails and causes the CursorControl not to be set.

When I push up the CursorControl initialization there is no more bad access.

From line 518

Code: Select all

 
...
bool success = true;
CursorControl = new CCursorControl(CreationParams.WindowSize, this); //<-- pushed up to prevent bad access
if(CreationParams.DriverType != video::EDT_NULL)
    success = createWindow();
 
if(!success)
{
    return; //<-- is called
}
 
...

Re: [Irrlicht 1.8, MacOSX, OpenGL] EXC_BAD_ACCESS in CursorC

Posted: Fri May 03, 2013 10:40 pm
by hybrid
Ah ok, should be ok this way as well. Thanks for the find :-)

Re: [Irrlicht 1.8, MacOSX, OpenGL] EXC_BAD_ACCESS in CursorC

Posted: Mon May 20, 2013 3:54 pm
by Masterhawk
Well it seems to be a virtual machine thing only.
After my university lend a MacMini with OSX 10.8 to me, I can compile every example without any problems.

In the next few days I will see if it's easy to compile my project under osx :P
Thanks for your help guys :wink: