Questions tagged [python-moderngl]

46 questions
1
vote
1 answer

GUI with Pygame and ModernGL

I have recently been learning ModernGL with Python and Pygame. However I cannot work out how to create 2D images (a GUI) ontop of the ModernGL context (do I still use Pygame?) Before when I tried to render pygame images to the screen, (with the…
Murray
  • 11
  • 4
1
vote
2 answers

"cannot detect OpenGL context" when using Pygame and moderngl?

I wrote the simple program below: import pygame as pg import moderngl as mgl import sys class GraphicsEngine: def __init__(self, win_size=(1200,700)): pg.init() self.WIN_SIZE = win_size …
Error
  • 9
  • 3
1
vote
1 answer

Executing a simple GLSL compute shader with modernGL does not work

I recently discovered the advantages of compute shaders. However, somehow I couldn't get them to write data correctly. In the minimal example below, I want to use a compute shader to rotate the first three channels of an image. However, when using…
fst
  • 33
  • 5
1
vote
1 answer

Screen appears completely white when using ModernGL and Pygame to render a texture

I am trying to make a minimal Moderngl example of about <150 lines so I can better understand how it works. The issue here is that when I try to render this texture (it is an image of a mushroom), it instead draws a fully white screen. What am I…
1
vote
0 answers

ModernGL context rendering brakes Pygame (nothing appearing on the screen)

On monday i wrote a python script with modernGL that runs a fragment and a vertex shader everything worked fine and I had like 40 FPS. Two days later, I tried to rerun that same script and nothing appeared. All my old scripts that worked too were…
Gauthier
  • 11
  • 2
1
vote
1 answer

ModernGL depth-test ignoring vertices in the back (sometimes?)

When rendering this cube, I'm using the moderngl DEPTH_TEST to properly draw in the faces at the correct depth, which works fine as shown: However, I want to make the cube transparent. After giving it a slightly transparent texture, it renders like…
MichaelT572
  • 178
  • 1
  • 9
1
vote
1 answer

OpenGL depth test against cleared depth not as I expected (moderngl)

I am rendering a quad to a blank screen with its depth first cleared to (0.25). The depth of each vertex is set equal to its y coordinate, and it is a rectangle ranging from (-.5, -.5) to (.5, .5), so I would expect that the depth test (set to '>'),…
user2649681
  • 750
  • 1
  • 6
  • 23
1
vote
0 answers

Which algorithm for triangularization of algebraic surfaces with singularities?

I want to code some software in Python that visualizes implicit algebraic surfaces with singularities (say the Barth Sextic e.g.). I am thinking about calculating primitive triangles in Python and then give them to a shader connected via ModernGL…
schoeni
  • 65
  • 9
1
vote
1 answer

Moderngl: project photo with angle

I am trying to project a photo with some angle. If the photo was taken when the camera was looking straight ahead, then the camera angles (yaw, pitch, roll) are all zero. Now let's say that the camera was looking somewhat upwards, let's say with…
DalyaG
  • 2,979
  • 2
  • 16
  • 19
1
vote
0 answers

AWS Lambda: Unable to find libGL.so package while using moderngl / glcontext

I've tried a lot of solutions to similar issues but I've found that they're not quite specific enough or they're outdated (or maybe I'm not sharp enough!) I'm packaging some Python code to run on AWS Lambda and it uses a number of packages including…
transposeglobal
  • 491
  • 4
  • 14
1
vote
2 answers

Numpy array to and from ModernGL buffer (open and save with cv2)

I am wanting to: Open the texture from an image via cv2 instead of via ModernGL's load_texture_2d method. Save the resulting image (in the write method) via cv2 rather than Pillow. I currently have the following code: from pathlib import Path from…
correctsyntax
  • 364
  • 4
  • 14
1
vote
1 answer

Using a TextureArray in ModernGL

I recently started using ModernGL, and today I would like to start working with texture arrays. I'm just stuck on how to pass the individual subtextures in Moderngl? In OpenGL I would call glTexSubImage3D. However, in the ModernGL documentation,…
1
vote
1 answer

How to set primitives to GL_LINES with moderngl in python

I am using the following code to render a rectangle on screen, using moderngl and moderngl_window. This is mostly derived from their examples: import moderngl import moderngl_window as mglw import glfw import numpy as np import OpenGL.GL import…
jcage
  • 651
  • 6
  • 14
1
vote
1 answer

ModernGL render returns GL_INVALID_ENUM error?

I have written this GPU code in C using GLES and EGL, and it ran fine. I am now trying to port this GPU code to python using ModernGL, except right after I call the render function, ctx returns a GL_INVALID_ENUM error. I am using a NanoPi M1 Plus…
AdishRao
  • 163
  • 1
  • 1
  • 12
1
vote
1 answer

How to set background greyscale of multiple line plots in pyopengl?

I have a 2-D numpy array that I have plotted in Pyopengl using Pyqt. Now I want to set The background of the plot greyscale such that when the line moves up or down, its background grey color changes intensity. I am attaching images for the…
AKS
  • 142
  • 10