| SDL_RenderSetClipRect()/SDL_RenderGetClipRect() |
| SDL_RenderSetClipRect()/SDL_RenderGetClipRect() |
|
gabomdq
|
2013/5/4 Sam Lantinga
Two things that come up, comparing to the patch I had submitted here: http://bugzilla.libsdl.org/attachment.cgi?id=1054&action=diff (GL*_ScissorRegion functions) The definition of glScissor says: "glScissor defines a rectangle, called the scissor box, in window coordinates. The first two arguments, x and y, specify the lower left corner of the box. width and height specify the width and height of the box." So, my first comment is, why are the coordinates scaled in SDL_RenderSetClipRect ? Should you be passing windows coordinates there, or something else? Second, I think we have the convention that the rect's x,y coordinates mean the left,top in SDL. If that's the case, there needs to be a conversion to the coordinates GL uses, for example I used: static int GL_ScissorRegion(SDL_Renderer * renderer, const SDL_Rect *region) { GL_RenderData *data = (GL_RenderData *) renderer->driverdata; int w_width, w_height; SDL_GetWindowSize(renderer->window, &w_width, &w_height); data->glScissor(region->x, w_height - (region->y + region->h), region->w, region->h); return 0; } -- Gabriel. |
|||||||||||||
|
|
||||||||||||||
|
Nathaniel J Fries
|
I am glad you're finally getting to this!
|
|||||||||||
|
|
||||||||||||

