Questions tagged [python-moderngl]

46 questions
1
vote
1 answer

How to create surface from 3-D numpy array in Pyopengl?

I have created a 3-d numpy array consisting of X, Y, and Z axis coordinates. Now I am trying to create a surface using these points in opengl but all I have got success is in creating wire model something like this below . Can anyone suggest changes…
AKS
  • 142
  • 10
1
vote
1 answer

PyQt5 choose the latest OpenGL version available

I write an application in PyQt5. I want to use the latest OpenGL version available. I want some backward compatibility as well. Currently I have: fmt = QtOpenGL.QGLFormat() fmt.setVersion(3, 3) fmt.setProfile(QtOpenGL.QGLFormat.CoreProfile) However…
Szabolcs Dombi
  • 5,493
  • 3
  • 39
  • 71
0
votes
0 answers

Python moderngl and PIL with big image (14000x9600) only loads red channel

I am trying to load big .png files (~10-16 MB, 14000x9600) with PIL. When I load them into a texture I can only use one color channel (I try 3 or 4 and it tells me it doesn't match in size). The part handling this is: from PIL import Image` img =…
0
votes
0 answers

How do i fix a datasize mismatch error in moderngl

I have been working on a pixel-style game using pygame, and wanted to add a crt filter using glsl filters. Now, the code is set up, but doesn't work. Everytime i run it, it throws a datasize mismatch error like this: File…
0
votes
1 answer

Moderngl: Render VAO with multiple shaders

I'm doing some stuff with 2D opengl rendering. Is there a way to render a vertex array object but have the data be passed through multiple shaders? For example, a shader that applies a normal map to the texture, and then a shader that blurs the…
0
votes
1 answer

Why are half my uniforms missing when initializing a compute shader using python modernGL?

Here is the problem: I'm creating a compute shader in python for radiative transfer using modernGL. But upon creation, it does not contain all the uniforms I declare in the shader code. Here is my (simplified) python code: # Creation of the…
Azireo
  • 145
  • 1
  • 5
0
votes
1 answer

Pip can't build wheels for pyproject.toml projects because it can't find "--plat-name."

I'm trying to install moderngl using pip. Of course, python -m pip install moderngl It failed to build wheels for moderngl and one of its dependencies, glcontext. In both cases, it gave me the same error message: error: --plat-name must be one of…
0
votes
1 answer

How to get render data from (headless) context in ModernGL

After creating a headless context with ctx = create_context(standalone=True) ctx.viewport = (0, 0, 500, 500) and creating a vertex array, I wish to get the image data of vao.render(). Is there any way to do this? Edit: Actually, I'm not sure how to…
MichaelT572
  • 178
  • 1
  • 9
0
votes
1 answer

content[0][2] must be an attribute not NoneType moderngl

I am trying to test the following simple example wherein I pass something to the vertex shader and read its output to print. import moderngl import numpy as np import struct vertex_shader_source = ''' #version 330 in vec3 attPosition; …
WillyWonka
  • 91
  • 1
  • 7
0
votes
1 answer

Ensuring endianness in moderngl buffers

I'm trying to learn moderngl for Python and I want to know if there is a way to make certain that when I read/write to a buffer (uniform or shader storage), the endianness agrees between guest and host devices. I have the following minimal…
0
votes
0 answers

How to resize/move Window while executing other scripts/functions? moderngl-window and pyglet

My goal: Write a class that plots something after creating a window and using vao.render(mode=moderngl.PATCHES) only when an update() method is called, in order to update a dynamic VBO. imshow by matplotlib is just toooo slow. The issue: Based on…
Breno
  • 748
  • 8
  • 18
0
votes
0 answers

python ModernGL pixel perfect textures

I am using ModernGL to render a 2D texture with pixel perfect precision. My image contains a series of boxes which are 1 px wide, but when I render them, some of the edges are wider than others. I am using orthographic projection which should give…
00728M
  • 13
  • 4
0
votes
0 answers

Minus values of distortion coefficients cause broken images with OpenGL Vertex Shader

I'm working with python moderngl to generate a simulated scene views from point clouds made from Digital Elevation Model and airborne photos. I implemented a camera model based on OpenCV in GLSL Vertex Shader and it works well usually. However, some…
0kam
  • 1
  • 1
0
votes
2 answers

moderngl headless hello world gives unexpected results

I'm running into a very strange issue with moderngl latest version when running in headless mode. The following code should give me a triangle that touches the edges of the viewport on the right and on the top, but instead the right and top vertices…
Jochemspek
  • 321
  • 2
  • 9
-1
votes
1 answer

Freezing Python moderngl application with PyInstaller

I am attempting to create an executable program out of a Python project that uses moderngl. Here is a minimal example that just creates a window and waits til it's quit: import moderngl as mgl import pygame as pg pg.init() screen =…
user2649681
  • 750
  • 1
  • 6
  • 23