Git Product home page Git Product logo

pi3d's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pi3d's Issues

Hiding behind a transparent trextured shape

Earth.py - remove the actual earth picture. You can see stars all the way down, but the moon and moonlet go behind the cloud curtain.

Not sure whether this is involved with how a texture is invisible on a plane when the plane has its back to you. (trick to avoid the problem: dupe the texture, flip horizontally, create an identical shape for the flipped texture as for the normal one, rotate the flipped shape on Y by 180 degrees, then whenever the normal shape is rotated X, Y, and Z, rotate the flipped one -X, Y, -Z.) Works on a plane. When the plane's backside is showing, you see it as if you're looking through the plane. Left to right: Europe, Americas, Australia.

Graceful shutdown.

When a shutdown is requested, all threads should terminate automatically.

Includes #17, "I think it's worth adding the thread stopping method to mouse"

Megastation demo doesn't work in integration branch with nobottom.

You get a crash because the number of faces is not the same as the number of arrays.

It seems to me this is to do with the nobottom fix - because I could fix it by turning nobottom to off.

I added a top-level flag to do that and also an assertion to go off before the error does... I'll push it as soon as I get more bandwidth...

ConferenceHall demo crashes with an assertion error.

Everything else is fine, doesn't appear to be anything I've done...

Traceback (most recent call last):
File "./demos/ConferenceHall.py", line 117, in
DISPLAY.resize(win.winx,win.winy,win.width,win.height-bord)
File "/home/pi/pi3d/pi3d/Display.py", line 105, in resize
self.opengl.resize(x, y, w, h)
File "/home/pi/pi3d/pi3d/util/DisplayOpenGL.py", line 110, in resize
self.create_surface(x, y, w, h)
File "/home/pi/pi3d/pi3d/util/DisplayOpenGL.py", line 92, in create_surface
assert self.surface != EGL_NO_SURFACE
AssertionError
AssertionError

BouncingBalls no longer works.

Traceback (most recent call last):
File "Demo.py", line 129, in
run_demo(sys.argv[1], demo_list)
File "Demo.py", line 97, in run_demo
run_one_demo(d)
File "Demo.py", line 90, in run_one_demo
import('demos.' + demo)
File "/home/pi/pi3d/demos/BouncingBalls.py", line 15, in
from pi3d.util.String import drawString2D
ImportError: cannot import name drawString2D

FAQ: troubleshooting document.

We need a document explaining all the ways that you can get bad results with the program - this includes documenting the white screens and stack traces with inadequate memory.

all pi3d operations must be on the main Python thread.

This took me a long time to boil down into a tiny test case. I still don't have a good fix for it in general though I can work around it in my codebase.

Take a look at this piece of test code. There's a tiny event_loop in a function called "event_loop" which simply displays a header image and nothing else.

You can see from the code that if you set ENABLE_BUG to False, event_loop runs in the main thread - if it's True, then the event loop runs in a new Python thread.

If you run the code with ENABLE_BUG=False, then you see the correct pink window with a header. If you run the code with ENABLE_BUG=True, you see a white screen with nothing in it.

(Note that if you set ENABLE_BUG to True, the program won't terminate with a control-C - you have to kill it from a separate terminal instance. This is expected behavior for Python threads - I could have put code to avoid that happening but didn't want to obscure the issue.)

ForestWalk2 is broken.

Traceback (most recent call last):
File "Demo.py", line 129, in
run_demo(sys.argv[1], demo_list)
File "Demo.py", line 97, in run_demo
run_one_demo(d)
File "Demo.py", line 90, in run_one_demo
import('demos.' + demo)
File "/home/pi/pi3d/demos/ForestWalk2.py", line 64, in
treemodel1.add(treeplane, 0,0,0)
File "/home/pi/pi3d/pi3d/shape/MergeShape.py", line 76, in add
self.merge(shape, x, y, z, rx, ry, rz, sx, sy, sz, cx, cy, cz)
File "/home/pi/pi3d/pi3d/shape/MergeShape.py", line 38, in merge
assert len(shape.vertices) == len(shape.normals)
AttributeError: 'Plane' object has no attribute 'vertices'

save3Dfile fail in pickle

Trying to use the save3Dfile function will result in following Tracebak:

Traceback (most recent call last):
File "Earth2.py", line 38, in
pi3d.save3Dfile("sphere.p3d",mysphere)
File "include/pi3dCommon.py", line 179, in save3Dfile
pickle.dump(model,f)
File "/usr/lib/python2.7/pickle.py", line 1370, in dump
Pickler(file, protocol).dump(obj)
File "/usr/lib/python2.7/pickle.py", line 224, in dump
self.save(obj)
File "/usr/lib/python2.7/pickle.py", line 331, in save
self.save_reduce(obj=obj, *rv)
File "/usr/lib/python2.7/pickle.py", line 419, in save_reduce
save(state)
File "/usr/lib/python2.7/pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "/usr/lib/python2.7/pickle.py", line 649, in save_dict
self._batch_setitems(obj.iteritems())
File "/usr/lib/python2.7/pickle.py", line 663, in _batch_setitems
save(v)
File "/usr/lib/python2.7/pickle.py", line 331, in save
self.save_reduce(obj=obj, *rv)
File "/usr/lib/python2.7/pickle.py", line 401, in save_reduce
save(args)
File "/usr/lib/python2.7/pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "/usr/lib/python2.7/pickle.py", line 562, in save_tuple
save(element)
File "/usr/lib/python2.7/pickle.py", line 300, in save
self.save_global(obj)
File "/usr/lib/python2.7/pickle.py", line 748, in save_global
(obj, module, name))
pickle.PicklingError: Can't pickle <class 'pi3dCommon.c_float_Array_1250'>: it's not found as pi3dCommon.c_float_Array_1250

add tiff loader to tipam [ex Document font-creation]

I have some TTFs that I'd like to use as fonts - what's the best way to turn them into PNG's that are usable as fonts? I was looking at the code and it looks like you are encoding the height and width so I'm guessing these aren't standard PNG's.

ATV2/3 Photo screensaver sort of functionality

Question:

Hi there. I am looking for python 3D library for Raspberry Pi and ended up at pi3d which looks great to me. I am starting programming in python on rpi, but have become interested in 3D stuff. I would like to build something like the Apple TV 2/3 photo screensaver animation. If you don't know what that looks like, have a look here: http://www.youtube.com/watch?v=_o7ikkq2Mug Take special attention at the effects shown around 1:44 in the video.

Would this be possible with this library?

Handle exceptions properly.

Right now, we tend to get programs hanging when something goes wrong. Explaining to others how to kill all the threads is annoying...

Dying programs should print a stack trace, then graciously shut everything down.

grass texture for ForestWalk

Tim, ForestWalk is now asking for a grass image file. This might be due to my lack of understanding of how to keep versions in synch but I can't see it in your repo either

Cannot re-use a texture if it only differs from one already loaded by flip-ness

If a texture is read from a file, but then read from the same file later and flipped, the code in pi3dcommon.py::textures() will reuse the first texture instead of loading a new, flipped one.

The cache needs to remember flip and compare it, too, besides file name.

Separate subject, slightly: 'flip' could be 1 for TOP_BOTTOM flip and -1 for LEFT_RIGHT flip.

full screen in tk.

We can't as yet go full-screen if using tk windows, nor can we detect the screen size.

Earth2.py, missing textures

You seem to have forgotten to upload the textures used in Earth2.py demo. stars2.jpg is missing. Also world_map.jpg doesnt exist, but we do have world_map256x256.jpg, the moon.jpg texture is also missing.

Clarify Mouse, Keyboard, and threads.

Right now, we have two different sorts of mouse readers and two different keyboard readers. One of each needs to be done in a separate thread.

We should clarify which we recommend and for what purposes. The optional threads need to be correctly managed. (At first I thought we could have one thread for both but that means we wouldn't get a new keyboard event until the mouse moved and vice versa.)

Sprites in the cloud3d demo not created at the correct location

If the Shapes are created with x,y,z locations in the constructor they get scrambled as the animation progresses. If they get their locations set using the Shape.position() method straight after construction then everything is ok. This is probably an issue with Shape.init

ConferenceHall is missing an asset and crashes.

Traceback (most recent call last):
File "Demo.py", line 129, in
run_demo(sys.argv[1], demo_list)
File "Demo.py", line 97, in run_demo
run_one_demo(d)
File "Demo.py", line 90, in run_one_demo
import('demos.' + demo)
File "/home/pi/pi3d/demos/ConferenceHall.py", line 49, in
name="Hall", x=x, y=y, z=z, sx=0.1, sy=0.1, sz=0.1)
File "/home/pi/pi3d/pi3d/shape/Model.py", line 27, in init
self.model = loaderEgg.loadFileEGG(self, file_string)
File "/home/pi/pi3d/pi3d/loader/loaderEgg.py", line 67, in loadFileEGG
f = open(fileName, 'r')
IOError: [Errno 2] No such file or directory: 'models/ConferenceHall/conferencehall.egg'

New Amazing demo is missing models/shed1.obj

Traceback (most recent call last):
  File "Demo.py", line 37, in <module>
    __import__('demos.' + d)
  File "/home/pi/pi3d/demos/Amazing.py", line 81, in <module>
    shed = Model("models/shed1.obj",texs,"shed",0,3,0, 0,0,0, 2,2,2)
  File "/home/pi/pi3d/pi3d/shape/Model.py", line 27, in __init__
    self.model = loaderObj.loadFileOBJ(self, fileString, texs)
  File "/home/pi/pi3d/pi3d/loaderObj.py", line 151, in loadFileOBJ
    f = open(fileName, 'r')
IOError: [Errno 2] No such file or directory: 'models/shed1.obj'```

display.create2D() needs to be called at the top-level.

Another day of debugging, another reproducible bug.

Please see this simple test case.

The code paths are exactly the same except that in one case, the display is created as a top-level variable, in the other case it's a class member variable - one that's immediately created, but not a top-level variable.

No idea how this bug could possibly be caused or how it could possibly be fixed.

running demos easily

  1. if you try to run from geany using Demo.py in the top directory it's fine so long as build commands tell it to execute python ../Demo.py "%e" from the demos directory as working directory (ie nothing in the field).
  2. If you tell it to use the full path as the working path to top directory it works fine with python Demo.py "%e"
  3. If you tell it to use ../ as the working directory it Fails to create file:Permission denied
    option 1 is simplest as it only need to have one field changed

if you try to run without using Demo.py in the top directory:
when in top directory
..$ python demos/Pi3d2.py
Traceback (most recent call last):
File "demos/Pi3d2.py", line 5, in
from pi3d import *
ImportError: No module named pi3d

when in demos directory (which is really where we want the demos to run from i.e. if opened with geany this is where they would run from)
../demos $ python demos/Pi3d2.py
Traceback (most recent call last):
File "Pi3d2.py", line 5, in
from pi3d import *
ImportError: No module named pi3d

Pi3d2, Pong, Shapes demos crash in similar ways.

Don't think I broke it, assign it to me if I did!

Traceback (most recent call last):
File "Demo.py", line 129, in
run_demo(sys.argv[1], demo_list)
File "Demo.py", line 97, in run_demo
run_one_demo(d)
File "Demo.py", line 90, in run_one_demo
import('demos.' + demo)
File "/home/pi/pi3d/demos/Pi3d2.py", line 76, in
mystring.draw()
File "/home/pi/pi3d/pi3d/shape/Shape.py", line 124, in draw
b.draw(shader, txtrs, ntl, shny)
File "/home/pi/pi3d/pi3d/Buffer.py", line 114, in draw
opengles.glBindTexture(GL_TEXTURE_2D, texture.tex())
TypeError: 'c_long' object is not callable

Traceback (most recent call last):
File "Demo.py", line 129, in
run_demo(sys.argv[1], demo_list)
File "Demo.py", line 97, in run_demo
run_one_demo(d)
File "Demo.py", line 90, in run_one_demo
import('demos.' + demo)
File "/home/pi/pi3d/demos/Pong.py", line 214, in
score0.draw()
File "/home/pi/pi3d/pi3d/shape/Shape.py", line 124, in draw
b.draw(shader, txtrs, ntl, shny)
File "/home/pi/pi3d/pi3d/Buffer.py", line 114, in draw
opengles.glBindTexture(GL_TEXTURE_2D, texture.tex())
TypeError: 'c_long' object is not callable

Traceback (most recent call last):
File "Demo.py", line 129, in
run_demo(sys.argv[1], demo_list)
File "Demo.py", line 97, in run_demo
run_one_demo(d)
File "Demo.py", line 90, in run_one_demo
import('demos.' + demo)
File "/home/pi/pi3d/demos/Shapes.py", line 130, in
mystring.draw()
File "/home/pi/pi3d/pi3d/shape/Shape.py", line 124, in draw
b.draw(shader, txtrs, ntl, shny)
File "/home/pi/pi3d/pi3d/Buffer.py", line 114, in draw
opengles.glBindTexture(GL_TEXTURE_2D, texture.tex())
TypeError: 'c_long' object is not callable

Shape.py drawstring changed to drawstring3D

Tim, I'm not sure that I have the full latest on my Pi now, lots of messages telling me about things that I think I've corrected but..

I had to change the name of the method call to get this to work.

Need a "common" file for "people who want to import everything".

"importing everything" isn't really a great idea but people do want to do it - so we should provide a "common" file for this purpose.


Why is "importing everything" bad?

It throws a large number of symbols into your "main" namespace. These might silently override other top-level symbols you have, which means you can update the library without changing your code and suddenly get hard-to-find, intermittent bugs because some new symbol overwrites one of your symbols.

Even if that doesn't happen, it means that when someone else reading your code sees a symbol, they have no idea where it comes from. As I say so often, code is written once but read a dozen times, so it's worth doing a little extra work to list the imports even if it's only to make it easier for someone else (perhaps you in six months) to read the code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.