pygame_shaders icon indicating copy to clipboard operation
pygame_shaders copied to clipboard

File "C........Python312\Lib\site-packages\moderngl\__init__.py", line 1647, in _vertex_array attribs = [types[x] if type(x) is int else types[locations[x]] for x in attribs] ^^^ KeyError: 'vertexTexCoord'

Open IshaanGarud opened this issue 2 years ago • 3 comments

The following error persists when you try to output a color using:-

#version 330 core
in vec3 fragmentColor;
in vec2 fragmentTexCoord;

uniform sampler2D imageTexture;

out vec4 color;
void main()
    {    color = vec4(1.0);       // White color   }

// Should've produce white screen

In short, you cant get an output rather than the texture fed to the shader (the screen). It worked in previous versions

IshaanGarud avatar Jan 02 '24 18:01 IshaanGarud

Hello I got trapped with this exception too, have you solved this? :D

MeteorShower2004 avatar Apr 11 '24 04:04 MeteorShower2004

It seems that this KeyError should be caught by the try block (in file screen_rect.py line 51), and handled by the code wrote in moderngl.error.Error(exactly moderngl.Error in newer version of 5.10). I added except KeyError, and then handle this error with the code wrote in except moderngl.error.Error. With this, example programs are able to run at least. But I'm not sure whether them act properly or not. :D

MeteorShower2004 avatar Apr 12 '24 08:04 MeteorShower2004

as MeteorShower2004 already said, in newer versions of ModernGL (e.g. current 5.10) moderngl does not have an "error" attribute, it has been replaced by "Error", so you just have to downgrade the version of moderngl. I got everything working on version 5.8.2

pip uninstall moderngl
pip install moderngl==5.8.2

Mectron2 avatar May 01 '24 20:05 Mectron2