[pygame] Nehe Lesson 19
Hi, I was just wondering if NeHe's lesson 19 (particle engine), has been ported to pygame/pyopengl? I can't seem to find the python version of it. Thanks! Astan
Re: [pygame] Nehe Lesson 19
It doesn't look like it's been ported. It looks pretty simple, though. The particles are simply added, moved, and drawn without a depth test. It doesn't even have commonplace optimizations (display lists, or VBOs). It would be a 30 minute job, tops. Ian
Re: [pygame] Nehe Lesson 19
I remember porting it ages ago... but can't find it. oh here it is... http://www.py3d.org/files/lesson19.zip had to restore the py3d.org/files folder... since py3d.org has been dormant for 6 years or so. cu, On Mon, Jun 15, 2009 at 4:49 PM, Astan Cheeastan.c...@al.com.au wrote: Hi, I was just wondering if NeHe's lesson 19 (particle engine), has been ported to pygame/pyopengl? I can't seem to find the python version of it. Thanks! Astan
Re: [pygame] Nehe Lesson 19
Thanks! I was looking for that for awhile. Cheers Astan René Dudfield wrote: I remember porting it ages ago... but can't find it. oh here it is... http://www.py3d.org/files/lesson19.zip had to restore the py3d.org/files folder... since py3d.org has been dormant for 6 years or so. cu, On Mon, Jun 15, 2009 at 4:49 PM, Astan Cheeastan.c...@al.com.au wrote: Hi, I was just wondering if NeHe's lesson 19 (particle engine), has been ported to pygame/pyopengl? I can't seem to find the python version of it. Thanks! Astan
Re: [pygame] Nehe Lesson 19
Nice, René!
[pygame] First person shooter help
Hi, I am trying to understand and make a simple first person shooter game. I have got the map down and some objects in it using openGL. I am having problems now with the controls as well as the mathematics (or logic) behind it. Can anyone suggest a simple fps in pygame openGL that demonstrates this? I have looked around and most examples are full blown games (that are hard to read) and the simplest examples don't show proper control for movement. By proper control I mean those that are common in fps games (e.g: HL,quake). Thanks for any help or suggestions. Cheers Astan
Re: [pygame] Nehe Lesson 19
I think you'll find a particle engine close to unusable without VBOs or python-specific acceleration. For now, code it however you'd like, but when it comes time to run your actual game, you'll find that you have problems with performance. You're going to need to use numpy to manage the particles and pass this information to PyOpenGL directly. -Zack On Jun 15, 2009, at 3:04 AM, Astan Chee wrote: Thanks! I was looking for that for awhile. Cheers Astan René Dudfield wrote: I remember porting it ages ago... but can't find it. oh here it is... http://www.py3d.org/files/lesson19.zip had to restore the py3d.org/files folder... since py3d.org has been dormant for 6 years or so. cu, On Mon, Jun 15, 2009 at 4:49 PM, Astan Cheeastan.c...@al.com.au wrote: Hi, I was just wondering if NeHe's lesson 19 (particle engine), has been ported to pygame/pyopengl? I can't seem to find the python version of it. Thanks! Astan
[pygame] [patch] Bug in display's C-API
Hi, I found a bug in display's C-API code in pygame.h The code in question is: #define PyVidInfo_Type \ (*(PyTypeObject*)PyGAME_C_API[PYGAMEAPI_SURFACE_FIRSTSLOT + 0]) where it clearly should be PYGAMEAPI_DISPLAY_FIRSTSLOT. a trivial patch is attached. cheers //Lorenz Index: src/pygame.h === --- src/pygame.h(revision 2353) +++ src/pygame.h(working copy) @@ -357,7 +357,7 @@ PyGAME_C_API[PYGAMEAPI_DISPLAY_FIRSTSLOT + 0]) #define PyVidInfo_Type \ -(*(PyTypeObject*)PyGAME_C_API[PYGAMEAPI_SURFACE_FIRSTSLOT + 0]) +(*(PyTypeObject*)PyGAME_C_API[PYGAMEAPI_DISPLAY_FIRSTSLOT + 0]) #define PyVidInfo_New \ (*(PyObject*(*)(SDL_VideoInfo*))\ PyGAME_C_API[PYGAMEAPI_DISPLAY_FIRSTSLOT + 1])
Re: [pygame] Nehe Lesson 19
Hi http://code.google.com/p/py-lepton/ ~DR0ID Zack Schilling schrieb: I think you'll find a particle engine close to unusable without VBOs or python-specific acceleration. For now, code it however you'd like, but when it comes time to run your actual game, you'll find that you have problems with performance. You're going to need to use numpy to manage the particles and pass this information to PyOpenGL directly. -Zack On Jun 15, 2009, at 3:04 AM, Astan Chee wrote: Thanks! I was looking for that for awhile. Cheers Astan René Dudfield wrote: I remember porting it ages ago... but can't find it. oh here it is... http://www.py3d.org/files/lesson19.zip had to restore the py3d.org/files folder... since py3d.org has been dormant for 6 years or so. cu, On Mon, Jun 15, 2009 at 4:49 PM, Astan Cheeastan.c...@al.com.au wrote: Hi, I was just wondering if NeHe's lesson 19 (particle engine), has been ported to pygame/pyopengl? I can't seem to find the python version of it. Thanks! Astan
Re: [pygame] import pygame crashes with svn build
Hi again, you figured this out yet? not 100% but at least now I get it to compile by following your advice: Easiest way to work around it... Comment out import transform lines in the file: site-packages/pygame/__init__.py [...] Perhaps try commenting out the sse/mmx parts? that seems to be the problem. If I comment out # include scale_mmx64.c in scale_mmx.c it compiles. if I import pygame the interpreter naturally complains about undefined symbols but as long as I don't use the transform module it seems to work this way as well. of course this is not a solution. For debugging purposes I tried to remove all SSE/MMX code and simply implement empty dummy functions like this: void filter_shrink_X_MMX(Uint8 *srcpix, Uint8 *dstpix, int height, int srcpitch, int dstpitch, int srcwidth, int dstwidth) {} that also crashed. I find this very confusing and frustrating. So I settle with the work around for now. thanks again for the help and if I can help with some debug information or if you have any ideas let me know. yours //Lorenz
[pygame] [patch] minor memory leaks in color.c, font.c, mask.c and pixelarray.c
Hi, I found a series of minor memory leak. minor because they only occurs in situations where a call like PyDict_SetItemString of PyModule_AddObject fails which means things are already pretty bad anyway. Nevertheless here is the bug description: In color.c in the MODINIT_DEFINE (color) function at the end the apiobj leaks if the call to PyDict_SetItemString fails. In font.c and mask.c the apiobj leaks if the call to PyModule_AddObject fails. Note that normally PyModule_AddObject steals a reference, but it only does so on success. In pixelarray.c the leaking object is PyPixelArray_Type also with the failing call to PyModule_AddObject. I attached a patch. yours //Lorenz Index: src/font.c === --- src/font.c (revision 2356) +++ src/font.c (working copy) @@ -806,6 +806,7 @@ MODINIT_ERROR; } if (PyModule_AddObject (module, PYGAMEAPI_LOCAL_ENTRY, apiobj) == -1) { +Py_DECREF (apiobj); DECREF_MOD (module); MODINIT_ERROR; } Index: src/color.c === --- src/color.c (revision 2356) +++ src/color.c (working copy) @@ -1608,7 +1608,6 @@ { PyObject *colordict; PyObject *module; -PyObject *dict; PyObject *apiobj; static void* c_api[PYGAMEAPI_COLOR_NUMSLOTS]; @@ -1677,7 +1676,6 @@ DECREF_MOD(module); MODINIT_ERROR; } -dict = PyModule_GetDict (module); c_api[0] = PyColor_Type; c_api[1] = PyColor_New; @@ -1689,11 +1687,11 @@ DECREF_MOD(module); MODINIT_ERROR; } -if (PyDict_SetItemString (dict, PYGAMEAPI_LOCAL_ENTRY, apiobj)) { +if (PyModule_AddObject (module, PYGAMEAPI_LOCAL_ENTRY, apiobj)) { +Py_DECREF (apiobj); Py_DECREF (_COLORDICT); DECREF_MOD(module); MODINIT_ERROR; } -Py_DECREF (apiobj); MODINIT_RETURN (module); } Index: src/pixelarray.c === --- src/pixelarray.c(revision 2356) +++ src/pixelarray.c(working copy) @@ -2164,6 +2164,7 @@ if (PyModule_AddObject (module, PixelArray, (PyObject *) PyPixelArray_Type) == -1) { +Py_DECREF ((PyObject *) PyPixelArray_Type); DECREF_MOD (module); MODINIT_ERROR; } Index: src/mask.c === --- src/mask.c (revision 2356) +++ src/mask.c (working copy) @@ -1538,6 +1538,7 @@ MODINIT_ERROR; } if (PyModule_AddObject (module, PYGAMEAPI_LOCAL_ENTRY, apiobj) == -1) { +Py_DECREF (apiobj); DECREF_MOD (module); MODINIT_ERROR; }
[pygame] Movie Module Progress-pending Alpha Release
Some good news to everyone: I got sound working today. There's still some basic features I need to add, like dealing with surfaces rather than just overlays as it does right now. I want to have an alpha release by the end of the week for wider-spread testing. I would like the module tested on as wide a range of movie files as possible. There is one bug I've noticed, which I'm quite sure is due to the nature of the video file, but when one uses the blue.mpg video file in the examples/data directory, trying to access any members or use a method of the movie object hangs. I think this is due to the fact its just a one-frame video. As well, there is some small issues where there is about 0.1 to 0.2 MB of data lost to a memory leak per play through of a video file. These have been identified as due to ffmpeg, and the memory leaks have been fixed in the svn version of ffmpeg. I will be finishing the last few features for the module, adding some basic interaction stuff, changing the names, and so on. I will also work on the python interface layer for the movie module this week, such that we can use a backup video player if the libraries fail. I also hope to get some documentation written for the module as well this week. For the next release, I will be working on adding subtitle support, fixing up timing issues that I've noticed, and adding more accessibility and features, like seeking. At the time of the alpha release, I'll provide a full step-by-step guide for how to access it. Any questions or criticism, please feel free to let me know! -Tyler Laing -- Visit my blog at http://oddco.ca/zeroth/zblog
Re: [pygame] Nehe Lesson 19
There's also ways to do it on the GPU, when you need serious particle power. http://www.youtube.com/watch?v=Hm8ARVmbefQ
Re: [pygame] [patch] minor memory leaks in color.c, font.c, mask.c and pixelarray.c
Lorenz Quack wrote: Hi, I found a series of minor memory leak. minor because they only occurs in situations where a call like PyDict_SetItemString of PyModule_AddObject fails which means things are already pretty bad anyway. Nevertheless here is the bug description: In color.c in the MODINIT_DEFINE (color) function at the end the apiobj leaks if the call to PyDict_SetItemString fails. In font.c and mask.c the apiobj leaks if the call to PyModule_AddObject fails. Note that normally PyModule_AddObject steals a reference, but it only does so on success. In pixelarray.c the leaking object is PyPixelArray_Type also with the failing call to PyModule_AddObject. I attached a patch. yours //Lorenz Hi Lorenz, Yes your right. I assumed that since PyModule_AddObject is documented as stealing a reference, it always stole a reference. But in reality it only does so conditionally, when it succeeds. Lenard
Re: [pygame] import pygame crashes with svn build
Hi Lorenz, Could you try dropping in SVN rev 1912 of transform.c instead. This predates the Python 3 updates. This is kind of reaching, but it will narrow down the search. Thanks, Lenard Lorenz Quack wrote: Hi again, you figured this out yet? not 100% but at least now I get it to compile by following your advice: Easiest way to work around it... Comment out import transform lines in the file: site-packages/pygame/__init__.py [...] Perhaps try commenting out the sse/mmx parts? that seems to be the problem. If I comment out # include scale_mmx64.c in scale_mmx.c it compiles. if I import pygame the interpreter naturally complains about undefined symbols but as long as I don't use the transform module it seems to work this way as well. of course this is not a solution. For debugging purposes I tried to remove all SSE/MMX code and simply implement empty dummy functions like this: void filter_shrink_X_MMX(Uint8 *srcpix, Uint8 *dstpix, int height, int srcpitch, int dstpitch, int srcwidth, int dstwidth) {} that also crashed. I find this very confusing and frustrating. So I settle with the work around for now. thanks again for the help and if I can help with some debug information or if you have any ideas let me know. yours //Lorenz