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
11
votes
2 answers

How to initialize OpenGL context with PyGame instead of GLUT

I'm trying to start with OpenGL, using Python and PyGame. I'm going to use PyGame instead of GLUT to do all the initializing, windows opening, input handling, etc. However, my shaders are failing to compile, unless I specify exactly the version of…
lithuak
  • 6,028
  • 9
  • 42
  • 54
11
votes
2 answers

Pyglet OpenGL drawing anti-aliasing

I've been looking around for a way to anti-alias lines in OpenGL, but none of them seem to work... here's some example code: import pyglet from pyglet.gl import * …
Jared Forsyth
  • 12,808
  • 7
  • 45
  • 54
10
votes
1 answer

PyOpenGL :: OpenGL.error.NullFunctionError: Attempt to call an undefined function glutInit, check for bool(glutInit) before calling

I'm following this very easy guide in order to make my first steps into PyOpenGL. I installed pip install PyOpenGL PyOpenGL_accelerate , all good. I tested the installation through the test code: import OpenGL.GL import OpenGL.GLUT import…
10
votes
2 answers

How to get world coordinates from screen coordinates in Vispy

I am not sure how to get from screen coordinates to world coordinates. I am using VisPy and I would like to implement ray tracing and picking ability in 3D. I prepared some code based on a cube example. The code below sends a crude ray through the…
MihaPirnat
  • 153
  • 1
  • 9
9
votes
1 answer

Do OpenGL GLSL samplers always return floats from 0.0 to 1.0?

I've created a couple of floating point RGBA texture... glBindTexture( GL_TEXTURE_2D, texid[k] ); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,…
Ted Middleton
  • 6,859
  • 10
  • 51
  • 71
9
votes
3 answers

glDrawArrays vs glDrawElements

Ok so I'm still struggling to get this to work. The important parts of my code are: def __init__(self, vertices, normals, triangles): self.bufferVertices = glGenBuffersARB(1) glBindBufferARB(GL_ARRAY_BUFFER_ARB, self.bufferVertices) …
Bogdan
  • 8,017
  • 6
  • 48
  • 64
9
votes
1 answer

OpenGL render view without a visible window in python

I need to render some scene. I managed to do it in python using pyopengl and pygame. The problem is that it creates a window for a short period of time. I want to render the same image and save it, without creating a visible window (Or possibly…
user972014
  • 3,296
  • 6
  • 49
  • 89
9
votes
2 answers

Is PyOpenGL a good place to start learning opengl programming?

I want to start learning OpenGL but I don't really want to have to learn another language to do it. I already am pretty proficient in python and enjoy the language. I just want to know how close it is to the regular api? Will I be able to pretty…
Isaiah
  • 1,995
  • 2
  • 18
  • 29
9
votes
1 answer

How to draw with Vertex Array Objects and glDrawElements in PyOpenGL

I have the following code which should simply draw a green triangle to the screen. It is using Vertex Array Objects and index buffers to draw and has the simplest shader I could make. At first I was not using index buffers and was simply making the…
Milliams
  • 1,474
  • 3
  • 21
  • 30
8
votes
2 answers

OpenGL Shadow Mapping using GLSL

I am trying to get shadow mapping working using GLSL. Unfortunately my depth render results are unusable even I have a pretty decent depth buffer precision. It is rendering like wireframe, following image may be a better description. I am also…
M. Utku ALTINKAYA
  • 2,254
  • 23
  • 29
7
votes
3 answers

Building an interleaved buffer for pyopengl and numpy

I'm trying to batch up a bunch of vertices and texture coords in an interleaved array before sending it to pyOpengl's glInterleavedArrays/glDrawArrays. The only problem is that I'm unable to find a suitably fast enough way to append data into a…
Nick Sonneveld
  • 3,356
  • 6
  • 39
  • 48
7
votes
1 answer

Looking for a simple OpenGL (3.2+) Python example that uses GLFW

I am looking for a simple modern OpenGL (3.2+)example in Python. I tried with GLUT and freeGLUT, but I am not able to get a 3.2 context on OS X (Mavericks). (This seems to be a known issue with GLUT/freeGLUT). GLFW seems to be a modern lightweight…
M-V
  • 5,167
  • 7
  • 52
  • 55
7
votes
2 answers

pyopengl buffer dynamic read from numpy array

I am trying to write a module in python which will draw a numpy array of color data (rgb) to screen. At the moment I am currently using a 3 dimensional color array like this: numpy.ones((10,10,3),dtype=np.float32,order='F') # (for 10x10 pure white…
user1483596
  • 309
  • 2
  • 12
6
votes
1 answer

PyOpenGL, Pygame, and shaders don't seem to cooperate

I've been working through this excellent tutorial on modern OpenGL programming, and I'm slowly adapting it to work on PyOpenGL and pygame. However, I'm having the hardest time getting what should be a "trivial" example to work with perspective…
jamesshuang
  • 453
  • 1
  • 3
  • 10
6
votes
1 answer

Converting pygame 2d water ripple to pyOpenGL

I have a 2d pygame water simulation thingy that I followed a tutorial to make. I also found the answer to this question to fix issues with the tutorial: Pygame water physics not working as intended I have since been trying to convert this program…
1
2
3
62 63