Questions tagged [pyglet]

Pyglet is a cross-platform windowing and multimedia library for Python which provides interface to the platform's OpenGL library.

Pyglet is a cross-platform windowing and multimedia library for Python which provides interface to the platform's OpenGL library.

Pyglet has built-in support for mouse and keyboard events, and can load several multimedia file formats (optionally via AVbin). OpenAL, DirectSound or ALSA can be used for audio playback, with 3D positional audio support.

Pyglet is divided into several interdependent modules such as pyglet.gl, pyglet.graphics, pyglet.image, pyglet.media, pyglet.text, and pyglet.window.

919 questions
6
votes
1 answer

Python Pyglet mouse events don't call on_draw() nor make changes in window

for some reason, any mouse event that happens with my program doesn't make the image in the window disappear nor reappear, although my on_key_press() function works. I've tried state flags and declaring a new image resource, but it doesn't change…
Aikiro42
  • 187
  • 1
  • 6
6
votes
0 answers

Render to image buffer without opening a window

is there any possibility to directly render/ draw into an image buffer using pyglet? Background: I'm currently working on a project involving openai gym, which uses pyglet for rendering. The gym env exposes a render method, which returns rgb values…
Deniz Saner
  • 417
  • 4
  • 14
6
votes
3 answers

Problem with creating a 2D interface in a 3D openGL world

I am working on a project that requires that I create a 2D interface rendered "on top" or a 3D world. On some other forums, I read that you could use "GluOrtho2D()" for the job, and switch back to GluPerspective() once you were done. The only thing…
Bartvbl
  • 2,878
  • 3
  • 28
  • 45
6
votes
4 answers

how to change the color of a pyglet window

I am creating a program which must change the color of individual pixels in a pyglet window. I am unable to find any way to do this in the docs. Is there a way to do this?
Dave Jones
  • 173
  • 1
  • 1
  • 10
6
votes
1 answer

Pyglet HUD text location / scaling

Background I have a game with a HUD I based on this example I have a pyglet application with two gluOrtho2D views. One which is mapped 1/1 to the screen, which acts as my HUD. One which is mapped to the game world, so it scales. Problem When a…
firelynx
  • 30,616
  • 9
  • 91
  • 101
6
votes
2 answers

pyglet on_draw event occurs only when mouse moves

I have a strange problem. When pyglet app starts it just draws 1-2 frames then freezes. on_draw event just stops occuring. But everytime I move mouse or press keys, on_draw event dispatches as well. In short I have to move mouse to make my pyglet…
Pavel Vorobyov
  • 773
  • 6
  • 10
5
votes
4 answers

numpy array is shown incorrect with pyglet

I have problems with displaying a numpy array with pyglet. I have found a very similar topic (how to display a numpy array with pyglet?) that I used. I want to display the array in greyscale, but pyglet displays it with colours see the image: …
T-Lo
  • 53
  • 1
  • 4
5
votes
1 answer

Run pyglet in headless mode

I am trying to pyglet to render images and save them to .PNG files. I would like to do this without the animation window popping up. Is there any way to run pyglet in headless mode, such that the window does not pop up, but my image is still…
C_Z_
  • 7,427
  • 5
  • 44
  • 81
5
votes
1 answer

How to get USB controller/gamepad to work with python

I have a USB controller that I'm trying to get inputs from, a Microsoft® SideWinder® Plug & Play Game Pad. I'm having difficulties trying to figure out how to receive its inputs correctly. Unfortunately, I cannot use pygame as it requires a window…
user10901512
5
votes
1 answer

Pyglet. How to change picture(animate) for vertices dynamically. OpenGL

Environment: Python: 3.6.6 pyglet version: 1.3.2 Code base: abstract_model.py import pyglet def get_texture_group(file, order_group_index): texture = pyglet.image.load(file).texture order_group =…
Yuriy Leonov
  • 536
  • 1
  • 9
  • 33
5
votes
0 answers

GLException: No GL context; create a Window first

I am trying to read and display a .ply file with Trimesh in Python. I have installed Trimesh using pip install trimesh as well as pyglet to display the file. import trimesh mesh = trimesh.load("file.ply") mesh.show() However, I keep getting the…
craig-nerd
  • 718
  • 1
  • 12
  • 32
5
votes
1 answer

pyglet - loading/blitting image with alpha

I'm trying to make a simple application with pyglet. My main problem so far is that I can't seem to blit an image with alpha - all of the transparent pixels are converted into black pixels. I'm not sure whether the problem is with the loading of the…
nousername
  • 83
  • 1
  • 7
5
votes
5 answers

Why doesn't pyGame or pyglet support python 3?

I have been looking into various game design modules for python such as pyglet and pyGame. I have noticed that both of these seem to only be compatible with python 2. Seeing as python 3 is the most current version, why is this? My experience with…
user539718
  • 51
  • 1
  • 5
5
votes
2 answers

mixing 2d and 3d in opengl (using pyglet)

I am trying to mix 2d and 3d in opengl in pyglet, i.e. draw a 3d scene then switch to orthographic projection and draw stuff over the top. I draw the 3d stuff, push the projection matrix to the stack, do a glOrtho projection matrix, draw the 2d…
eggbert
  • 3,105
  • 5
  • 30
  • 39
5
votes
1 answer

Pyglet Image Rendering

I'm working on a sort of a 2D Minecraft clone for my first in depth Pyglet project and I've run across a problem. Whenever I have a decent number of blocks on screen, the frame rate drops dramatically. Here is my rendering method: I use a dictionary…
Areeb
  • 153
  • 2
  • 8
1 2
3
61 62