Comments (21)
Hello,
Thanks for buying the book!
Regarding your error, a few questions/suggestions:
-
Are you able to run the first OpenGL project in chapter 9?
-
Instead of copying the dll and hardcoding paths, could you follow the process outlined in Appendix A, page 298? (See image below.)
The error indicates that the OpenGL context is invalid, which could be due to a number of reasons, but let's try to get the chapter 9 code to work first.
from pp.
Re ch9: You have caught me! Trying to run before I walk. Yes I will try this first.
Re PATH: Yes that's no problem, it was just laziness on my part.
It will probably be sometime toward end of week. Thanks, Patrick
from pp.
Sure. Let me know if you need help.
from pp.
Ok, couldn't resist playing some more.
- I set up my PYTHONPATH and GLFW_LIBRARY environment variables
- I read (ok, I read part of and skimmed all of) Ch. 9
- I ran simpleglfw.py and....
More information to come
from pp.
Could you try this quick test:
> cd c:\dev\...\simplegl
> python simpleglfw.py
Just wondering if it's still a path issue.
from pp.
I have multiple python versions so I did a slightly different by explicity pointing to python34 since that is where my OpenGL is installed in site-packages.
from pp.
I am a bit stumped...
How about the official glfw example below. Can you try running it?
https://pypi.python.org/pypi/glfw
If you can't run the above, one guess would be that your OS doesn't have an OpenGL driver installed. Could you try installing a driver for your graphics card? If you send me the system details, I can try to help.
from pp.
While I am getting driver's updated. I have one of those dual graphics card situations, where the builtin chip operates some times, and the dedicated GPU works others.
from pp.
Any luck with the official glfw example?
from pp.
was able to run hello world gflw example from https://pypi.python.org/pypi/glfw
I downloaded glfw.py from https://github.com/FlorianRhiem/pyGLFW
I had to hardcode the location of glfw3.dll in that example because it could not find it even with the envorinment variable set, however once I did that, all was well
from pp.
So if the official glfw sample works, simpleglfw.py should work?
from pp.
The bindings are all different in the github version https://github.com/FlorianRhiem/pyGLFW/blob/master/glfw.py For example glfw.init() vs glfw.glfwInit(). I will alter them and see if I can get glsimple.py to work if I change the bindings.
from pp.
Ok, I changed all the functions in simpleglfw.py to match the glfw.py bindings from github, and I get the same error 'invalid operation', so I must have an issue with OpenGL drivers or PyOpenGL
from pp.
Can we go back to the glfw example:
https://pypi.python.org/pypi/glfw
Do NOT use https://github.com/FlorianRhiem/pyGLFW
You should be using glfw.py from the common/ directory of the book's source code.
Can you send me your PYTHONPATH?
from pp.
the example code from pypi.python.org will not work with pp-master/common/glfw.py because the bindings are defined differently (eg, CamelCase vs lower_case).
My PYTHONPATH is only "C:\Dev\pp-master\common" I do the majority of my work in Blender python so I have not added anything to PYTHONPATH except this project :-)
from pp.
I am starting fresh, updating drivers, installing PyOpenGL from PyPi, downloading fresh pp-master source to eliminate any setup errors on my part. Thanks for all of your help so far! I'll report back shortly
from pp.
Step 1. Fresh pp-master directory
Step 2. PYTHONPATH: "C:\Dev\pp-master\common",
Step 3. GLFW_LIBRARY "C\Dev\glfw\lib-vc2012\glfw3.dll
Step 4. Modify the example from PyPi to match the functions in C:\Dev\pp-master\common\glfw.py
import glfw
def main():
# Initialize the library
if not glfw.glfwInit():
return
# Create a windowed mode window and its OpenGL context
window = glfw.glfwCreateWindow(640, 480)
if not window:
print("failed to open window")
glfw.glfwTerminate()
return
# Make the window's context current
glfw.glfwMakeContextCurrent(window)
# Loop until the user closes the window
while not glfw.glfwWindowShouldClose(window):
# Render here, e.g. using pyOpenGL
# Swap front and back buffers
glfw.glfwSwapBuffers(window)
# Poll for and process events
glfw.glfwPollEvents()
glfw.glfwTerminate()
if __name__ == "__main__":
main()
This works, I get a blank glfw window
from pp.
So, hours and hours ago, I tried global settings to test Nvida card and Builtin Intel card. Apparently it was ignoring my settings because once I specified that Python uses the Nvidia card, it works.
from pp.
Awesome. Glad to see it working!
from pp.
Me too. I'm sorry I hope I did not waste too much of your time. And for final closure
from pp.
Happy to help!
A request:
If you like the book, please take a few minutes to write a review on amazon.com:
http://www.amazon.com/Python-Playground-Projects-Curious-Programmer/dp/1593276044
from pp.
Related Issues (20)
- Karplus-Strong Algorithm HOT 3
- GLFW library not found HOT 2
- TypeError: a bytes-like object is required, not 'str' in playlist.py HOT 1
- Difficulty with volrender.py HOT 4
- code error
- code error HOT 2
- small error in laser.py HOT 2
- DeprecationWarning: The readPlist function is deprecated HOT 2
- IOError: [Errno 32] Broken pipe
- use python module glfw instead
- javascript files doesn't loads up while server is running on localhost HOT 13
- I use pip to install the'glutils',but No module named 'glutils' HOT 1
- Need for specific turtle object in SpiroAnimator.__init__
- Will not save .png form of file
- Not finding duplicates... HOT 9
- Karplus code HOT 2
- code listing for simpleglfw.py HOT 1
- [Chapter 1 Resource] Here's the XML structure of the iTunes playlist - Hope this helps
- where is test1 function in ch5?
- OSError: GLFW library not found
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pp.