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

PyOpenGL, Hidden-line removal and glut

I am using an approach for hidden line removal in a PyOpenGL program where I draw a figure twice, once as a wireframe and then again as filled polygons. It is working fine for my own figures but not for the basic glutSolidCube/glutWireCube so I am…
PaulM
  • 305
  • 1
  • 8
2
votes
1 answer

AttributeError: module 'pygame.math' has no attribute 'Matrix44

I am encountering an AttributeError in my Pygame program. The error message says that the module 'pygame.math' has no attribute 'Matrix44'. I am using the Matrix44 class from the pyrr library, which I have installed using pip. I am not sure what is…
ApaxPhoenix
  • 190
  • 10
2
votes
2 answers

glDrawElements method not drawing with indices and vertices

My desired output of my program would be a simple quad being drawn onto the screen, instead nothing is being drawn on my screen. The relevant methods of my program are below. What is wrong in my code causing this issue? I'm trying to draw a quad on…
2
votes
1 answer

Is the last parameter of glVertexAttribPointer a '0' or 'None'?

I am trying to setup a simple 3D Engine in pyOpenGL. My current goal was to achieve a 2D rectangle being displayed to the screen, which isn't working at all. (nothing is being rendered to the screen, no exception is being thrown by the program.) The…
2
votes
1 answer

PyOpenGL program doesn't show cube?

I'm trying to draw a 3D cube using Python and its packages, pygame, numpy, PyOpenGL, and PyOpenGL_accelerate. The 3D cube also rotates to other directions when I press the arrow buttons. For example, it rotates to right when I press the right…
Ai-Yue
  • 23
  • 6
2
votes
1 answer

PyopenGL Square Texture

I'm trying to load a minecraft texture in OpenGL, can someone help me? texture: My Code: import sys from OpenGL.GLUT import * from OpenGL.GL import * def color(r, g, b): return (r/255, g/255, b/255) def display(): …
tpadev
  • 43
  • 5
2
votes
1 answer

glBufferSubData not working, doesn't show error

I'm making a basic voxel rendering class with python using glfw. I'm using glBufferSubData instead of glBufferData, but it won't render. Here is the code that is suspected to be causing the problem: # imports import glfw, numpy as np from OpenGL.GL…
N3RDIUM
  • 358
  • 5
  • 22
2
votes
1 answer

How do I add random colors?

Now that I have cubes, my next thing to do is to add to each cube a random color, but I am having trouble making it on each cube. As you can see in the output of my code, every face of the cube has the same color, and the sides are different. I have…
rttyui
  • 55
  • 4
2
votes
2 answers

How do I add color for every pair of triangle?

import pygame from pygame.locals import * from OpenGL.GL import * from OpenGL.GLU import * vertices = ((1, 1, 1), (1, 1, -1), (1, -1, -1), (1, -1, 1), (-1, 1, 1), (-1, -1, -1), (-1, -1, 1), (-1, 1, -1)) edges = ((0, 4, 3), (6, 4, 3),…
2
votes
1 answer

Screenshots in OpenGL using python

How do we take a screenshot of the OpenGL windows using python? Using jupyter, opengl and pygame. The code is: import pygame from pygame.locals import * from OpenGL.GL import * from OpenGL.GLU import * from math import…
2
votes
1 answer

How to add to opengl pygame VBOs from another process

The problem I'm just trying to make a game like minecraft, but I just can't add to a vbo from another process. The strange thing is that the logs appear two times and the window just closes instantly. The code import pygame, multiprocessing from…
N3RDIUM
  • 358
  • 5
  • 22
2
votes
1 answer

Print the content of a VBO

I'm modifying bits of a OpenGL_accelerate.vbo.VBO object at different moments, and I'd like to print the actual whole content this object (for debug purpose). A simple print(my_vbo) doesn't work (it prints
T. Tournesol
  • 310
  • 2
  • 14
2
votes
1 answer

Indexed drawing in PyOpenGL using glDrawElements doesn't draw anything

I'm fairly new to OpenGL and I tried recreating the tutorial from https://learnopengl.com/Getting-started/Hello-Triangle to draw a rectangle in PyOpenGL. (Original source code:…
2
votes
1 answer

OpenGL VBO can run without error but no graphics

The following code should draw a cube each time it is called error code: draw=False block_VBO=0 block_EBO=0 block_VAO=0 block_EBO_buffer_len=0 def print_blocks(sx:int,sy:int,sz:int): global…
Wzq
  • 80
  • 6
2
votes
1 answer

Consider a circle ( − 40) 2 + ( − 40) 2 = 400. Rotate it along X- axis counter clockwise 30 degree and translate it along Z- axis for +20 units

I am able to draw the circle and translate and rotate it with the help of @Rabbid76 from stack overflow. But need help with these two part of the question: Q1 - Take orthographic projection of this circle on xy plane. Q2- Consider 3 axes (100, 0,…
Professor
  • 87
  • 6