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

OpenGL - How does texturing affect shadows/lightning?

So the question is: when I switch from ColorPointers to Textures, it seems that the lightning/shadows effects are greatly reduced. Some solution that I have found but doesnt do that much is setting glLightModeli( GL_LIGHT_MODEL_COLOR_CONTROL,…
Bogdan
  • 8,017
  • 6
  • 48
  • 64
2
votes
1 answer

Tkinter frame with opengl

I am trying to draw a square with opengl using tkinter frame but the square didn't render. Here is my code: import tkinter as tk from opengl.gl import * from pyopengltk import OpenGLFrame class frame(OpenGLFrame): def initgl(self): …
2
votes
1 answer

glClearColor returning negative values? (Overflow?)

I'm using GLES2 and EGL with PyOpenGL, and I am calling glClearColor(0.0, 0.0, 0.0, 1.0). After glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) I am reading the cleared color values into a buffer and noticed that the alpha value is being set to…
AdishRao
  • 163
  • 1
  • 1
  • 12
2
votes
1 answer

How to create an unsigned char array in Python? (For glReadPixels using PyOpenGL)

I have written some code in GLES2 and EGL using PyOpenGL, I need to use the glReadPixels function except the last argument must be a ctypes unsigned char buffer which I'm not sure how to create. Here is the C code: unsigned char* buffer =…
AdishRao
  • 163
  • 1
  • 1
  • 12
2
votes
1 answer

pyopengl Error on glVertexAttribPointer()

I got an error on glVertexAttribPointer maybe it because the value or anything (?) does anyone know how to fix this? import glfw from OpenGL.GL import * import OpenGL.GL.shaders import numpy as np from PIL import Image def main(): if not…
user13429071
2
votes
1 answer

Python OpenGL How to render off-screen correctly

I have a task to render things on off-screen in OpenGL.I have to render things in frame buffer but no need to display it on OpenGL Window. import sys from PIL import Image from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import…
MOON Sun
  • 23
  • 4
2
votes
1 answer

PyOpengGL raises error when I compile shaders

I am running through a cumulation of OpenGL shader tutorials and mixing and matching stuff, trying to get a custom shader implemented. I have the following Python code and traceback: import sys from PyQt5.QtWidgets import QApplication, QMainWindow,…
AwesomeCronk
  • 421
  • 6
  • 16
2
votes
1 answer

glTranslatef gets messed up after glRotatef

I'm a newbie to PyOpenGL. I made a simple code using it that displays a cube, and you can navigate around it using the keyboard. However, I noticed that after a glRotatef command gets called, it changes your perspective, not the positionment of the…
User 12692182
  • 927
  • 5
  • 16
2
votes
1 answer

PySide2 QOpenGLWidget key events doesn't work

As far as I understand, QOpenGlWidget uses the same window context as any other widget. I thought it would be a good idea to use keyPressEvent to handle drawing commands. Unfortunately, it doesn't work as expected. When I handle a Key_Escape to exit…
Artem
  • 563
  • 3
  • 17
2
votes
2 answers

PyOpenGL: Rendering... Well... Anything really

I've been working on a project using python with OpenGL for a while now. I previously posted a similar problem, but I have since done some more research and switched to non-deprecated functions. Following this tutorial (Translating it to Python…
Josiah
  • 3,266
  • 24
  • 24
2
votes
1 answer

Need to Install PyOpenGL (Windows)

I am trying to install PyOpenGL using pip on Windows 10. I have tried to install it using pip install PyOpenGL and it tells me that it has installed it successfully but when I try to use PyOpenGL in python, it tells me that I do not have a module…
lavnalla
  • 31
  • 1
  • 7
2
votes
1 answer

Is there a way to change the location and size of an imported .obj file in Pygame?

I created an .obj file using blender and loaded into Pygame using the OBJfileloader as sugested by skrx in: Error in OBJFileLoader Is there an easy way to change the location, height and width of the imported .obj file after importing it into…
Kempie
  • 263
  • 2
  • 10
2
votes
1 answer

Rotating a quad around a coordinate in OpenGL

I'm currently programming a primary flight display using Python and OpenGL. As I have zero experience with OpenGL (and little experience with coding in general) I do struggle with most simple feature implementation but until now I got this…
GittingGud
  • 315
  • 2
  • 16
2
votes
1 answer

How to save fragment shader image changes to image output file?

Introduction I have a game project coded with C++ and Lua (I know in the subject is written 'Python', don't worry about it), and, in there, I apply a fragment (not vertex!) shader into the game screen. Since part of my project was not made by me…
River
  • 33
  • 7
2
votes
3 answers

Python return for another function

im working with PyOpenGL, and i want to make small RGB converter function. PyOpenGL for color use floating numbers from 0 to 1. So 0 0 0 - Black 1 1 1 - White. Im make this: def RGB(Red, Green, Blue): Red = 1 / 255 * Red Green = 1 / 255 *…
Komp Tip
  • 467
  • 5
  • 8