OpenGL with python

has anyone used python to run openGL? I need to use python but not sure if it’s more limited than C++
do i need to use PyOpenGL? can I use colab to do this?
Many thanks guys …

Python + PyOpenGL works fine; it’s my preferred platform for experimental projects. It doesn’t have any limitations compared to C or C++. I haven’t used colab.

Thanks very much! I have one other question if I may? Does glut exist in this environment? I keep seeing pyGame not sure the best set up and exactly what libraries I need to start with. Thanks again

PyOpenGL includes bindings for GLUT (also GLU, GLX, WGL, EGL). It can be used with other GUI toolkits (Qt, GTK, wxWidgets) if you have the Python bindings for them.

Thank you so much, I’ll start today!

Started working with pyOpenGL and got stuck on glDrawPixels, in C++ One could use a loop and feed r,g,b values like so:

pixel-array[i].r = red.value
pixel-array[i].g= green.value
pixel-array[i].b= blue.value

And pass it to glDrawPixels like so:
GlDrawPixels(image_width, image_height, GL_RGB, GL_UNSIGNED_BYTE, pixel_array)

How do I do this in python?
Thank you for your guidance :pray:

Use NumPy for arrays (start with the NumPy User Guide). PyOpenGL functions accept a NumPy array for any argument where the C function uses a pointer.

NumPy arrays are N-dimensional arrays of numeric values of a common type, stored in contiguous memory. Array-creation functions generally have a dtype= parameter to select the type (e.g. np.float32 for single-precision floats, np.uint8 for unsigned 8-bit integers, etc). Use the .astype method or the np.ascontiguousarray function to coerce an existing array to a specific type (arithmetic operations often result in an array with a wider type than is desired).

For OpenGL functions which return data to the client (glGet*), the corresponding PyOpenGL function typically returns an array rather than taking the array as an argument.

Wow thank you very much!!! Lots to learn but I’m getting there :0)

I was wondering, would you be willing to tutor me for setting up the initial stuff? I’ll pay of course. Only 30 minutes or so. Have installed everything and running simple squares etc but have some fundamental questions that would take me forever to sort out and an expert would know in a second. Thank you!

Just ask any questions you have here.