As the title say I want to draw 2d shadows only unsing sdl2 without openg, I have done it but the performence isnt the best,
I get like from 300fps+ to 90fps+ with 17 rectangles.
video:
Pc Spec:
Cpu i3-3110M
Gpu Nvidia 630M
Render everything in: 1280x720
when I get low fps My shadow drawing algorithm call 300+ drawing call to draw shadow for every object thats is on the screen;
to draw shadows I use triangles(still rectangle just the texture is triangle) and few rectangles pic:
In the code I calculate the position from the mouse to the rectangle ant how much should the shadow go until it reaches the screen end,the calculation doesnt hit much in performence, but the drawing is just killing everything, I need somehow to lower the drawing calls.
Does anybody know any better way to draw without OpenGL?
Some tutorials that I saw draw the light itself, but I dont know how would I do it with out OpenGL for triangle drawing.
//EDIT:
Added source and executable (you can compile the code on android too)