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

Draw a background video behind a 3D model in OpenGL

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…
Ari
  • 216
  • 1
  • 10
2
votes
1 answer

How to make specular lighting on python to implement the Phong lighting?

I need your help. Using python, I have to implement the lighting of my three-dimensional shape by the phong model. My figure is a deltoidal icositetrahedron. I was able to build this shape, found the coordinates of the vertices, and also calculated…
2
votes
1 answer

pyOpenGL GLUT window function doesn't close properly

This minimum working example of an environment with PyOpenGl and GLUT presents the same issue I am having on bigger code. Creating/closing continuously an instance of this class, increases memory usage until all my machine starts slowing down. What…
Daniele
  • 21
  • 2
2
votes
1 answer

OpenGL: How can I render a triangle mesh at 10bit (or 12bit or 16bit) channel depth color?

For a vision research experiment, I have a monitor that supports 10bit/channel (=30bit color). I want to render a triangle mesh in a simple scene that uses the full bit depth, and I want to save this rendering as a .png file. The rendering is just…
Will Sni
  • 51
  • 4
2
votes
1 answer

How to save pygame scene as jpeg?

I need to do the following. I loaded an obj model using OBJFileLoader and rendered it to a window. How can I save the rendered scene as a picture? Is it possible to do this without even showing the window?
SomVolodya
  • 23
  • 3
2
votes
1 answer

Trying to draw simple square using indices and vertices with PyOpengl

I'm trying to create a 2D python game with Pygame. But I realized that I could use PyOpengl, so I try to learn how use it. I'm able to create a triangle strip on my screen with the vertices. However, I would like to render these triangles using…
Thalrod_
  • 53
  • 3
2
votes
1 answer

difference in giving parameters to opengl code in LWJGL and PyOpenGL

i am learning opengl with python.and following this course https://www.youtube.com/watch?v=WMiggUPst-Q&list=PLRIWtICgwaX0u7Rf9zkZhLoLuZVfUksDP&index=2 just to be able to do.he is using LWJGL, i am PyOpengl. i noticed some of his methods…
user13104225
2
votes
1 answer

How to PyOpengl or pyglet to draw on top of desktop?

I'm writing an application that is looking to draw basic polygons and ellipses on the Windows 7 desktop using OpenGL. According to this previous question, this is possibly by getting the window handle to the desktop, which I know how to do. Draw…
jmite
  • 8,171
  • 6
  • 40
  • 81
2
votes
2 answers

Calling OpenGL Extensions from Python

I am using PyOpenGL 3 on Ubuntu Natty. I want to use the glDrawElementsBaseVertex function. I can see it listed in my glxinfo output, so I know my card has it. However, I cannot find how to actually invoke it. When I import OpenGL.GL I get a…
Will
  • 73,905
  • 40
  • 169
  • 246
2
votes
1 answer

How to solve Python OpenGL Memory Leakage problem?

I am trying to draw some traingles and render some texts in screen. But I've observed that memory(RAM) is gradually increasing just only for 6 draw calls. I've 8 GB RAM. When I run the program memory usage goes from 4.2 to 6 within 1 minute. Here is…
exiled
  • 305
  • 2
  • 11
2
votes
1 answer

How to render text with PyOpenGL?

I'm learning modern openGL, and at this moment I'm facing trouble with rendering text. I'm following this tutorial which is in C++, but I'm trying to implement in python. Here is my code: from OpenGL.GL import * from OpenGL.GLU import * from…
exiled
  • 305
  • 2
  • 11
2
votes
1 answer

Weird lines show up when changing the viewpoint on pyopenGL and pygame

so I am working on a 2d game using pygame and PyopenGL, I have done some stuff to make it so the window is resizable. When the window resizes, the game resizes with it. This is all good. My game is a tile based game with scrolling up and…
2
votes
1 answer

How to add texture to a triangle?

I'm trying to add woody texture to the triangle. Code works fine for only triangle. But raises error while I try to add texture. I think the problem is in the GLSL or in creating EBO/VBO (not sure). The whole screen remains black. Here is the whole…
exiled
  • 305
  • 2
  • 11
2
votes
1 answer

How to set window hint for GLFW in Python

I have written this Python code which will draw a triangle in a window created using GLFW: import glfw from OpenGL.GL import * from OpenGL.GL.shaders import compileProgram, compileShader import numpy as np vertex_src = """ # version 330 core in…
Puspam
  • 2,137
  • 2
  • 12
  • 35
2
votes
0 answers

Drawing Multiple Objects with Python OpenGL and Finding Good Approach

I'm new to OpenGL and using it with python for a project. I'm trying to draw multiple stuffs just creating a single buffer. I just want to know if it is a good approach, and if not, what am I missing. Also, I want to know if multiple buffers are…
exiled
  • 305
  • 2
  • 11