Questions tagged [python-moderngl]

46 questions
6
votes
1 answer

How to link to external libraries using python sphinx?

I have a python module documented on RTD: http://modernglexttextools.readthedocs.io This is an extension of another module and I want to link between the two. I want the parameters and the return types to work as a link. Here is an example. My…
Szabolcs Dombi
  • 5,493
  • 3
  • 39
  • 71
4
votes
2 answers

How do I read a moderngl fbo(frame buffer object) back into a numpy array?

I have one of 2 FBO's i've been using to ping pong some calculations in glsl, and I need to read the texture data (of dtype='f4') back into a numpy array for further calculations. I haven't found anything in the documentation that explains how to do…
Mike Manh
  • 333
  • 2
  • 11
3
votes
1 answer

ModernGL set uniform

I'm considering switching to ModernGL over PyOpenGL, and I'm struggling to implement anything right now. First of all, I would like to try the classic "triangle that changes shape using a time uniform and sine function", but I'm stuck on how to…
Parashoo
  • 315
  • 1
  • 10
3
votes
0 answers

What is the best approach for calculating euclidean distance between 100s of images with Python moderngl?

I am basically looking for someone familiar with the Python library moderngl. I am doing some experiments with different evolutionary algorithms to arrange polygons, with the objective being to reproduce a reference image whereby the euclidean…
eM7RON
  • 59
  • 1
  • 4
3
votes
1 answer

Z dimension disappears in moderngl?

I've been trying to rotate an object but upon rotation, I realized it was just flat. What is strange is that I can clearly see the inputs for the z dim are there, it just isn't being accounted for. Here is my code: import moderngl from PyQt5…
Krupip
  • 4,404
  • 2
  • 32
  • 54
2
votes
1 answer

Creating a context utilizing ModernGL for pygame

I'm trying to create a pygame software that utilizes shaders from ModernGL. I took the code from the following tutorial on Youtube. However, when I attempt to execute the code, ModernGL raises the following error: ValueError: Requested OpenGL…
2
votes
0 answers

MaminGL OpenGL err = 1280 (Invalid Enum) - Animated Plane with Texture

I'm getting invalid enum error using maningl. I have created an animated wave with video as texture. Code works well with a short animation of around 5 seconds. This is the result: But with more than 10 seconds it throws invalid enum…
Hōgyoku
  • 21
  • 3
2
votes
0 answers

Running a simple_3dviz script on macOS Big Sur getting modernGL error

I try to run a simple_3dviz script, but I always get the following error: File "...venv/lib/python3.8/site-packages/moderngl/context.py", line 1228, in program res.mglo, ls1, ls2, ls3, ls4, ls5, res._subroutines, res._geom, res._glo =…
Luca Jung
  • 1,440
  • 11
  • 25
2
votes
1 answer

Why does texture index 31 is overridden in moderngl?

I am writing a simple app that loads an image and displays it on the screen such that the left and right half are rendered separately. import glm import moderngl_window import numpy as np from PIL import Image class…
DalyaG
  • 2,979
  • 2
  • 16
  • 19
2
votes
2 answers

How do I render multiple objects with different textures in python-moderngl

I am trying to create a headless renderer which takes 2 models with different textures and then renders them both into a single image texture = ctx.texture(texture_image.size, 3, texture_image.tobytes()) texture.build_mipmaps() texture1…
2
votes
2 answers

Draw objects on moderngl context in Pygame

I wrote this simple program that displays an image onto a moderngl context, using pygame, and my goal is to draw a rectangle on the screen. (This is obviously just a minimal working example, and the real goal is to animate the texture and make more…
DalyaG
  • 2,979
  • 2
  • 16
  • 19
2
votes
1 answer

How to add a depth buffer in Moderngl EGL backend?

This code renders a colored triangle with anti-aliasing (samples=8) when a depth buffer line depth_attachment=ctx.depth_texture((512, 512), samples=8) is commented. But when I add a depth buffer it returns a GL error at the binding fbo_msaa…
Joys
  • 311
  • 3
  • 15
2
votes
1 answer

How to enable Anti-aliasing in Moderngl EGL backend?

This code renders a colored triangle when there is no anti-aliasing (samples=0). But when I turn on anti-aliasing (samples=1...32) it can't render anything. How to make it work with anti-aliasing? Perhaps I cannot read pixels from multisample fbos…
Joys
  • 311
  • 3
  • 15
2
votes
1 answer

How to run moderngl in Colab?

I'm trying to run moderngl in Colab. I installed it and ran a virtual display: !sudo apt-get update --fix-missing && apt-get -qqq install x11-utils > /dev/null !sudo apt-get update --fix-missing && apt-get -qqq install xvfb > /dev/null !python3 -m…
2
votes
1 answer

How to center a subclass of QGLWidget in PyQt5

I have an example program in PyQt5 I have a class: class QGLControllerWidget(QtOpenGL.QGLWidget): ... And a main program: app = QtWidgets.QApplication([]) window = QGLControllerWidget() # this is my class window.show() #…
Szabolcs Dombi
  • 5,493
  • 3
  • 39
  • 71
1
2 3 4