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.

Mark Hildreth
  • 42,023
  • 11
  • 120
  • 109
zyeek
  • 1,277
  • 12
  • 27
  • 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. – Mark Hildreth Oct 20 '12 at 04:31
  • The only issue is no module named "OpenGLContext" I am just trying to from OpenGLContext import testingcontext – zyeek Oct 20 '12 at 05: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. – Mark Hildreth Oct 20 '12 at 05:32

3 Answers3

1

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
Milliams
  • 1,474
  • 3
  • 21
  • 30
  • 7
    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: – neu-rah Apr 27 '13 at 19:12
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

Matt S.
  • 878
  • 10
  • 21
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.

Community
  • 1
  • 1
mathiass
  • 325
  • 1
  • 2
  • 10