It may not look like it
But this took all week, and it looks very good in-program. There's no time for a game. All I've got is water simulation.
If anyone ever actually reads this, I developed some really useful re-usable code.
A back-buffer abstraction you can activate using
with backbuffer:
And a GLSL shader uniform parameter provider you can activate using
with UniformProvider(shader_obj, param=value,param2=value2, sampler=pygletTexture):
I made useful and cool things but no game :( Maybe inspiration will hit me sometime about how to make water pressure into a game, but I've been so focused on making it work, I haven't even begun to think of game ideas.
(log in to comment)
Comments
Thanks for the kind words.
Ratcave is a layer on top of pyglet, one that abstracts shaders and meshes a bit. I literally only use the shader loader, and I think if I ever publish these two things, I'd like to pull out the guts of the shader tech and replace it with my own, so it's more modular(and so coders can get away with one fewer with statements).
Unfortunately I can't get it to run using the Intel drivers on Linux, because they don't support GLSL 1.40 using the compatibility profile of OpenGL.
If I change it to request a core context:
config=pyglet.gl.Config(double_buffer=True, major_version=3, minor_version=2)
…then the shaders load but I get GL_INVALID_OPERATION errors, presumably because you are using deprecated OpenGL functions. I'll see if I can manage to get the shaders to work with GLSL 1.30, or maybe I'll try to get access to a different computer.
Also, it would be great if in the future you could put your files in a subdirectory inside the archive, rather than in the root of the archive, so that the files don't sprawl over people's downloads directory when extracted.
christopher@earthbound:~/Downloads/wavestopper$ sudo -H pip3 install requirements.txt
Collecting requirements.txt
Could not find a version that satisfies the requirement requirements.txt (from versions: )
No matching distribution found for requirements.txt
If you can't help me that's totally fine. I might just mark DNW but I hope you don't take it as criticism. I know it's not your fault that they make it so hard.
Traceback (most recent call last):
File "main.py", line 10, in <module>
main(*sys.argv[1:])
File "main.py", line 5, in main
game=GameWindow(1280, 960, image_file)
File "/tmpfs/ws/gameplay/Windows.py", line 17, in __init__
self.activeScreen=WaveStopperGame(starting_image, self.window)
File "/tmpfs/ws/gameplay/Game.py", line 66, in __init__
self.setup_initial_frame()
File "/tmpfs/ws/gameplay/Game.py", line 78, in setup_initial_frame
with UniformProvider(fire_and_forget, intexture=self.start_texture, targetColor=material.color,colorTolerance=0.1, initialStatusColors=material.initialState):
File "/tmpfs/ws/GLUtil/UniformProvider.py", line 93, in __enter__
self.SupplyValues()
File "/tmpfs/ws/GLUtil/UniformProvider.py", line 30, in SupplyValues
self.invokeSetter(location,value)
File "/tmpfs/ws/GLUtil/UniformProvider.py", line 45, in invokeSetter
gl.glUniform1i(location,self._currentTextureLocation)
File "/tmpfs/venv3.6/lib/python3.6/site-packages/pyglet/gl/lib.py", line 105, in errcheck
raise GLException(msg)
pyglet.gl.lib.GLException: b'invalid operation'
Yeah, unfortunately, debugging "GLException" is hard, and the stack trace says almost nothing.
I can see it's the first time that my code tries to talk to opengl through pyglet. My best guess without having your system to poke around in is that the shader model of 4.0 isn't supported on of your GPU/driver.
xmzhang1 on 2018/10/27 14:01:
I have to say it is really awesome, 666 :) So you just write the GLUtil module to show such effect, well, does ratcave module deal with the GLSL? I am a little confused about the relationship between pyglet and ratcave :)