Closed patmo141 closed 8 years ago
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?
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.
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
Sure. Let me know if you need help.
Ok, couldn't resist playing some more.
More information to come
Could you try this quick test:
> cd c:\dev\...\simplegl
> python simpleglfw.py
Just wondering if it's still a path issue.
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.
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.
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.
Any luck with the official glfw example?
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
So if the official glfw sample works, simpleglfw.py should work?
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.
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
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?
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 :-)
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
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
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.
Awesome. Glad to see it working!
Me too. I'm sorry I hope I did not waste too much of your time. And for final closure
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
I'm attempting to work through the Volume Rendering chapter. Love the book! This may be a driver or system error but any tips for teasing out this error would be greatly appreciated!