opengl

NameError: name 'glPushMatrix' is not defined

NameError: name 'glPushMatrix' is not defined Question: Try to run a test code for stable baselines gym import gym from stable_baselines3 import A2C env = gym.make("CartPole-v1") model = A2C("MlpPolicy", env, verbose=1) model.learn(total_timesteps=10_000) obs = env.reset() for i in range(100): action, _state = model.predict(obs, deterministic=True) obs, reward, done, info = env.step(action) env.render() if done: obs = …

Total answers: 1

how to use glutKeyboardFunc in python?

how to use glutKeyboardFunc in python? Question: i just wanna use my keyboard for transform my logo, but doesnt work, did i forget something? what should i do to get glutKeyboardFunc work? please help me w,h= 600,600 xScale = 1 yScale = 1 def logo(): glScaled(xScale,yScale,0) glBegin(GL_POLYGON) glColor3ub(255,0,0) glVertex2f(0, 0) glVertex2f(120, 200) glVertex2f(0, 400) glVertex2f(-120, …

Total answers: 1

glGetError not catching errors

glGetError not catching errors Question: I am trying to render images with OpenGL using a compute shader. I create a compute shader and program for it, then a vertex shader and fragment shader, as well as a program for them. I then create a texture and two triangles and render the texture on the triangles. …

Total answers: 1

Unexpected lines between textured cubes in pyopengl

Unexpected lines between textured cubes in pyopengl Question: I am making a little game in python, which renders cubes. There are unexpected lines between cubes, and they disappear when we get closer. My code: # imports import glfw from OpenGL.GL import * from OpenGL.GLU import * # internal imports from core.renderer import * from player …

Total answers: 1

OpenGL: VBO Textures not working when loaded from a thread

OpenGL: VBO Textures not working when loaded from a thread Question: I’m really new to this community. I’m sorry for any mistakes in advance.I’m making a game like minecraft with GLFW and OpenGL. The problem is, it just renders three faces correctly and the other faces have a wierd glitch. Here is my code: main.py …

Total answers: 1

glVertexAttribPointer() can't find valid context on Wayland environment?

glVertexAttribPointer() can't find valid context on Wayland environment? Question: I try to draw colorized triangle. I want to use modern OpenGL and translate data via vertex attrib array. Vertex shader and Fragment shader just pass color from input to output and don’t contain any interesting code pg.init() triangle = np.array( triangle, dtype=np.float32 ) triangle_buffer = …

Total answers: 1

A minimal OpenGL example in PyQt6 does not work. Error: "invalid operation" in glClearColor

A minimal OpenGL example in PyQt6 does not work. Error: "invalid operation" in glClearColor Question: I try to run a very simple OpenGL example: import sys from OpenGL import GL as gl from PyQt6.QtOpenGLWidgets import QOpenGLWidget from PyQt6.QtWidgets import QApplication class Widget(QOpenGLWidget): def __init__(self): super().__init__() self.setWindowTitle("PyQt6, OpenGL 3.3") self.resize(400, 400) def initializeGL(self): gl.glClearColor(0.5, 0.5, 0.5, …

Total answers: 1

Python OpenGL glRotatef – looking for the correct multiplier

Python OpenGL glRotatef – looking for the correct multiplier Question: I am using gluLookAt with a camera whose coordinates are xCam, yCam and zCam. The coordinates of the object the camera is looking at are xPos, yPos, and zPos. There are variables named mouseturnX and mouseturnY, which measure the deviation of the mouse from the …

Total answers: 1

Draw a background video behind a 3D model in OpenGL

Draw a background video behind a 3D model in OpenGL Question: I am tring to draw 3d model (.obj) by this script https://github.com/yarolig/OBJFileLoader/blob/master/OBJFileLoader/objloader.py and as bacgrund I want to draw video from the webcam.but when I am drawing the image and the 3d model only the image show up. This is my Image loder class …

Total answers: 1

anomaly while exporting openGL texture using openCV

anomaly while exporting openGL texture using openCV Question: For debugging purpose I decided to write texture exporting function: def image_export(self, file_name: str): im_format = file_name.rsplit(‘.’)[-1] if im_format in (‘jpg’,): iformat = gl.GL_BGR elif im_format in (‘png’,): iformat = gl.GL_BGRA else: raise NotImplementedError with self: # binding texture # gl.glPixelStorei(gl.GL_PACK_ALIGNMENT, 1) im = (gl.glGetTexImage(gl.GL_TEXTURE_2D, 0, iformat, …

Total answers: 1