{"id":15502987,"url":"https://github.com/evuez/flyinghigh-opengl-from-python","last_synced_at":"2025-03-28T18:23:24.094Z","repository":{"id":35661165,"uuid":"39936214","full_name":"evuez/flyinghigh-opengl-from-python","owner":"evuez","description":"Automatically exported from code.google.com/p/flyinghigh-opengl-from-python","archived":false,"fork":false,"pushed_at":"2015-07-30T07:05:40.000Z","size":3560,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-19T17:30:29.017Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/evuez.png","metadata":{"files":{"readme":"README.txt","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-30T07:03:08.000Z","updated_at":"2015-07-30T07:03:52.000Z","dependencies_parsed_at":"2022-09-16T08:41:57.750Z","dependency_job_id":null,"html_url":"https://github.com/evuez/flyinghigh-opengl-from-python","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evuez%2Fflyinghigh-opengl-from-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evuez%2Fflyinghigh-opengl-from-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evuez%2Fflyinghigh-opengl-from-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evuez%2Fflyinghigh-opengl-from-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evuez","download_url":"https://codeload.github.com/evuez/flyinghigh-opengl-from-python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246077539,"owners_count":20720011,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T09:11:46.640Z","updated_at":"2025-03-28T18:23:24.072Z","avatar_url":"https://github.com/evuez.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nThe source code in this directory is an exploration of the ideas for a talk\nabout using OpenGL from Python. Run the demo code using:\n\n    python -O run.py [-f]\n\n-f runs fullscreen.\n\nAs always for pyglet / OpenGL programs, the -O flag is important, it can make\nthings much faster.\n\nPressing keys adds and removes items from the world. Generally:\n    1, 2, 3... simple shapes, then simple composite shapes\n    q, w, e... more complex composite shapes\n    a, s, d... recursively generated shapes\nPageUp, PageDown moves the camera nearer or further from the origin.\nShift PageUp, Shift PageDown modifies the variability of the camera's distance\nfrom the origin (makes it automatically zoom in and out)\n\n\nDEPENDENCIES\n------------\n\nTo be able to run the demo, you'll first need:\n\n    Windows or Linux (maybe Macs too, I haven't tried)\n    Python 2.6 or 2.7\n    Pyglet 1.1.4\n    numpy 1.5.0.dev8477 (just used for sierpinski generation)\n\nThe version numbers for everything except Python probably aren't crucial, but\nthose are the versions I'm running.\n\nI can't install numpy from source for Python2.7 (I can't succesfully\nconfigure distutils to use the mingw32 compiler instead of Visual Studio on\nPython 2.7) and there are not yet numpy binaries published for Python2.7, so\nI'm using an unofficial numpy binary from here:\nhttp://www.lfd.uci.edu/~gohlke/pythonlibs/\n\n\nDEVELOPMENT\n-----------\n\nFor development, I'm also using:\n\n    unittest2 (not reqd for Python2.7)\n    nose\n\nrunning tests using 'nosetests' (unittest2 discovery has some wrinkles)\n\nAlso I have some simple commands stored in a Makefile, which I run under Linux\nor under Windows with Cygwin binaries on the PATH. If you're on Windows but\ndon't have make or Cygwin, open up the Makefile and examine the targets. The\ncommands they run are generally dead simple and you can easily figure out how\nto do the same thing on your own system.\n\n\nPROFILING\n---------\n\nFor profiling, I'm using the standard library cProfile, with 3rd party tool\n'RunSnakeRun' to draw the output graphically.\n\n    make profile\n\nwill run the script under the profiler, then run RunSnakeRun on the output.\n\nRunSnakeRun is installed using: ``easy_install RunSnakeRun`` (or pip) or\ndownload from:\n\n * http://www.vrplumber.com/programming/runsnakerun/\n\nRunSnakeRun also needs:\n\n * SquareMap: ``easy_install SquareMap`` (or pip)\n * wxPython from http://www.wxpython.org/download.php#binaries\n\nCurrently runs under Windows at 60fps on my modest 2005-era Thinkpad laptop\n(with ATI Radeon X1400). I just fired it up under Ubuntu and got a\ndisappointing 20fps. Haven't looked at why, but in the past similar code has\ntended to run faster under Linux on my hardware, so hopefully this is something\neasily fixable. \n\n\nDESIGN NOTES\n------------\n\nThe hub of the design is the 'engine.GameLoop' class, which contains the\nmain game loop and responds to pyglet window events such as update and\ndraw.\n\nEvery item that exists in the 3D space (visible objects, and the\ncamera) is represented by an instance of the minimal 'engine.GameItem' class.\n\nThe engine.World class maintains a collection of these GameItem instances.\n\nThe bestiary instantiates a bunch of gameitems, and puts them in a dictionary,\nkeyed by keyboard symbols. The keyhandler, on recieving a keypress, looks\nup the corresponding gameitem and adds it into the world (or removes it if\nalready there)\n\nThe engine.Render class is used by the window draw handler, to render the\ncontents of the world. If the GameItem has a 'glyph' attribute, then that\nobject is expected to provide OpenGL arrays suitable for passing to \nglDrawElements.\n\nThe code is organised in a 'prefer composition to inheritance' kind of\ndesign. GameItem itself does little more than assign each instance a unique\nID, used as the key in World's collection if GameItems. Instances of GameItem\nare then assigned arbitrary attributes at runtime. Generally the value of these\nattributes are instances of the classes defined in the 'components'\nsub-package, eg. gameitem.glyph is set to an instance of component.Glyph.\nGameItems with this attribute are rendered by engine.Render. Those without it\n(eg. the camera) are not rendered. There is a tendency for each module in\n'engine' to pair up with one module from 'components'. Possibly making these\ngroupings explicit pairing explicit would be a better way to lay out the files\nthan the current engine/components split.\n\nCurrently, all glyph attribute values are derived directly from the gameitem's\n'shape' attribute. The Glyph class does this conversion itself, in response\nto an item being added to the world event.\n\nOther components that may be attached to gameitems as attributes include\nspinners and movers, that move or reorient their parent gameitem. For\nexample, the camera gameitem has a 'mover' attribute, which is an instance\nof component.WobblyOrbit. This is responsible for the camera movement.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevuez%2Fflyinghigh-opengl-from-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevuez%2Fflyinghigh-opengl-from-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevuez%2Fflyinghigh-opengl-from-python/lists"}