I tried incorporating MeshDrawer into my game with code very close to treeforms own sample:
def buildStars(self):
stargenerator = MeshDrawer()
stargenerator.setBudget(100)
stargenerator.setPlateSize(1)
stargeneratorNode = stargenerator.getRoot()
stargeneratorNode.reparentTo(render)
stargeneratorNode.setBin("starfield", 9)
stargeneratorNode.setDepthWrite(False)
stargeneratorNode.setDepthTest(False)
stargeneratorNode.setLightOff(True)
stargeneratorNode.setTexture(loader.loadTexture("../mceffects/white4x4.png"))
stargeneratorNode.setColor(1,1,1,1)
for i in range(50):
randomwhite = sample((0.8,0.9,1.0),1)[0] # randrange(0.8,1.0,0.1)
stardata = [self.randomStarVec()*60,1,0.1,Vec4(randomwhite,randomwhite,randomwhite,1)]
# billboard: pos, frame, size, color
self.StarList.append(stardata)
for pos,frame,size,color in self.StarList:
stargenerator.billboard(pos,frame,size,color)
stargenerator.begin(base.cam,render)
In the Terminal it seems that my game is starting since I can see the debug message that the HUD is built and the FPS display is there. However the screen stays black and after a few seconds Python crashes. The Terminal only says:
Bus Error
which is a first ever. Mac OS X.5, Panda3D 2010-01-12 21.
Here is the Python crash log:
pastebin.com/m6a7d2aa9
EDIT: Alright, thx to rdb this is fixed. Just move
stargenerator.begin(base.cam,render)
up three lines before stargenerator.billboard()
The first part with the Python thread for your viewing pleasure:
Process: Python [93178]
Path: /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python
Identifier: org.python.pythonapp
Version: 2.5.0 (2.5.0a0)
Build Info: python-300103~1
Code Type: X86 (Native)
Parent Process: bash [86977]
Date/Time: 2010-01-23 16:40:16.773 +0100
OS Version: Mac OS X 10.5.6 (9G2030)
Report Version: 6
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000010
Crashed Thread: 0
Thread 0 Crashed:
0 libpanda.dylib 0x01d5e092 GeomVertexWriter::add_data3f(LVecBase3f const&) + 18
1 libpanda.dylib 0x0203153e MeshDrawer::tri(LVector3f, LVector4f, LVector2f, LVector3f, LVector4f, LVector2f, LVector3f, LVector4f, LVector2f) + 46
2 libpanda.dylib 0x020163c7 MeshDrawer::billboard(LVector3f, int, float, LVector4f) + 1159
3 libpanda.dylib 0x0204c9da Dtool_MeshDrawer_billboard_117(_object*, _object*, _object*) + 554
4 org.python.python 0x0018f51e PyEval_EvalFrameEx + 17116
5 org.python.python 0x0018f700 PyEval_EvalFrameEx + 17598
6 org.python.python 0x00191173 PyEval_EvalCodeEx + 1638
7 org.python.python 0x0013b488 PyFunction_SetClosure + 2667
8 org.python.python 0x00121505 PyObject_Call + 50
9 org.python.python 0x00129e3a PyMethod_New + 2457
10 org.python.python 0x00121505 PyObject_Call + 50
11 org.python.python 0x0018a82d PyEval_CallObjectWithKeywords + 211
12 org.python.python 0x0012606f PyInstance_New + 305
13 org.python.python 0x00121505 PyObject_Call + 50
14 org.python.python 0x0018f832 PyEval_EvalFrameEx + 17904
15 org.python.python 0x00191173 PyEval_EvalCodeEx + 1638
16 org.python.python 0x0013b488 PyFunction_SetClosure + 2667
17 org.python.python 0x00121505 PyObject_Call + 50
18 org.python.python 0x00129e3a PyMethod_New + 2457
19 org.python.python 0x00121505 PyObject_Call + 50
20 org.python.python 0x0018a82d PyEval_CallObjectWithKeywords + 211
21 org.python.python 0x0012606f PyInstance_New + 305
22 org.python.python 0x00121505 PyObject_Call + 50
23 org.python.python 0x0018f832 PyEval_EvalFrameEx + 17904
24 org.python.python 0x00191173 PyEval_EvalCodeEx + 1638
25 org.python.python 0x0013b488 PyFunction_SetClosure + 2667
26 org.python.python 0x00121505 PyObject_Call + 50
27 org.python.python 0x0018fcd0 PyEval_EvalFrameEx + 19086
28 org.python.python 0x0018f700 PyEval_EvalFrameEx + 17598
29 org.python.python 0x0018f700 PyEval_EvalFrameEx + 17598
30 org.python.python 0x0018f700 PyEval_EvalFrameEx + 17598
31 org.python.python 0x0018f700 PyEval_EvalFrameEx + 17598
32 org.python.python 0x0018f700 PyEval_EvalFrameEx + 17598
33 org.python.python 0x0018f700 PyEval_EvalFrameEx + 17598
34 org.python.python 0x00191173 PyEval_EvalCodeEx + 1638
35 org.python.python 0x0013b488 PyFunction_SetClosure + 2667
36 org.python.python 0x00121505 PyObject_Call + 50
37 org.python.python 0x00129e3a PyMethod_New + 2457
38 org.python.python 0x00121505 PyObject_Call + 50
39 libpanda.dylib 0x0227f26a Thread::call_python_func(_object*, _object*) + 858
40 libpanda.dylib 0x0229b982 PythonTask::do_python_task() + 850
41 libpanda.dylib 0x0229aac3 AsyncTask::unlock_and_do_task() + 211
42 libpanda.dylib 0x022ab3bb AsyncTaskChain::service_one_task(AsyncTaskChain::AsyncTaskChainThread*) + 491
43 libpanda.dylib 0x022ac00e AsyncTaskChain::do_poll() + 286
44 libpanda.dylib 0x022ac11b AsyncTaskManager::poll() + 75
45 libpanda.dylib 0x022bf466 Dtool_AsyncTaskManager_poll_125(_object*, _object*, _object*) + 166
46 org.python.python 0x0018f51e PyEval_EvalFrameEx + 17116
47 org.python.python 0x0018f700 PyEval_EvalFrameEx + 17598
48 org.python.python 0x00191173 PyEval_EvalCodeEx + 1638
49 org.python.python 0x0018f79d PyEval_EvalFrameEx + 17755
50 org.python.python 0x0018f700 PyEval_EvalFrameEx + 17598
51 org.python.python 0x00191173 PyEval_EvalCodeEx + 1638
52 org.python.python 0x00191260 PyEval_EvalCode + 87
53 org.python.python 0x001a883c PyErr_Display + 1896
54 org.python.python 0x001a8e66 PyRun_FileExFlags + 135
55 org.python.python 0x001aa7d2 PyRun_SimpleFileExFlags + 421
56 org.python.python 0x001b5a57 Py_Main + 3095
57 org.python.pythonapp 0x00001fca 0x1000 + 4042