Open krakengamedev opened 2 weeks ago
Hey @krakengamedev! The engine's main purpose is to render textures on the screen using shaders. To render a primitive, you can create a texture with the shape of that primitive and render it with the engine.
I just created a small example where I generate the texture of a white circle over a black background using pygame
, and then I render this texture with a shader that replaces black pixels with transparent ones and the white ones with whichever color you want. Check this out: krakengamedev.zip. You can use this method for polygons too. Instead of generating the textures with pygame
you can also have these shapes stored as .png
files and load them with load_texture
.
Lines may be a bit harder to draw. You can do it by scaling and rotating a rectangle since render
lets you apply transformations, but feels a bit hacky. I'll look into implementing primitives explicitly, I'll keep you posted. Thank you for your feedback :)
That makes sense, I was thinking the same thing myself with rendering the lines ahead of time and then applying transforms, but that's really not ideal. With the modernGL backend I would assume that primitives would be possible, but I'm not sure. Either way, thanks and keep me updated!
Is there any way to draw primitives such as lines or polygons? I don't see anything in the docs or examples on how to do this.