From 54ca934b2f8a517314d4d45cb4278c9a786dd39b Mon Sep 17 00:00:00 2001 From: paddywwoof Date: Wed, 13 Jan 2016 14:17:11 +0000 Subject: [PATCH] some fixes to Gui and LoadModels --- Gui.py | 3 ++- LoadModelObj.py | 5 ++--- LoadModelPickle.py | 9 +++------ demo.py | 2 +- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Gui.py b/Gui.py index 5598a4d..6b576c3 100644 --- a/Gui.py +++ b/Gui.py @@ -1,12 +1,13 @@ #!/usr/bin/python from __future__ import absolute_import, division, print_function, unicode_literals +from six import unichr import math, random, time, traceback, os import sys import demo import pi3d # use tab for backspace and carriage return for delete CHARS = {'space':' ', 'BackSpace':'\t', 'DEL':'\r', 'Return':'\n', - chr(263):'\t', chr(330):'\r'} + unichr(263):'\t', unichr(330):'\r'} """for some reason these last two are the codes returned by this keyboard using curses on the raspberry pi (for BackSpace and DEL - you might need to fine tune this look-up dictionary system diff --git a/LoadModelObj.py b/LoadModelObj.py index 5e043b5..7a5ca87 100644 --- a/LoadModelObj.py +++ b/LoadModelObj.py @@ -12,14 +12,13 @@ #======================================== # this is a bit of a one off because the texture has transparent parts # comment out and google to see why it's included here. -from pi3d import opengles, GL_CULL_FACE -opengles.glDisable(GL_CULL_FACE) +pi3d.opengles.glDisable(pi3d.GL_CULL_FACE) #======================================== # load bump and reflection textures bumptex = pi3d.Texture("textures/floor_nm.jpg") shinetex = pi3d.Texture("textures/stars.jpg") # load model_loadmodel -mymodel = pi3d.Model(file_string='models/teapot.obj', name='teapot', z=4) +mymodel = pi3d.Model(file_string='models/teapot.obj', name='teapot', z=4.0) mymodel.set_shader(shader) mymodel.set_normal_shine(bumptex, 16.0, shinetex, 0.5) # Fetch key presses diff --git a/LoadModelPickle.py b/LoadModelPickle.py index 40888e4..e6989b3 100644 --- a/LoadModelPickle.py +++ b/LoadModelPickle.py @@ -20,10 +20,7 @@ #======================================== # this is a bit of a one off because the texture has transparent parts # comment out and google to see why it's included here. -#from pi3d import opengles, GL_CULL_FACE -#opengles.glDisable(GL_CULL_FACE) -from pi3d import opengles, GL_ALPHA_TEST -opengles.glDisable(GL_ALPHA_TEST) +pi3d.opengles.glDisable(pi3d.GL_CULL_FACE) #======================================== # load model @@ -35,10 +32,10 @@ print("exception was {}".format(e)) """ could be IOError for missing file or various errors from trying to load a file pickled with a different version of python or pickle etc""" - mymodel = pi3d.Model(file_string='models/teapot.obj', name='teapot', z=4.0) - # load bump and reflection textures +# load bump and reflection textures bumptex = pi3d.Texture("textures/floor_nm.jpg") shinetex = pi3d.Texture("textures/stars.jpg") + mymodel = pi3d.Model(file_string='models/teapot.obj', name='teapot', z=4.0) mymodel.set_normal_shine(bumptex, 16.0, shinetex, 0.5) mymodel.set_shader(shader) diff --git a/demo.py b/demo.py index aae3610..f001742 100644 --- a/demo.py +++ b/demo.py @@ -1,3 +1,3 @@ import sys -sys.path.insert(1, '/home/pi/pi3d') +sys.path.insert(1, '/home/patrick/pi3d')