Strengths and weaknesses of Pygame vs. pyglet vs. PyOpenGL?

文章推薦指數: 80 %
投票人數:10人

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-AlainDorangeCemessageestsouslicenceCreativeCommons"by-nc-sa-2.0" alex23 2008-12-0808:31:56UTC Permalink pygameissimplertolearn,sinceitdoesn'trequireyoutoknowhowtocreateclassesorfunctions.I'mnotsureifI'dbequicktotoutthatasanadvantage...:) JamesMills 2008-12-0809:04:29UTC Permalink pygameissimplertolearn,sinceitdoesn'trequireyoutoknowhowtocreateclassesorfunctions.I'mnotsureifI'dbequicktotoutthatasanadvantage...:)Neitherwouldi.ClassesandObjectsandgoodOOPpractisescanbenefitapygamegamejustaswellasanyotherPythonapp.What'smoreusingandlearningPython'sOOsemanticsandsyntaxisreallyreallyeasy:)--JamesMills------"Problemsaresolvedbymethod" alex23 2008-12-0801:53:55UTC Permalink 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. alex23 2008-12-0809:59:48UTC Permalink PostbyillumeIt'seasiertoteachonlyrequiring*using*classes,andfunctionsthan*creating*them.?Thisisimportantifit'sbeingusedtoteachprogramming-asyoudon'tneedtoteachpeopletwofairlylargeconceptsbeforeyoucandoanything.I'mjustkindofaghastattheideaof"teaching"anyonehowtoprogramgamesbyusinglarge,imperativechunksofcode.Idon'tseefunctionsasbeinga"fairlylargeconcept"atall,andutterlyvitaltobeingabletowriteanythingbutthemostbasic'helloworld'examplecode.PostbyillumeAlsopythonhasveryslowfunctioncalls,soavoidingusingcallbacksisalsofaster.Wouldn'titbebettertoteachpeoplethebasicsofcoding-before-settingouttooptimisetheircode? illume 2008-12-0810:19:32UTC Permalink Postbyalex23PostbyillumeIt'seasiertoteachonlyrequiring*using*classes,andfunctionsthan*creating*them.?Thisisimportantifit'sbeingusedtoteachprogramming-asyoudon'tneedtoteachpeopletwofairlylargeconceptsbeforeyoucandoanything.I'mjustkindofaghastattheideaof"teaching"anyonehowtoprogramgamesbyusinglarge,imperativechunksofcode.Idon'tseefunctionsasbeinga"fairlylargeconcept"atall,andutterlyvitaltobeingabletowriteanythingbutthemostbasic'helloworld'examplecode.Yes,teachinghelloworldwithoutrequiringthecreationclassesisa*goodthing*.Imaginehavingtocreateclassestomakeahelloworldprogram?You'dhaveatypicaljavahelloworldprogram.ThismeansyouneedtoexplaintheconceptofOObeforetheycandohelloworld.It'saboutteachingconceptsseparately,ratherthanrequiringthemtobetaughtallatonce.Ifyoudon'tneedtousesomething,thenwhybotherusingit?Justforpurity?Pythonhasalonghistoryofnotmakingeverythingclasses.SoIseerequiringthecreationofclassestodo'helloworld'asbeingun-pythonicandoverlycomplex.Ialsoseeitgettinginthewayofseeingresults,whichisimportantwhenintiallylearningprogramming.Postbyalex23PostbyillumeAlsopythonhasveryslowfunctioncalls,soavoidingusingcallbacksisalsofaster.Wouldn'titbebettertoteachpeoplethebasicsofcoding-before-settingouttooptimisetheircode?Iwasexplaingtheadvantagesofavoidingcallbacks,andavoidingrequiringthecreationofclasses.Ithinkit'ssimpler,andfastertoavoidcallbacks.Iwasnotsayingthatit'sbettertooptimizepeoplescodebeforeteachingpeoplethebasicsofprogramming. excord80 2008-12-0800:43:05UTC Permalink Tryingtodecidewhichtogetstartedwith.Cananyonesuggestsomeprosandconstoeachofthem?WouldPyOpenGLbeinthesamecampasPygameandpyglet?DoeitherofPygameorpygletmakeuseofPyOpenGLbehindthescenes? PatrickMullen 2008-12-0801:17:45UTC Permalink Postbyexcord80Tryingtodecidewhichtogetstartedwith.Cananyonesuggestsomeprosandconstoeachofthem?WouldPyOpenGLbeinthesamecampasPygameandpyglet?DoeitherofPygameorpygletmakeuseofPyOpenGLbehindthescenes?--http://mail.python.org/mailman/listinfo/python-listPyOpengl-anopenglwrapper.Version2iswritteninc,version3insteadusesctypesPyglet-anopengl+events/sound/etcwrapperwritteninctypespygame-ansdlwrapperfor2drendering,sound,music,events,etcthatcanbeusedwithpyopenglif3dhardwaresupportisdesired.Ifyouwanttodo3d,yourchoiceisbasicallypygame+pyopenglorpyglet.pygletisnicebecauseitcomeswitheverythingyouneed,versuspygamewhereyouhavetointeractviapyopengl.Pygame+pyopengl2isfasterthanpygletorpygame+pyopengl3becuasepygletandpyopengl3takeahitfromctypes.Thereisaprojectwithpyopengl3thoughtoaddsomeccodetospeedthingsup,Ithinkitworkswithnumeric.Pygletwillbeeasiesttostartwithanduse,itseemstobeeveryone'sfavoritechoicethesedays. excord80 2008-12-0801:23:10UTC Permalink [snip]PyOpengl-anopenglwrapper.?Version2iswritteninc,version3insteadusesctypesPyglet-anopengl+events/sound/etcwrapperwritteninctypesDoespygletusePyOpenGLasitsOpenGLwrapper?Ifnot,anyideawhy?Seemslikeitwouldbeafairlysubstantialduplicationofeffort. TerryReedy 2008-12-0822:21:30UTC Permalink Postbyillumepygameissimplertolearn,sinceitdoesn'trequireyoutoknowhowtocreateclassesorfunctions.I'mnotsureifI'dbequicktotoutthatasanadvantage...:)Hi,It'seasiertoteachonlyrequiring*using*classes,andfunctionsthan*creating*them.Thisisimportantifit'sbeingusedtoteachprogramming-asyoudon'tneedtoteachpeopletwofairlylargeconceptsbeforeyoucandoanything.Everyprogramdefinesafunctionthatmapsinputfromtheexternalworld(possiblenull,butnotforagame)tooutputtotheexternalworld(presumablenotnull,certainlynotforagame).Sodefininginternalfunctionobjectsisnotthatbigastep.Iagreethatcreatingnewclassesisabigstep,andthatusingcallbackscanbeamind-twister.tjr 11Replies 100Views Permalinktothispage Disableenhancedparsing ThreadNavigation illume 2008-12-0809:18:25UTC illume 2008-12-0804:26:36UTC Pierre-AlainDorange 2008-12-0810:17:36UTC alex23 2008-12-0808:31:56UTC JamesMills 2008-12-0809:04:29UTC alex23 2008-12-0801:53:55UTC alex23 2008-12-0809:59:48UTC illume 2008-12-0810:19:32UTC excord80 2008-12-0800:43:05UTC PatrickMullen 2008-12-0801:17:45UTC excord80 2008-12-0801:23:10UTC TerryReedy 2008-12-0822:21:30UTC about-legalese Loading...



請為這篇文章評分?