pyopengl

Transparent textures being rendered as black in OpenGL

Transparent textures being rendered as black in OpenGL Question: I have a texture with transparent parts, but instead of being rendered transparent they’re black. To test if the RGBA values get passed on correctly to the shader, I made everything render in greyscale. And as I thought the alpha values weren’t getting passed on correctly. …

Total answers: 1

Why do objects in my window sometimes disappear and reappear?

Why do objects in my window sometimes disappear and reappear? Question: The objects in my window sometimes disappear and reappear. This mainly happens when resizing the window. I suppose this is because my two methods conflict with each other with the glutMainLoopEvent() function. I create the window like this: def create_display(self, window_name): glutInit() glutInitDisplayMode(GLUT_RGBA) # …

Total answers: 1

My texture is being displayed as completely black in pyOpenGL

My texture is being displayed as completely black in pyOpenGL Question: I was trying to display a texture in pyOpenGL with the following methods. Instead of the texture being rendered correctly, the entire object was black. The texture is being loaded with PIL in an RGBA format. I try to load in the texture using …

Total answers: 1

glDrawElements method not drawing with indices and vertices

glDrawElements method not drawing with indices and vertices Question: 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 …

Total answers: 2

Does glBufferData need a Buffer object as the 'data' parameter?

Is the last parameter of glVertexAttribPointer a '0' or 'None'? Question: 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 …

Total answers: 1

glGenVertexArrays function doesn't work in every Python script

glGenVertexArrays function doesn't work in every Python script Question: I want to create a pyOpenGL program to display quads. When creating a VAO an exception is being thrown. The glGenVertexArrays function throws this excpetion in my loader.py script: OpenGL.error.NullFunctionError: Attempt to call an undefined function glGenVertexArrays I guess it has something to do with initialization. …

Total answers: 1

Python OpenGL glRotatef does not rotate the correct amount

Python OpenGL glRotatef does not rotate the correct amount Question: I use Pycharm and coupled OpenGL with pygame. I have a problem with the OpenGL method glRotatef. It seems like it does not rotate the right amount. I have a class which has the 3-dimensional coordinates xPos,yPos,zPos. The class is drawn with this method: def …

Total answers: 1

Rendering Triangle using PyImgui/PyOpenGL/GLFW stack

Rendering Triangle using PyImgui/PyOpenGL/GLFW stack Question: I’m new to the intermediate GUI framework world and OpenGL. I’m trying to get this example to work: # -*- coding: utf-8 -*- import glfw import OpenGL.GL as gl import numpy as np import imgui from imgui.integrations.glfw import GlfwRenderer def main(): imgui.create_context() window = impl_glfw_init() impl = GlfwRenderer(window) while …

Total answers: 1

Is there a difference between GLSL/GLM and Python/numpy when it comes to 4×4 matrix multiplication?

Is there a difference between GLSL/GLM and Python/numpy when it comes to 4×4 matrix multiplication? Question: Basically, this works: glUniformMatrix4fv(glGetUniformLocation(self.shader.program, "projection"), 1, GL_FALSE, self.P) glUniformMatrix4fv(glGetUniformLocation(self.shader.program, "view"), 1, GL_FALSE, self.V) glUniformMatrix4fv(glGetUniformLocation(self.shader.program, "model"), 1, GL_FALSE, self.M) #version 330 core layout (location=0) in vec3 vertexPos; layout (location=1) in vec2 vertexTexCoord; layout (location=2) in vec3 vertexNormal; uniform mat4 model; …

Total answers: 1