MrFrenik / gunslinger

C99, header-only framework for games and multimedia applications
BSD 3-Clause "New" or "Revised" License
1.27k stars 79 forks source link

Range fix on draw command #98

Closed Evan-Bertis-Sample closed 4 months ago

Evan-Bertis-Sample commented 4 months ago

I believe that this line is incorrect. It looks like it is supposed to correct the range given by the draw command, if it is invalid. From my interpretation, the line basically is saying:

If the end of the range was provided in the draw command description, and the range end is before the start (thus an invalid range), use the provided range end. Else, use the count provided in the description as the end.

That makes no sense imo, and goes against what I see in the openGL docs. The end of a range should never be before the start of a range.

I corrected the logic to say:

If the end of the range was provided in the draw command description, and the range end is after the start (thus valid), use the provided range end. Otherwise, calculate a new range end based on the provided count.

I was pulling my hair out trying to figure out if I was doing something wrong lol. If this is intended behavior, it is pretty confusing, and I think some comments should be added to the gs_graphics_draw_desc_t struct. Love the framework btw, using it to learn a lot about C.

MrFrenik commented 4 months ago

Good catch, you're correct, that logic is wrong on my part. Sorry for the headache and confusion on that one, and thanks for the comment and PR.