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
3
votes
1 answer

How to rotate a 2D line in PyOpenGL?

I've written a code to draw a line. Here is the function: def drawLines(): r,g,b = 255,30,20 #drawing visible axis glClear(GL_COLOR_BUFFER_BIT) glColor3ub(r,g,b) glBegin(GL_LINES) #glRotate(10,500,-500,0) …
3
votes
1 answer

How do I make OpenGL draw do a non-display surface in pygame?

I am trying to make a game that looks like a retro space shooter, where the lines are 3d wireframe. To achieve 3D in Python, I am using pygame for the window and PyOpenGL to render the objects. I want to get OpenGL to render to a surface (not the…
3
votes
1 answer

PyOpenGL fragment shader texture sampling

All right, thankfully you guys I have a little deeper understanding how OpenGL in (almost) the modern work. But there is something I can't figure out. How can the fragment shader sampling my texture even if I missing it set up correctly? I think…
tenjohn
  • 197
  • 6
3
votes
1 answer

PyOpenGl Validation failure

I am trying to create a simple scene with pyopengl, but I keep getting runtime error. I am using glfw for displaying opengl scene. I am using python because I would like to include opengl in some other python projects. I am on a macOS Mojave…
Miha
  • 33
  • 3
3
votes
1 answer

Problems with openGL and PyQt5

I am moving from Winpython3.4.3.7Qt4 to Winpython3.x.x.xQt5 (I tried a bunch of versions), and I am having the following problem: The following minimal code (it does nothing usable, but demonstrates the error): from PyQt5 import QtWidgets import…
zeus300
  • 1,017
  • 2
  • 12
  • 30
3
votes
1 answer

OpenGL Camera keeps rotating around the origin

There are no errors in this code but when I run the code, the camera is fine, I can look around and all of that. As soon as I move, it starts rotating around the origin of it's spawn. Camera code: http://hatebin.com/iiceqotcpu Main code…
Elpupper
  • 46
  • 1
  • 12
3
votes
1 answer

How to rotate slices of a Rubik's Cube in python PyOpenGL?

I'm attempting to create a Rubik's Cube in Python, i have gotten as far as visually representing the cube. Struggling a bit with how to implement rotation. I guess i'm asking for feedback as to how to go about doing this. I thought at first of,…
Snuffles
  • 487
  • 6
  • 17
3
votes
1 answer

passing data to glBufferData in PyOpenGL, empty screen

I am using PyOpenGL to draw a simple triangle. However, I only get an empty screen. I believe the issue is that I don't pass data to glBufferData correctly. I tried to follow the answer in this stackoverflow question, but with no result. The shaders…
Jonathan Lindgren
  • 1,192
  • 3
  • 14
  • 31
3
votes
1 answer

glDrawArrays returning invalid operation 1282 - pyOpenGL

I cannot figure this out for the life of me. I need a second pair of eyes ... or a better brain. I am trying to get this "Hello Triangle" python example working. I've been translating it from a c tutorial. However, I keep getting this error no…
3
votes
1 answer

ray intersection misses the target

I'm trying to pick a 3d point. I read various sites but my code doesn't work. on right mouse click: glGetFloatv(GL_MODELVIEW_MATRIX,mv_mat) glGetFloatv(GL_PROJECTION_MATRIX,p_mat) ip_mat = np.linalg.inv(mat4(p_mat)) # clip = array[ #…
walle
  • 59
  • 5
3
votes
1 answer

How to resize a GLUT window?

from OpenGL.extensions import alternate from OpenGL.GL import * from OpenGL.GL.ARB.multitexture import * from OpenGL.GLU import * from OpenGL.GLUT import * class TestTexture(): def __init__(self): self.window_width = 800 …
BPL
  • 9,632
  • 9
  • 59
  • 117
3
votes
1 answer

PyOpenGL glLookAt behaves weirdly after first call, with same parameters

I am currently programming a small game using PyOpenGL for school (Python wasn't my choice...). I seem to cannot wrap my head around the funcionality of the "camera". I figured that the most intuitional approach for my case is the gluLookAt(...)…
Jannis Jorre
  • 142
  • 3
  • 12
3
votes
0 answers

PyOpenGL How to set VertexAttribPointer

I'm trying to build a Vertex Array Object in Python, following the tutorial on LearnOpenGL, and most of the code has been fairly easy to translate to Python with a bit of research, but I'm a bit stumped as to how I'm supposed to build a…
Matthew Fournier
  • 1,077
  • 2
  • 17
  • 32
3
votes
0 answers

Fast heatmap updating with Python Qt

I've been looking for a while for a means of fast plotting of large heatmap in a python based UI. In the past, I have used the backends available for matplotlib ' contourf, pcolor, and pcolormesh. I have not used imshow as my typical data lies on…
johnnymopo
  • 158
  • 9
3
votes
1 answer

Export OpenGL model as .OBJ

I'm writing a simple PyOpenGL code, with the display part as glBegin(GL_LINE_LOOP) glVertex2f(0,0) glVertex2f(0,1) glVertex2f(1,1) glVertex2f(1,0) glEnd() I want to export this model as a .OBJ file. Is there any library or algorithm I could use? I…
Pranav Totla
  • 2,182
  • 2
  • 20
  • 28