c++ - SDL_RenderSetClipRect works different on different platforms - how detect whether measured from top or bottom? -
i use libsdl2 , make use of cliprect.
simplified have code:
sdl_window* window = sdl_createwindow( "foo", sdl_windowpos_centered, sdl_windowpos_centered, 1024, 768, sdl_window_shown); sdl_renderer* renderer = sdl_createrenderer(window, -1, sdl_renderer_accelerated | sdl_renderer_targettexture); sdl_texture* offscreentexture = sdl_createtexture( renderer, sdl_pixelformat_rgba8888, sdl_textureaccess_target, 1024, 768); sdl_rect sdlrect = { 100, 100, 200, 200 }; sdl_rendersetcliprect(renderer, &sdlrect);
i noticed sdl_rendersetcliprect
works different on different platforms: on each 1 clipping rectangle has size of 200x200. on platforms y = 100
measured top of screen (as expected) , on platforms measured bottom.
1024 1024 |---------------------| |---------------------| | 100 | | | | ***** | | | | ***** | | | | ***** | 768 | | | | | ***** | | | | ***** | | | | ***** | | | | 100 | |---------------------| |---------------------|
why? how can tell 2 cases apart?
it seems due fixed , reopened bug of sdl.
see here further details.
trying sum discussion, due fact opengl coordinate system has (0,0) @ bottom left , sdl didn't correctly abstract on it, while sdl should give users abstraction of coherent coordinate system origin set top left.
the information in bug consistent provide response question in comment. suggest follow bug , update sdl latest upstream.
Comments
Post a Comment