4

I am following the tutorial from http://pyopengl.sourceforge.net/context/tutorials/shader_1.xhtml

The problem is I am using PyOpenGL 3.0.2, which when I import OpenGL from python3.2 it works perfectly fine. I just can't find a way to get OpenGL context working for python3.2:

from OpenGLContext import testingcontext

...and error...

No module named "OpenGLContext"

I have been searching all over google and can't find anything. I just want to follow the tutorial, but using python3. Hoping someone could help me figure out how to overcome this.

Much thanks in advance.

3
  • Please post the code you are using, formatted, into the question (preferably stripped down to the minimal necessary to replicate the problem). Then, describe more what you mean by "can't find a way to get OpenGL context working". Do you get a specific error message? If so, include that in the question. Commented Oct 20, 2012 at 4:31
  • The only issue is no module named "OpenGLContext" I am just trying to from OpenGLContext import testingcontext Commented Oct 20, 2012 at 5:04
  • I've added your sample code and error message to your question. Please make sure that these accurately show what you are seeing on your screen. If the error message is more detailed, please edit the question and post the more detailed message. Commented Oct 20, 2012 at 5:32

3 Answers 3

2

It seems like you do not have OpenGLContext installed. It is available as a separate package to PyOpenGL and according to the installation documentation, you can install it with

pip install PyDispatcher PyVRML97 OpenGLContext
Sign up to request clarification or add additional context in comments.

1 Comment

ubuntu 12.04: the problem on my pc is with an error installing openGLContext Running setup.py install for OpenGLContext File "/usr/local/lib/python3.2/dist-packages/OpenGLContext/texture.py", line 167 except ImportError, err:
1

as helpful for others landing here: mfletcher made both 'OpenGLContext' and the package it is dependent on 'PyOpenGL.' (Note that getting 'PyOpenGL 3.x' running does not imply code that runs on 'python3.x' per-say.) Regarding its dependent, 'OpenGLContext': despite reasonable attempts to get it running in python3.x (e.g. '2to3' converter and several hours), I abandoned. MFletcher's code is great, and seems the best current option is to keep a eye out for his explicit acknowledgement of its readiness (such as at 'pyopengl.sourceforge.net/context/index.html' or perhaps the precise category label 'Programming Language::Python::3'; on the page at pypi.python.org/pypi/OpenGLContext/2.2.0a2 )

btw: on Ubuntu 12.04, I recall 'pip-3.2 install OpenGLContext' blithely installed it without obvious complaint into '/usr/local/lib/python3.2/dist-packages ' -- which was absolutely confusing given how apt and other modern *nix install citizens generally behave when it comes to dealing with unresolvable dependencies

Comments

1

Just some additional info. I tried installing the packages Milliams suggested using pip 1.5.6 and run into "Could not find a version that satisfies the requirement <package name>" errors.

I had to use the --pre option for pip install to allow it to install. Apparently they're pre-release versions (Ref: this post).

Also, I found that I had to install pillow (pip install pillow) because OpenGLContext complained during import that it needed PIL module.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.