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
3 answers

Texturing with GLSL (in PyOpenGL and Pygame)

After getting frustrated with the fixed-function pipeline being slow in Python, I started looking into shaders to draw my game's parallax backgrounds. However, I can't find any simple way to texture what vertices are drawn. I currently have a…
bonzairob
  • 81
  • 1
  • 4
  • 10
3
votes
0 answers

Enabling Multisampling in wxPython OpenGL Context

I'm trying to enable multisampling in an OpenGL program I'm writing. The application will require a substantial amount of GUI, so I am using wxPython (with which I am less familiar) instead of PyGame (SDL). I really need hardware multisampling for…
geometrian
  • 14,775
  • 10
  • 56
  • 132
3
votes
1 answer

OpenGL VBO shader

I have a 2D VBO object that represent points in 2D space. What is the best way to draw an arbitrary shape at that point? Lets say I wanted to draw a red 'X' at each. Can I use a shader to do this?
srossross
  • 1,353
  • 11
  • 16
3
votes
1 answer

Transparent textures being rendered as black in OpenGL

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…
3
votes
1 answer

having trouble adding three more cube

I'm attempting to make a cube, but I can only manage two. As you can see, the third cube is broken. I am having trouble making three more cubes because I am having a hard time understanding vertices and edges. I tried adding and removing numbers…
rttyui
  • 55
  • 4
3
votes
1 answer

My pygame/pyopengl code seems to apply a texture to every surface

I'm throwing some code together to help me better understand python, pygame, pyopengl, and 3D rendering. I've used code from two different places and I'm integrating them by writing my own code as I go. I've textured cubes in one program and made…
3
votes
2 answers

Drawing a cube with Pygame and OpenGL in Python environment

I got this code to draw an OpenGL cube in a pygame window with python but every time i try to compile it says this line 34, in Cube glVertex3f(vertices[vertex]) TypeError: tuple indices must be integers or slices, not tuple Anyone who knows how to…
user14187680
3
votes
0 answers

Opengl CAD like rotation: how to rotate scene around viewport center

I'm making a CAD-like 3D viewer with PyOpenGL. I managed to pan, zoom and rotate using mouse event. The problem is that I need the scene to always rotate around the center of the viewport even when the origin is translated. With the code I have, I…
Peter Nad
  • 31
  • 1
3
votes
2 answers

How to make a resizeble window in pygame with Opengl

I want to make resizeble window in pygame using Pyopengl, and trying to use this code pygame.display.set_mode(display, DOUBLEBUF|OPENGL, RESIZABLE) or this pygame.display.set_mode(display, DOUBLEBUF|OPENGL, pygame.RESIZABLE) Resizable does not…
ChastyEsc
  • 45
  • 3
3
votes
2 answers

Trying to Graph a Simple Square in pyOpenGL

I'm trying to teach myself OpenGL using pyopengl and I'm struck on trying to render a simple 2D square centered at the origin. Whenever I set an array value greater than or equal to 1, the shape takes up the entire screen as if I am only viewing a…
FlowofSoul
  • 510
  • 7
  • 17
3
votes
1 answer

flip texture when drawing it pyopengl

I recently downloaded a batch rendering program that uses pyOpenGl and pygame. I want to edit the draw function such that there is the ability to flip a texture when drawing it. This is the code for the batch rendering program. import numpy from…
Evelyn
  • 192
  • 7
3
votes
1 answer

how to apply lighting to .obj file on pyopengl

i implement arcball with an object from .obj file in the center when i try to implement lighting, the object show strange behaviour when i turn the object slightly, the object deconstruct and suddenly show the back side this behaviour doesn's…
Bramanta
  • 141
  • 2
  • 10
3
votes
1 answer

OpenGL procedural texture antialiasing

I`ve made a grid using a simple GLSL shader, passing texture coordinates to fragment shader. It was applied onto a large scaled plane. Fragment shader: #version 330 core out vec4 fragColor; smooth in vec2 f_TexCoord; vec4 gridColor; void…
Artem
  • 563
  • 3
  • 17
3
votes
1 answer

Strange "X" on PyOpenGL + PyGame

I'm trying to create a PyOpenGL "Hello World" project. I made some code that generates a cube to me and displays it on the screen, the problem is it doesn't show a cube, it show a strange flat 2D "X". I am almost sure that the problem is with my…
alfred
  • 33
  • 4
3
votes
1 answer

Trackball doesn't turn correctly

i'm trying to implement trackball by referring to this source https://en.wikibooks.org/wiki/OpenGL_Programming/Modern_OpenGL_Tutorial_Arcball and https://www.khronos.org/opengl/wiki/Object_Mouse_Trackball but after getting the rotation axis it…
Bramanta
  • 141
  • 2
  • 10