Strengths and weaknesses of Pygame vs. pyglet vs. PyOpenGL?
文章推薦指數: 80 %
PyOpenGL is also used a lot more by non-game people, so a wider array of functions are used. It's very unfortunate that pyglet and pyopengl don't share code ...
[email protected]
Discussion:
StrengthsandweaknessesofPygamevs.pygletvs.PyOpenGL?
illume
2008-12-0809:18:25UTC
Permalink
pygameissimplertolearn,sinceitdoesn'trequireyoutoknowhowtocreateclassesorfunctions.I'mnotsureifI'dbequicktotoutthatasanadvantage...:)Hi,It'seasiertoteachonlyrequiring*using*classes,andfunctionsthan*creating*them.Thisisimportantifit'sbeingusedtoteachprogramming-asyoudon'tneedtoteachpeopletwofairlylargeconceptsbeforeyoucandoanything.Peoplearemotivatedbyseeingresults.Soitcanbegoodtoletpeopledothingswithoutrequiringmuchlearning.Anyoneteachingobjectorientedprogramwilltellyouthatit'sahardconcepttopresenttopeople.SoifyoucanavoidteachingpartsofOO,andabunchofotherconceptsatthesametime,it'seasierforpeopletohandle.It'squitenicetobeabletohandleeventswithoutrequiringcallbacks.Everyonehatescallbacks,butlotsofpeopleusethemforeventsystems.Howevercallbacksaren'tneededatallforeventprogramming.Insteadyoucangetaneventasanobjectandthenprocessit.Callbacksforeventsmademoresenseinlanguageslikesmalltalkwhereeventsandmethodcallswerecloselyalignedconcepts(methodcallsaremessagesinsmalltalk).Howeverinlanguageswhereyoudon'thavesuchacloseconceptualalignment(suchaspython),makingeventsobjectsinsteadofmethodcallsismucheasiertounderstand.Alsopythonhasveryslowfunctioncalls,soavoidingusingcallbacksisalsofaster.Imagineusingcallbacksforfiles?Soyouwouldhavetosubclassfile,andmakearead_datamethod.Thenyourclasswillcallyourreaddatamethodwhensomedataarrives.Kindofannoying,andnotneeded.
illume
2008-12-0804:26:36UTC
Permalink
hello,PyOpenGLalsohasarawmodulewhichincludespythonbindingsclosertotheCcalls...howevermostlyyouwanttousethenicermorepythonicversionsoffunctions.Recentpyopengl3.xversionshavebeenoptimizedforspeed,includingoptionalCleveloptimizations.SoIimaginetheyarefasterthanpygletswrappers(profiling/testingneeded).PyOpenGLisalsousedalotmorebynon-gamepeople,soawiderarrayoffunctionsareused.It'sveryunfortunatethatpygletandpyopengldon'tsharecode...howeverrecentversionsofpyopengltriedtoreusesomeofpygletscode...notsurehowmuchhasbeensharedthough.Maybeatsomepointtheywillcometogether.Fornowpyglethascreatedaforkinthepython+openglcommunity,wherethesamecodecan'tbereusedautomaticallybetweenthetwoastheopenglwrappersareslightlydifferent.Howeverit'snotterriblydifficulttoportcodefromonetotheother,assomeprojectshavedone.pygamedoesn'trequireopenglbesupportedbythevideocard-itcanusemanydifferentvideodriverstogetthejobdone.It'snicetobeabletoavoidusingthe3Dpartsofgfxcardsifyoucan-toreducepowerconsumption,andmakeyourgamerunonmorecomputers.pygameisalsomuchmoreportable,hasmorepeopleusingit,hasmoredevelopers,andastableAPI.Codeyouwrote5yearsagowillmostlikelystillwork.Codeyouwroteforolderversionsofpygletwillnotworkwithoutchanges.pygameissimplertolearn,sinceitdoesn'trequireyoutoknowhowtocreateclassesorfunctions.Whereaspygletrequiresyoutosubclasstodoanything.http://pygame.org/wiki/about*disclaimer-I'mapygamedeveloper,andhaveinthepastcontributedtopyopengl-soobviouslyIpreferpygameandpyopengl.DoespygletusePyOpenGLasitsOpenGLwrapper?Ifnot,anyideawhy?Seemslikeitwouldbeafairlysubstantialduplicationofeffort.Takenfrom:http://groups.google.com/group/pyglet-users/msg/832b15389fccd28dIIRCpyglettriestominimizedependencies,soPyOpenGLwon'tbeused.?However,pyglet'swrappingofOpenGLisn'tmeanttobecomplete;it'sonlywhatpygletitselfuses.?You'llneedtousePyOpenGLfortherest.Thatwasmoreorlesstheoriginalplan.?pygletwrapsOpenGLatthelowestlevel,soitonlyprovidesglVertex3f,glVertex2d,etc.,whereasPyOpenGLalsoprovidespolymorphicfunctionssuchasglVertex.[...]pygletprovidesalloftheerror-checkingfunctionalitiesthatPyOpenGLdoes(thoughthesecanbedisabledforperformance).?Atlastcheck,pygletwassignificantlyfasterthanPyOpenGL3,butslowerthanPyOpenGL2.
Pierre-AlainDorange
2008-12-0810:17:36UTC
Permalink
Postbyillumepygameisalsomuchmoreportable,hasmorepeopleusingit,hasmoredevelopers,andastableAPI.Codeyouwrote5yearsagowillmostlikelystillwork.Codeyouwroteforolderversionsofpygletwillnotworkwithoutchanges.I'manewpythonandpygameuser(icamefromC/C++),veryeasytolearnandyougotresultsveryfast.I'vedonealowinvestigationbeforechoosingpygameoverpyglet.Ichoosepygamebecauseionlyneed2Dandalsobecauseitseemsthereismoredocumentations,samples,booksanddevelopersforpygame.pygameisreallyeasytolearnandseemsfasttomeandeasytoextend(derivateclass),supportimage,sound,etc...Andcanbebundledwithpy2app(Mac):importanttodistributetheproject.Ijustrunabugwhnusingbackgroundmusic,py2appfailticreatethebundle...OnmyiMacintel,irunmysmallarcadegame(aspaceinvaderlike)between800-1400fpsusingdirtyrect.IcanalsorunwithoutmodificationonWindowsandUnbuntuusingWMWareonthesamemachine.--Pierre-AlainDorange
延伸文章資訊
- 1I'd like to learn graphics programming. Should I go with pyglet ...
PyOpenGL is nothing but a wrapper for OpenGL itself - no sound, no window management, just 3D gra...
- 2PYTHON : PyOpenGl or pyglet? - YouTube
- 3Dependencies: Pyglet vs PyOpenGL - Google Groups
We basically have two choices: Pyglet or PyOpenGL. The former being a bit basic, the latter being...
- 4PyOpenGl or pyglet - anycodings
PyOpenGl or pyglet? I am looking to do some tinkering with anycodings_pyglet openGL and ...
- 53d - Will I have an easier time learning OpenGL in Pygame or ...
If you just want to learn OpenGL, pyglet or PyOpenGL with the SuperBible will be fine. If you wan...