I’m leafing through the LazyFoo SDL2.0 (http://lazyfoo.net/tutorials/SDL/09_the_viewport/index.php) tutorials to get a grip on all the changes from SDL1.2, and I came upon an oddity on tutorial 9 (http://lazyfoo.net/tutorials/SDL/09_the_viewport/index.php) which involves viewports. Tutorial 8 (http://lazyfoo.net/tutorials/SDL/09_the_viewport/index.php) just mentioned how the coordinate system starts in the top left of the screen and how positive is considered right and down. Okay, no problem, and whenever I put rectangles/images on the screen that is exactly what I see. But when I adjust the viewport, it behaves as if the bottom left hand of the screen is the origin! I’m running Ubuntu. Could there have been a misstep in the Ubuntu implementation of this?
The following code produ
SDL_RenderClear( gRenderer );
SDL_RenderCopy( gRenderer, myTexture, NULL, &position );
That gives this result:
[Image: http://i.imgur.com/MNJRC6W.png ]
If I change position.y=100; and position.x=100;, I get the following result:
[Image: http://i.imgur.com/XvkW40H.png ]
If I copy the LazyFoo tutorial 9 code, I get this:
[Image: http://i.imgur.com/QPCJHr9.png ]
Whereas the LazyFoo tutorial gives this image:
[Image: http://lazyfoo.net/tutorials/SDL/09_the_viewport/subviews.png ]
I have posted the full source at http://pastebin.com/YfrKcCA5. I’m not sure whether I’m being stupid, whether I’ve misunderstood the documentation somewhere, if this is evidence of a bug/misimplementation of SDL on Ubuntu, or if the Lazy Foo neglected to say that different results can be expected on different systems.