More on Python and OpenGL
Made a few changes to the program. It now starts at a pre-chosen hex with the camera set at a pre-chosen angle. You can now click on a hex and the camera will smoothly center on that new hex. Your camera angle will remain the same. You can also use the Q, W, A, S, D and Z keys as before to adjust your camera angle.
The source code can be found at: TW_05.py
I also got the py2exe program working and you can now download the zipped executable at: tw_05.zip
There's seems to be some problem between the pyOpenGl and the py2exe. After the compile, pyOpenGl looks for a 'version' file in the library.zip, but the py2exe program didn't include it. I tried including it manually but it still couldn't see it. The solution involved modifying the pyOpenGL __init__.py file to capture the file error and set the version manually if the file couldn't be found.
I haven't gotten around to figuring out how to minimize the build size, so the complete build comes in at around 8 meg. Quite a large program for doing so little. You can see that the source code is actually quite small (17 kB) the rest is all the Python interpreter, pyGame and pyOpenGL.
I extended the Camera Class, but now there's some unused pieces of it that I haven't removed yet. (like the move_x and move_y). I also added set target and initialize position routines that handle setting up the desired target hex and initializing the camera target to that hex.
I did run into a little problem with some floating point errors. At one point I was getting a 'True' returned for '6.0'
Next step will be to place some user-controllable 'characters' on the board and let the user move them about and interact with them.
3 Comments:
Hey! I've been checking out your blog. My brother is really into computers. I have heard him talk of OpenGL before.
I see you are an atheist. Please take a look at my blog, Sound Out. I am interested in telling people about the one true way to heaven, and I'd love to answer any questions you might have about the Bible, God, heaven, whatever. If I can't answer it, maybe I can recommend someone who can.
~Nella
(this is John. I needs me a blogger account)
I have questions. For starters. . .
1. Is eating fried shrimp a sin?
2. Is having sex with a dog a sin?
3. If your answers to the previous two questions were different, please explain the moral standard used to determine which is a sin and which is not, given that the Unchanging Moral Standard(tm) that is the Bible condemns both in the OT and mentions neither in the NT.
This comment has been removed by a blog administrator.
Post a Comment
<< Home