Hi David, Dennis, and Allen,
I am currently programming a Neuroscience experiment that needs to
render some 3D images. I decided to use opengl to do the rendering
and have Psychotoolbox display the rendered frames since its timing is
reliable. In order to get the frames into Matlab quickly, I decided
to write a mex file that would output the frame arrays quickly. My
mex file would need to use CGL (and maybe also Quartz to capture the
screen) I modeled my project's setup after Psychotoolbox's Xcode
project setup to compile mex files externally. Everything compiles
fine, however, when I run the mex file in MATLAB it crashes with this
message.
--------------------------------------------------
----------------------
Bus error detected at Thu Jul 7 12:34:08 2005
--------------------------------------------------
----------------------
Configuration:
MATLAB Version: 7.0.1.24704 (R14) Service Pack 1
MATLAB License: 191307
Operating System: Darwin 7.7.2 Darwin Kernel Version 7.7.2: Wed Dec
22
20:01:20 PST 2004; root:xnu/xnu-517.10.7.obj~1/RELEASE_PPC Power
Macintosh
Window System: The XFree86 Project, Inc (40300000), display :0.0
Current Visual: 0x22 (class 4, depth 24)
Virtual Machine: Java 1.4.2_03 with "Apple Computer, Inc." Java
HotSpot(TM)
Client VM
(mixed mode)
Default Charset: US-ASCII
r0 = 90d68018 r8 = 00000001 r16 = f0ffe960 r24 = 015ae9b4
r1 = f0ffda70 r9 = a0d6023c r17 = 00000000 r25 = f0ffe960
r2 = 00000000 r10 = 935f8a48 r18 = f0ffe9c0 r26 = f0ffe9c0
r3 = 00002714 r11 = a0d60494 r19 = 00000000 r27 = 00000000
r4 = f0ffe9c0 r12 = 90d64c68 r20 = 01e19c90 r28 = 0f1b3570
r5 = f0ffdb38 r13 = 00000000 r21 = f0ffee80 r29 = f0ffe9c0
r6 = 9388570c r14 = 00000000 r22 = 00000000 r30 = f0ffdae0
r7 = 5b81c5c0 r15 = 00000000 r23 = 00000000 r31 = 90d67fd8
cr = 82042224 lr = 90d68018 xer = 00000000 ctr = 90d64c68
vrsave = 00000000
Stack Trace:
[0] OpenGL:0x90d68028
[1] genstimapp.mexmac:0x0eb3cb00
[2] genstimapp.mexmac:0x0eb3ccac
[3] libmex.dylib:mexRunMexFile + 116 bytes
[4] libmex.dylib:Mfh_mex::dispatch_file(int, mxArray_tag**, int,
mxArray_tag**) + 316 bytes
[5] libmwm_dispatcher.dylib:Mfh_file::dispatch_fh(int,
mxArray_tag**, int,
mxArray_tag**) + 400 bytes
[6] libmwm_interpreter.dylib:inDispatchFromStack + 1612 bytes
[7] libmwm_interpreter.dylib:inDispatchCall(char const*, int, int,
int, int*,
int*) + 196 bytes
[8] libmwm_interpreter.dylib:inInterp(inDebugCheck, int, int,
opcodes,
inPcodeNest_tag volatile*) + 3192 bytes
[9] libmwm_interpreter.dylib:inInterPcodeSJ(inDebugCheck, int, int,
opcodes,
inPcodeNest_tag*) + 224 bytes
[10] libmwm_interpreter.dylib:in_local_call_eval_function(int*,
_pcodeheader*,
int*, mxArray_tag**, inDebugCheck) + 176 bytes
[11]
libmwm_interpreter.dylib:inEvalStringWithIsVarFcn(_memory_context*,
char
const*, EvalType, int, mxArray_tag**, inDebugCheck, _pcodeheader*,
int*, bool
(*)(void*, char const*), void*) + 2928 bytes
[12] libmwm_interpreter.dylib:inEvalString + 48 bytes
[13] libmwm_interpreter.dylib:inEvalCmdWithLocalReturnandtype(char
const*,
int*, inDebugCheck) + 96 bytes
[14] libmwbridge.dylib:mnParser + 520 bytes
[15] libmwmcr.dylib:mcrInstance::mnParser() + 104 bytes
[16] MATLAB:mcrMain(int, char**) + 400 bytes
[17] MATLAB:run_main(void*) + 24 bytes
[18] libSystem.B.dylib:0x900246e8
The program doesn't crash when i remove the Quartz lines (i.e.
functions that begin with CG) so I am hoping that I can use just CGL
without Quartz. Since Psychotoolbox uses both, I know there must be a
way to get both working in a mex file. I was wondering if you've run
into a similar issue while developing Psychotoolbox and if so, if you
had any hints on how to solve it. Also, I noticed that Psychotoolbox
attempted to use SDL at some point. I was trying to use SDL/OpenGL in
my mex file but with no luck. Matlab complained it couldn't
find SDL_main symbol when I ran the mex file. I was wondering if you
had any luck getting SDL to run in a mex file. Thank you for your
time, suggestions, and also your excellent work with Psychotoolbox.
Thanks,
Tri Ngo
I am currently programming a Neuroscience experiment that needs to
render some 3D images. I decided to use opengl to do the rendering
and have Psychotoolbox display the rendered frames since its timing is
reliable. In order to get the frames into Matlab quickly, I decided
to write a mex file that would output the frame arrays quickly. My
mex file would need to use CGL (and maybe also Quartz to capture the
screen) I modeled my project's setup after Psychotoolbox's Xcode
project setup to compile mex files externally. Everything compiles
fine, however, when I run the mex file in MATLAB it crashes with this
message.
--------------------------------------------------
----------------------
Bus error detected at Thu Jul 7 12:34:08 2005
--------------------------------------------------
----------------------
Configuration:
MATLAB Version: 7.0.1.24704 (R14) Service Pack 1
MATLAB License: 191307
Operating System: Darwin 7.7.2 Darwin Kernel Version 7.7.2: Wed Dec
22
20:01:20 PST 2004; root:xnu/xnu-517.10.7.obj~1/RELEASE_PPC Power
Macintosh
Window System: The XFree86 Project, Inc (40300000), display :0.0
Current Visual: 0x22 (class 4, depth 24)
Virtual Machine: Java 1.4.2_03 with "Apple Computer, Inc." Java
HotSpot(TM)
Client VM
(mixed mode)
Default Charset: US-ASCII
r0 = 90d68018 r8 = 00000001 r16 = f0ffe960 r24 = 015ae9b4
r1 = f0ffda70 r9 = a0d6023c r17 = 00000000 r25 = f0ffe960
r2 = 00000000 r10 = 935f8a48 r18 = f0ffe9c0 r26 = f0ffe9c0
r3 = 00002714 r11 = a0d60494 r19 = 00000000 r27 = 00000000
r4 = f0ffe9c0 r12 = 90d64c68 r20 = 01e19c90 r28 = 0f1b3570
r5 = f0ffdb38 r13 = 00000000 r21 = f0ffee80 r29 = f0ffe9c0
r6 = 9388570c r14 = 00000000 r22 = 00000000 r30 = f0ffdae0
r7 = 5b81c5c0 r15 = 00000000 r23 = 00000000 r31 = 90d67fd8
cr = 82042224 lr = 90d68018 xer = 00000000 ctr = 90d64c68
vrsave = 00000000
Stack Trace:
[0] OpenGL:0x90d68028
[1] genstimapp.mexmac:0x0eb3cb00
[2] genstimapp.mexmac:0x0eb3ccac
[3] libmex.dylib:mexRunMexFile + 116 bytes
[4] libmex.dylib:Mfh_mex::dispatch_file(int, mxArray_tag**, int,
mxArray_tag**) + 316 bytes
[5] libmwm_dispatcher.dylib:Mfh_file::dispatch_fh(int,
mxArray_tag**, int,
mxArray_tag**) + 400 bytes
[6] libmwm_interpreter.dylib:inDispatchFromStack + 1612 bytes
[7] libmwm_interpreter.dylib:inDispatchCall(char const*, int, int,
int, int*,
int*) + 196 bytes
[8] libmwm_interpreter.dylib:inInterp(inDebugCheck, int, int,
opcodes,
inPcodeNest_tag volatile*) + 3192 bytes
[9] libmwm_interpreter.dylib:inInterPcodeSJ(inDebugCheck, int, int,
opcodes,
inPcodeNest_tag*) + 224 bytes
[10] libmwm_interpreter.dylib:in_local_call_eval_function(int*,
_pcodeheader*,
int*, mxArray_tag**, inDebugCheck) + 176 bytes
[11]
libmwm_interpreter.dylib:inEvalStringWithIsVarFcn(_memory_context*,
char
const*, EvalType, int, mxArray_tag**, inDebugCheck, _pcodeheader*,
int*, bool
(*)(void*, char const*), void*) + 2928 bytes
[12] libmwm_interpreter.dylib:inEvalString + 48 bytes
[13] libmwm_interpreter.dylib:inEvalCmdWithLocalReturnandtype(char
const*,
int*, inDebugCheck) + 96 bytes
[14] libmwbridge.dylib:mnParser + 520 bytes
[15] libmwmcr.dylib:mcrInstance::mnParser() + 104 bytes
[16] MATLAB:mcrMain(int, char**) + 400 bytes
[17] MATLAB:run_main(void*) + 24 bytes
[18] libSystem.B.dylib:0x900246e8
The program doesn't crash when i remove the Quartz lines (i.e.
functions that begin with CG) so I am hoping that I can use just CGL
without Quartz. Since Psychotoolbox uses both, I know there must be a
way to get both working in a mex file. I was wondering if you've run
into a similar issue while developing Psychotoolbox and if so, if you
had any hints on how to solve it. Also, I noticed that Psychotoolbox
attempted to use SDL at some point. I was trying to use SDL/OpenGL in
my mex file but with no luck. Matlab complained it couldn't
find SDL_main symbol when I ran the mex file. I was wondering if you
had any luck getting SDL to run in a mex file. Thank you for your
time, suggestions, and also your excellent work with Psychotoolbox.
Thanks,
Tri Ngo