iPhone 3D Broken

Previous topic - Next topic

bigsofty

See the code below (its the Heli demo from the Samples) and unremark 'X_DRAWOBJ 1, 0' to crash... GDB console output below that. "Program received signal:  ââ,¬Å"EXC_BAD_ACCESSââ,¬Â."

Also, what is "backing: 320 x 480" from the GDB? I set this program to landscape(480x320)?


Code (glbasic) Select
// --------------------------------- //
// Project:
// Start: Friday, October 13, 2006
// IDE Version: 3.283


// Make a rotor

// a rotor blade
X_OBJSTART 0
X_OBJADDVERTEX   0,0,-.1,  0,0, cn
X_OBJADDVERTEX  10,0, -1, .1,0, c
X_OBJADDVERTEX  10,0,  1,-.1,0, c
X_OBJADDVERTEX   0,0, .1,  0,0, cn
X_OBJADDVERTEX   0,0,-.1,  0,0, cn
X_OBJADDVERTEX -10,0,  1,  0,0, c
X_OBJADDVERTEX -10,0, -1, .1,0, c
X_OBJADDVERTEX   0,0,-.1,-.1,0, cn
X_OBJEND


c=RGB(0xff, 0xff, 0xff)
cn=RGB(0xff,0xff,0xff)

// a "helicopter"
X_OBJSTART 1
X_OBJADDVERTEX  0,   0,  0, 0,0,  cn
X_OBJADDVERTEX -2,  -2,  1, 0,0,  c
X_OBJADDVERTEX  2,  -1,  1, 0,0,  c
X_OBJADDVERTEX  0,  -4, .5, 0,0,  c
X_OBJADDVERTEX  2,  -3,  1, 0,0,  c
X_OBJADDVERTEX 10,  -2,  0, 0,0,  c
X_OBJADDVERTEX 10,-2.5,  0, 0,0,  c
X_OBJNEWGROUP
X_OBJADDVERTEX  0,   0,  0, 0,0,  cn
X_OBJADDVERTEX -2,  -2, -1, 0,0,  c
X_OBJADDVERTEX  2,  -1, -1, 0,0,  c
X_OBJADDVERTEX  0,  -4,-.5, 0,0,  c
X_OBJADDVERTEX  2,  -3, -1, 0,0,  c
X_OBJADDVERTEX 10,  -2,  0, 0,0,  c
X_OBJADDVERTEX 10,-2.5,  0, 0,0,c
X_OBJEND

// a tree
c = RGB(0xff, 0xff, 0xff)
cn= RGB(0xff, 0xff, 0xff)
X_OBJSTART 2
X_OBJADDVERTEX 0,0,0,    0,0, c
X_OBJADDVERTEX 0,-10,2,  0,0, cn
X_OBJADDVERTEX 0,-10,-2, 0,0, cn
X_OBJNEWGROUP
X_OBJADDVERTEX 0,   0,0, 0,0, c
X_OBJADDVERTEX 2, -10,0, 0,0, cn
X_OBJADDVERTEX -2,-10,0, 0,0, cn
X_OBJEND


pitch = 90

WHILE 1

dtime = GETTIMER()/100
INC accx, MOUSEAXIS(1)*dtime*.01 // forward
INC accz, MOUSEAXIS(0)*dtime*.01 // sideways
INC accr, (MOUSEAXIS(3) - MOUSEAXIS(4))*dtime // rotation
INC spin, dtime*30

dtime = GETTIMER()/100
INC accx, MOUSEAXIS(1)*dtime*.01 // forward
INC accz, MOUSEAXIS(0)*dtime*.01 // sideways
INC accr, (MOUSEAXIS(3) - MOUSEAXIS(4))*dtime // rotation
INC spin, dtime*30

// air friction
DEC accr, 0.1*accr*dtime
DEC accx, 0.1*accx*dtime
DEC accz, 0.1*accz*dtime

yaw   = accx*45
roll  = accz*45
INC pitch, accr*dtime

// Directional movement to global movement
acgx =  COS(pitch)*accx - SIN(pitch)*accz
acgz = -SIN(pitch)*accx - COS(pitch)*accz

INC posx, acgx*dtime
INC posz, acgz*dtime

X_MAKE3D 1,300,45
X_CAMERA posx,20,posz-50, posx,0,posz


// positioning
X_MOVEMENT posx, 0, posz
X_PUSHMATRIX

// the helicopter itself:
// first incline the thing
X_ROTATION yaw, 0,0,-1
// roll it
X_ROTATION roll, -1,0,0
// then rotate it
X_ROTATION pitch,    0,1,0
// X_DRAWOBJ 1, 0
X_PUSHMATRIX // we go relative to the rotated helicopter now
// add a rotation for the top rotor
// see: I spin it around the y-axis of the chopper!
X_ROTATION spin, 0,1,0
// X_DRAWOBJ 0, 0

// * the back propeller *
// I move it to the tail -> that clears the above rotation
X_MOVEMENT 10,-2.2,0
X_SCALING .1, .1, .1
// I rotate it to face the side
X_ROTATION 90, 1,0,0

X_ROTATION 2*spin, 0,0,1
// X_DRAWOBJ 0, 0

X_POPMATRIX
X_POPMATRIX


X_MAKE2D
PRINT "TESTING...",0,0
SHOWSCREEN




WEND

WHILE TRUE




// positioning
X_MOVEMENT posx, 0, posz
X_PUSHMATRIX

// the helicopter itself:
// first incline the thing
X_ROTATION yaw, 0,0,-1
// roll it
X_ROTATION roll, -1,0,0
// then rotate it
X_ROTATION pitch,    0,1,0
X_DRAWOBJ 1, 0
X_PUSHMATRIX // we go relative to the rotated helicopter now
// add a rotation for the top rotor
// see: I spin it around the y-axis of the chopper!
X_ROTATION spin, 0,1,0
X_DRAWOBJ 0, 0

// * the back propeller *
// I move it to the tail -> that clears the above rotation
X_MOVEMENT 10,-2.2,0
X_SCALING .1, .1, .1
// I rotate it to face the side
X_ROTATION 90, 1,0,0

X_ROTATION 2*spin, 0,0,1
X_DRAWOBJ 0, 0

X_POPMATRIX
X_POPMATRIX


// the wood
FOR x=-5 TO 5
FOR y=-5 TO 5
X_MOVEMENT x*20, 0, y*20
X_DRAWOBJ 2,0
NEXT
NEXT

SHOWSCREEN
WEND



Code (glbasic) Select
Program exited with status value:0.
[Session started at 2010-02-20 01:40:29 +0000.]
GNU gdb 6.3.50-20050815 (Apple version gdb-1128) (Fri Dec 18 10:08:53 UTC 2009)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=i386-apple-darwin --target=arm-apple-darwin".tty /dev/ttys001
Loading program into debuggerââ,¬Â¦
sharedlibrary apply-load-rules all
Program loaded.
target remote-mobile /tmp/.XcodeGDBRemote-1369-53
Switching to remote-macosx protocol
mem 0x1000 0x3fffffff cache
mem 0x40000000 0xffffffff none
mem 0x00000000 0x0fff none
run
Runningââ,¬Â¦
[Switching to thread 11779]
[Switching to thread 11779]
(gdb) continue
2010-02-20 01:40:35.152 medsim[299:207] *** _NSAutoreleaseNoPool(): Object 0x1070b0 of class NSCFString autoreleased with no pool in place - just leaking
Stack: (0x32296f87 0x3226b135 0x3226b107 0x32a1c915 0x21a10 0x78f4 0x78c8)
2010-02-20 01:40:35.164 medsim[299:207] *** _NSAutoreleaseNoPool(): Object 0x107260 of class NSCFData autoreleased with no pool in place - just leaking
Stack: (0x32296f87 0x3226b135 0x3226b107 0x3226b331 0x3226b1c3 0x3226b1a1 0x21a28 0x78f4 0x78c8)
ID: 674da4df56b68012edf2735fcfb1064cf1baa3b0init with coder
app did finish launching, view=0x11c1b0
start ani
applicationDidBecomeActive
backing: 320 x 480
Init GFX
Init Finalized
Program received signal:  ââ,¬Å"EXC_BAD_ACCESSââ,¬Â.
(gdb)
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Kitty Hello

Oh dear. Bug filed.

matchy

Use rgb hex for the texture coord colour!
Try changing RGB(255,255,255) to RGB(0xFF,0xFF,0xFF).


bigsofty

Ive tried it in a few programs,  'X_DRAWOBJ' is causing problems.
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Kitty Hello

X_DRAW causes the problem?
I think it's because of X_OBJSTART and such. Try saving the object and load that file on the iPhone. My tests with loaded objects are all positive.
However... the S-Zero uses X_OBJSTART, too and that one worked for me :/

Oh dear.

bigsofty

Quote from: Kitty Hello on 2010-Feb-22
X_DRAW causes the problem?
I think it's because of X_OBJSTART and such. Try saving the object and load that file on the iPhone. My tests with loaded objects are all positive.
However... the S-Zero uses X_OBJSTART, too and that one worked for me :/

Oh dear.

Yes, I can load and display .DDD but not create new 3D object within the code.

Still at least I can get some 3D up and running.
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Kitty Hello

OK, thanks for testing. I'll dig into it.

bigsofty

Anything news on this one Gernot, its stopped my project dead.
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Kitty Hello

I'm so sorry, no time for that, yet.

bigsofty

Anything on an ETA for this fix yet Gernot?

I have a guy waiting for this program to get finished and I am trying to keep him updated.
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Kitty Hello

I can't tell. What I can tell is that it won't be before wednesday, as I have to give a training for 10 engineers in my work on that day. And I'm a tiny bit behind schedule with that <shiver in fear smiley>
So so sorry.

bigsofty

No problem Gernot, I understand, I'll pass on the info.
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

matchy

This will work if all of the vertex colours are set to RGB(0xff,0xff,0xff) only. So if you want to demo with colours on the iPhone, apply a texture map with the appropriate colours!

Kitty Hello

Excellent debugging!!!!!
If it's the colours that make the problem, it's much easier for me to debug now.
-> Always use a texture for the colours, that's much, much faster!
In my Dr. Shiver game, the objects are unicolor, but I have an 8x8 texture with the colour "palatte"

bigsofty

#14
While this seems to help with the first X_DRAWOBJ ("//      X_DRAWOBJ 1, 0"), you soon run into the trouble when you try and draw an object within the second PUSHMATRIX ("X_DRAWOBJ 0, 0") this cause the same old error. Only when a PUSHMATRIX is nested within another PUSHMATRIX AND you the try an X_DRAWOBJ does this seem to happen though.

Call dump, #0 is the actual crashing OpenGLES call...

Code (glbasic) Select
#0  0x006de1d2 in gleRunVertexSubmitARM ()
#1  0x006de55a in gleLLVMArrayFunc ()
#2  0x006dfe2e in gleSetVertexArrayFunc ()
#3  0x006d3008 in gleDrawArraysOrElements_ExecCore ()
#4  0x006d3c28 in gleDrawArraysOrElements_IMM_Exec ()
#5  0x006d3eea in glDrawArrays_IMM_Exec ()
#6  0x0068194a in glDrawArrays_Exec ()
#7  0x30abacbc in glDrawArrays ()
#8  0x0001addc in Rainbows3D::RenderMD2 ()
#9  0x0001bebc in Rainbows3D::RenderAnim ()
#10 0x0002028c in __GLBASIC__::X_DRAWOBJ ()
#11 0x00085454 in __GLBASIC__::Entity_intern_drawall ()
#12 0x000859e8 in __GLBASIC__::EntityDrawSystem ()
#13 0x00071ef8 in __GLBASIC__::__MainGameSub_ ()
#14 0x000105c8 in iPhoneMain ()
#15 0x00036444 in iPhoneMainThread ()
#16 0x32482930 in _pthread_body ()
#17 0x00000000 in ?? ()
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)