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

pyOpenGL test program: Getting the Validation Failed: No vertex array object bound message

I am experimenting with python, OpenGl (pyopengl) and shaders (MacOS) and I am getting this weird message: OpenGL.GL.shaders.ShaderValidationError: Validation failure (0): b'Validation Failed: No vertex array object bound.\n' (on…
3
votes
1 answer

confusion about glPerspective and GL_POLYGON

I am confused about how glPerspective works. I know in theory what it does but I am confused about it when trying to use it. Here is my code (I used Pygame to create the window): import pygame, sys from OpenGL.GL import * from OpenGL.GLU import…
Another_coder
  • 728
  • 1
  • 9
  • 23
3
votes
2 answers

pyOpenGL 2D Image drawn skewed

I am trying to draw a 2d image in OpenGL using pillow to load the image, but when I render it in OpenGL, the image is skewed. This is the original image: Loading.png This is the code: # -*- coding: utf-8 -*- import glfw from OpenGL.GL import * if…
MrNoise
  • 55
  • 7
3
votes
1 answer

OpenGL python and pygame translation after rotation not working for mouselook and movement

I'm trying to make a simple mouse look with standard arrow key movement, and I've got the mouselook working but the translations from the rotated points seem to move along an orthogonal basis, but not one that is aligned with the rotation of the…
3
votes
1 answer

Error while Transforming the Object using PyOpenGL with PyQt5

I am trying to transform the object using vector shader. But glUniformMatrixfv raises error while execution. vertex_shader = shaders.compileShader( """ #version 330 layout (location = 0) in vec3 pos; …
Rod
  • 107
  • 4
3
votes
1 answer

How to rotate a cube using mouse in pyopengl

I know what the problem is but i cannot figure out a solution. The problem is that the rotation is applied with the axis fixed on the cube so that if you turn one axis Pi radians then the other axis will look like the mouse controls are inverted. I…
3
votes
1 answer

Problems with creating a UI and glRotatef()

I am making a minimal Doom-style FPS game engine using Python, PyGame and Legacy PyOpenGL. I hope that the player will be able to look around in four directions - forward, backwards, left and right - using glRotatef() by pressing the left and right…
3
votes
1 answer

Implementing render-to-vertex-array, glReadPixels fails (invalid operation)

I'm trying to copy vertex data from a texture to a vertex buffer, and then draw the vertex buffer. As far as I know the best way to do this is to bind the texture to a fbo, and use glReadPixels to copy it to a vbo. However, I can't seem to get this…
doeke
  • 462
  • 5
  • 12
3
votes
2 answers

Pyopengl textures not rendering properly, object filled solid gray

I am trying to add textures (png image file) to a rectangle which is being rendered. However, instead no matter what image I use, the object just appears gray. I have a feeling that I am missing something to do with tetxure co-ordinates. In each…
Kasim B
  • 41
  • 5
3
votes
2 answers

Cannot draw to the same position using gluSphere()?

I am making a game using PyOpenGL. I want to have bullets shot from a place every 4 seconds, but when I used gluSphere() to draw the bullet it doesn't appear to the place I excepted (except the first time of drawing the sphere). How can I solve…
Noah
  • 445
  • 4
  • 19
3
votes
1 answer

is there a way to render points faster OpenGL

i need to visualize around 50k-60k points in openGL i managed to print them all but when i use rotate it takes so much time between each rotation because it just prints all the data every single frame. is there a way to print all the data once and…
Bob Sfog
  • 105
  • 8
3
votes
1 answer

How to correctly add a light to make object get a better view with pygame and pyopengl

I am following the tutorial available in https://pythonprogramming.net/opengl-pyopengl-python-pygame-tutorial/ where he teachs how to render a cube with pyOpenGL an pygame. When rendering the cube, the tutorial set color to all the vertices of the…
underfloor
  • 301
  • 3
  • 12
3
votes
1 answer

PyOpenGL - Minimal glDrawArrays Example

I've seen many minimal PyOpenGL examples, but none of the ones I've found make use of VAOs or glDrawArrays / glDrawElements. Instead they all use glVertex, glut shapes, and occasionally the old glCallList function. I'm now trying to write a minimal…
Codesmith
  • 5,779
  • 5
  • 38
  • 50
3
votes
0 answers

Speed issues with round bodys in pyopengl

I recently build a obj file loader in python 3 using pygame and pyopengl. It works perfectly fine, but when I load a round object it starts running realy slow. I'd like to load multiple complex objects at a decent framerate, but this aproach…
GreenJoFlo
  • 33
  • 7
3
votes
3 answers

Proper way to handle camera rotations

Let's start by considering 2 type of camera rotations: Camera rotating around a point (Orbit): def rotate_around_target(self, target, delta): right = (self.target - self.eye).cross(self.up).normalize() amount = (right * delta.y + self.up *…
BPL
  • 9,632
  • 9
  • 59
  • 117