Sunday evening

ModernGL was not fun

It requires OpenGL 3.3, but my Intel(R) HD Graphics 520 on linux has version 3.0. There is workaround that I will use:

MESA_GL_VERSION_OVERRIDE=3.3 python3 run_game.py

The documentation for ModernGL is not good enough for pyweek. For example I can't figure out how to set uniform variables using only https://moderngl.readthedocs.io/en/stable/. Moreover I can't do it by googling moderngl uiform! I have to read https://github.com/moderngl/moderngl/tree/master/examples instead. Looks like I breaking rule "8. Allowed Documentation".

(log in to comment)

Comments

It's documented somewhere how to set uniforms, but yes, I struggled with it as well. Here is one refererence to it. Anyway, it's

program['uniform_name'].value = value
How are you getting your OpenGL context? Are you using moderngl_window?


I used pygame.display to create context. No I have not tried moderngl_window.


I recheck the error about unsupported version. It was about my shader code, not about library. With #version 130 everything working without workaround. 

Are you using Pygame 2.0? To request an OpenGL 3.3 context you need

pygame.display.gl_set_attribute(pygame.GL_CONTEXT_MAJOR_VERSION, 3)
pygame.display.gl_set_attribute(pygame.GL_CONTEXT_MINOR_VERSION, 3)

and those options are only added in Pygame 2.0.

(I worked through some of this for Wasabi2D).