ScriptLineStudios / pygame_shaders

a library to easily integrate shaders into your new or existing pygame projects
https://pygame-shaders.readthedocs.io/en/latest/
MIT License
49 stars 4 forks source link

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' #10

Open IshaanGarud opened 9 months ago

IshaanGarud commented 9 months ago

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

MeteorShower2004 commented 6 months ago

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

MeteorShower2004 commented 6 months ago

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

Mectron2 commented 5 months ago

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