Questions tagged [pyopengl]

Python binding to the OpenGL API

PyOpenGL is a cross platform Python binding to OpenGL API, which also supports libraries like the following ones:

This bindings are interoperable with external GUI libraries, such as , and .

It includes a learning library called OpenGLContext, which contains sample code for common operations and it is not needed to work with PyOpenGL.

Resources

945 questions
5
votes
2 answers

minimalist PyOpenGL example in PyQt5 application

I am learning PyOpenGL and use it in PyQt5 application. I am trying to convert some of my old simple examples from C++/Qt to Python. The following example should draw white triangle on black background. At least it does in the corresponding C++/Qt…
5
votes
1 answer

MODERN OPENGL can't change uniform value beetween glDrawArrays calls

EDIT: I just managed to fix the issue by reinstalling PyOpenGL with pip. The same program now works as expected. Thanks for your efforts. The entire question was rewritten and clarificated. The issue does not lie in the (although weird) Texture…
xXliolauXx
  • 1,273
  • 1
  • 11
  • 25
5
votes
4 answers

PyOpenGL ubuntu 14.04: undefined function error

After upgrading to ubuntu 14.04 and installing PyOpenGL via pip. It worked fine under ubuntu 12.04, but now I get errors every time I try to use a function from OpenGL.GLUT, e.g. this from OpenGL.GLUT import * print…
Nicor Lengert
  • 188
  • 1
  • 12
5
votes
1 answer

OpenGL says "from_param received a non-contiguous array"

After installing Yosemite, I had to upgrade numpy, PyOpenGL, etc. Now, a previously-working program is giving me the following stack trace: file "latebind.pyx", line 44, in OpenGL_accelerate.latebind.Curry.__call__ (src/latebind.c:1201) File…
Neil G
  • 32,138
  • 39
  • 156
  • 257
5
votes
1 answer

How to load an *.obj file in python and apply a texture to it

The title is my question: How can I load an *.obj 3d model in Python and apply a texture to it. I managed to load a 3d model, view it and apply textures to simple blocks and walls, but it seems impossible to apply a texture to a 3d model. How can I…
Joost Verbraeken
  • 883
  • 2
  • 15
  • 30
5
votes
3 answers

New to OpenGL and deprecation

I've begun playing around with OpenGL in Python using PyOpenGL 3.0.1b. I looked at some sample code and started running it and modifying it etc. All was well until I became a little less ignorant. On…
Derek Litz
  • 10,529
  • 7
  • 43
  • 53
5
votes
2 answers

Visualizing a 3D NumPy array with PyOpenGL

I want to create a PyOpenGL/QtOpenGL widget that will allow me to visualize an arbitrary NumPy 3D matrix, not unlike the following Hinton diagram envisioned as a "cube of cubes" instead of a "square of squares": I'm having a bit of a rough time…
RodericDay
  • 1,266
  • 4
  • 20
  • 35
5
votes
3 answers

PyOpenGL on a Macbook retina display

I have some code that displays graphics using PyOpenGL in a glut window. On a retina Macbook Pro this window appears in a low-resolution mode, with one OpenGL pixel being represented by four physical pixels. It would be much nicer if it would…
N. Virgo
  • 7,970
  • 11
  • 44
  • 65
4
votes
2 answers

PIL Image.fromstring from PyOpengl buffer has the wrong size

I use PyOpenGL to draw a 2D Image. Then I want to use the Python Imaging Library (PIL) to store this image to disk. I use GLUT to display the image which works perfectly. But when I use PIL to store the image it extracts the wrong clipping. It has…
dedan
  • 337
  • 3
  • 15
4
votes
1 answer

glsl pyOpenGL array passing

I'm currently playing around with glsl. For that purpose i need to pass an array from the opengl code to the gsls, which then in return calculates a new color out of the array. But somehow this doesn't work for me. Instead of getting the whole array…
Donny
  • 549
  • 2
  • 10
  • 24
4
votes
3 answers

Python PIL Image.tostring()

I'm new to Python and PIL. I am trying to follow code samples on how to load an image into to Python through PIL and then draw its pixels using openGL. Here are some line of the code: from Image import * im = open("gloves200.bmp") pBits =…
ahoffer
  • 6,347
  • 4
  • 39
  • 68
4
votes
3 answers

How to run Python script on a Discrete Graphics AMD GPU?

WHAT I WANT TO DO: I have a script that I use for factorizing prime numbers given a certain range: # Python program to display all the prime numbers within an interval lower = 900 upper = 1000 print("Prime numbers between", lower, "and", upper,…
Francesco Mantovani
  • 10,216
  • 13
  • 73
  • 113
4
votes
2 answers

OpenGL How to show .obj models while having a .jpg as a background?

I would like to use wood.jpg as the background for an OpenGL program. I would like this program to also show the model basketball.obj as shown in the picture: I've read several tutorials( Youtube channels sentdex, atibyte, The Cherno). I also tried…
Robin Alvarenga
  • 321
  • 2
  • 14
4
votes
1 answer

Rendering Image in Pygame Using PyOpenGL

I am working on a project for the Computer Science Club at my school and trying to learn Pygame/PyOpenGL at the same time. Right now i'm just trying to do some basic stuff. I'm trying to render an image in a window using Pygame and PyOpenGL. Here…
Luke Kelly
  • 423
  • 4
  • 14
4
votes
1 answer

How to generate a torus knot?

Let me start the question by providing some boilerplate code we'll use to play around: mcve_framework.py import time from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * import glm from glm import unProject from glm import…
BPL
  • 9,632
  • 9
  • 59
  • 117