Closed JiffyRob closed 1 year ago
This video is good if you want to know how to implement it: https://www.youtube.com/watch?v=LFbePt8i0DI
As far as learning GLSL, the basics are not terrible. It is a wee bit impossible to debug though. I managed to make a colored lighting sphere with minimal pain.
It also broke pygame.image.get_surface()
which previously was used for screenshots. Instead you have to take the OpenGL context and send a buffer from it to a pygame surface. Then you can save that.
Maybe this ought to be implemented sooner rather than later. This would replace a lot of code - particle effects(?), camera scrolling, weather cycle, camera shake, fancy map transitions, etc.
Just found a downside: We very likely would not be able to make a web build if we used ModernGL. There is another library called ZenGL which allegedly works better on the web, but I don't know for sure.
I've been working on particles and am not overly impressed with the performance I am getting. I house my benchmark program at this repo. Currently it is private, so you may not see it, but once it is successfully web built, it will be made public. I currently get about 4300 cows on desktop, and less on web. ZenGL looks to support the web platform, so I may try to get that to work.
As of now zengl shading will not be added to the game due to the inherent constraints of the library. We'll see if pygbag can do another library or zengl improves down the line.
This is an issue to debate the necessary-ness of implementing OpenGL GPU shaders in the game. This would allow for fast processing of effects to the screen and other surfaces. Some examples of what we could do would be:
bush.gl
. This would have utilities for creating shaders and applying them to surfaces. Downsides:I'm kind of leaning toward yes, because
bush
was meant to be reusable, and not just specific to this game. If we decide not to use it now, we could still use it later.At any rate, we should probably do this last, as most of the things listed above are either optimizations of current features or fancy eye-candy that leaves game play unchanged.