Python port of Modern 3D Graphics using OpenGL tutorial

To my knowledge, there are three online OpenGL tutorials which stand head and shoulders above the rest:

I recently started porting the first of these from C to Python.

https://bitbucket.org/tartley/gltutpy

This is primarily for my own benefit, and I’ve only done the first two chapters thus far, but others may find some use in seeing the translation. If anyone else is interested enough to want to contribute, drop me a line and I’ll happily grant commit rights.

5 thoughts on “Python port of Modern 3D Graphics using OpenGL tutorial

  1. @jarav Thanks for the comment. No doubt I’m introducing errors in converting the original OpenGL 3 shaders into something my 2.1 drivers will accept.

  2. Just tried running “t01.hello-triangle”. Here is what I got:

    Traceback (most recent call last):
    File “HelloTriangle.py”, line 129, in
    main()
    File “HelloTriangle.py”, line 123, in main
    init()
    File “HelloTriangle.py”, line 89, in init
    initialize_program()
    File “HelloTriangle.py”, line 69, in initialize_program
    compileShader(strFragmentShader, GL.GL_FRAGMENT_SHADER)
    File “/usr/lib/python2.7/site-packages/OpenGL/GL/shaders.py”, line 162, in compileShader
    shaderType,
    RuntimeError: (“Shader compile failure (0): 0(4) : error C5060: out can’t be used with non-varying outputColor\n”, ['\n#version 120\n\nout vec4 outputColor;\nvoid main()\n{\n outputColor = vec4(1.0f, 1.0f, 1.0f, 1.0f);\n}\n'], GL_FRAGMENT_SHADER)

    Blindly, changed “out vec4 outputColor;” to “varying out vec4 outputColor;” and it worked.

Leave a Reply