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
6
votes
3 answers

PyOpenGL headless rendering

I'm using PyOpenGL+glfw for rendering. When trying to do the same on a headless machine (e.g a server) glfw.init() fails: glfw.GLFWError: (65544) b'X11: The DISPLAY environment variable is missing' Fatal Python error: Couldn't create autoTLSkey…
user972014
  • 3,296
  • 6
  • 49
  • 89
6
votes
2 answers

What exactly is PyOpenGL-accelerate?

The title is the main question here. I had some PyOpenGL code I was running on my computer, which was running somewhat slow. I realized I hadn't installed PyOpenGL-accelerate. This didn't change the speed at all, but most tutorials with the Python…
Enrico Borba
  • 1,877
  • 2
  • 14
  • 26
6
votes
5 answers

What is the fastest way in python to build a c array from a list of tuples of floats?

The context: my Python code pass arrays of 2D vertices to OpenGL. I tested 2 approaches, one with ctypes, the other with struct, the latter being more than twice faster. from random import random points = [(random(), random()) for _ in…
rndblnch
  • 93
  • 4
6
votes
3 answers

Transparent FrameBuffer background in OpenGL

I want to use glClear and glClearColor to fill a frame buffer with a colour including alpha transparency. However the framebuffer always renders as opaque when binded to a texture which is rendered to the screen. I want everything which is rendered…
Matthew Mitchell
  • 5,293
  • 14
  • 70
  • 122
6
votes
3 answers

Pygame - first person shooter "look" with mouse

I am not writing a game but a scientific renderer using Pygame. I'd like the controls to work just like in a first-person shooter, so that a user can navigate using a familiar set of controls. I have tried to write the code to have the same…
tehwalrus
  • 2,589
  • 5
  • 26
  • 33
6
votes
4 answers

How can I determine the monitor refresh rate?

Is there a cross platform way to get the monitor's refresh rate in python (2.6)? I'm using Pygame and PyOpenGL, if that helps. I don't need to change the refresh rate, I just need to know what it is.
Brad Zeis
  • 10,085
  • 5
  • 26
  • 20
6
votes
2 answers

How to specify buffer offset with PyOpenGL

What is the PyOpenGL equivalent of #define BUFFER_OFFSET(i) (reinterpret_cast(i)) glDrawElements(GL_TRIANGLE_STRIP, count, GL_UNSIGNED_SHORT, BUFFER_OFFSET(offset)) If the offset is 0, then glDrawElements(GL_TRIANGLE_STRIP, count,…
Johan Råde
  • 20,480
  • 21
  • 73
  • 110
6
votes
2 answers

How to use glBufferData() in PyOpenGL?

How do you use glBufferData() in the PyOpenGL python bindings to OpenGL? When I run the following code import sys from OpenGL.GL import * from PySide.QtCore import * from PySide.QtGui import * from PySide.QtOpenGL import * class…
Johan Råde
  • 20,480
  • 21
  • 73
  • 110
5
votes
2 answers

fastest way to iterate in python

I've never had to concern myself with this problem so far but now I need to use some large number of vertices that need to be buffered by PyOpenGL and it seems like the python iteration is the bottleneck. Here is the situation. I have an array of 3D…
Bogdan
  • 8,017
  • 6
  • 48
  • 64
5
votes
0 answers

Memory leak with PyOpenGL and Pygame

Maybe someone enlighten me. I got this piece of code: import pygame from OpenGL.GL import glClear, GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, GL_STENCIL_BUFFER_BIT from pygame.constants import DOUBLEBUF, OPENGL pygame.init() clock =…
R3qUi3M
  • 65
  • 4
5
votes
1 answer

How can I draw using pygame, while also drawing with pyopengl?

I have a program that is written in python and uses pygame along with pyopengl. The only problem is, I can't draw anything on the screen with pygame.draw which is what I was going to use for interfacing with my program. I would like to know if there…
Zachary Milner
  • 153
  • 1
  • 6
5
votes
1 answer

Texture arrays in OpenGL

I am working on a project and I need to use texture arrays to apply textures. I have asked many questions about this, none of which I got an answer I was completely satisfied with (Get access to later versions of GLSL , OpenGL: Access Array Texture…
User-92
  • 374
  • 3
  • 13
5
votes
1 answer

PyOpenGL how do I import an obj file?

import pygame import OpenGL from pygame.locals import * from OpenGL.GL import * from OpenGL.GLU import * import pywavefront scene = pywavefront.Wavefront('Handgun_obj.obj') vertices =( (1,-1,-1), (1,1,-1), (-1,1,-1), (-1,-1,-1), …
Rapiz
  • 161
  • 2
  • 2
  • 9
5
votes
1 answer

How to blit a png image as an image overlay in PyOpenGL?

I am making a game in PyOpenGL and want to blit some images onto the screen as some overlay (for example, the pause button). How can I do that? I've tried using glBitmap(), but it doesn't work. This is what I have: pauseimg = pygame.image.load(path…
Noah
  • 445
  • 4
  • 19
5
votes
1 answer

How create a camera on PyOpenGL that can do "perspective rotations" on mouse movements?

I am creating a first-person view RPG and I want to rotate the camera in PyOpenGL when I move the mouse (just like some other games like Minecraft). What function can I use to do this and how? I tried to use gluLookAt() but I don't understand how it…
Noah
  • 445
  • 4
  • 19
1 2
3
62 63