···11+# Downloads #
22+33+The latest release of SDL\_gpu is version 0.10.0 (2/11/2015). You can get it here:
44+> SDL 2.0:
55+ * [SDL2\_gpu 0.10.0, Windows - Visual Studio](https://sdl-gpu.googlecode.com/svn/builds/SDL2_gpu-0.10.0-msvc.zip)
66+ * [SDL2\_gpu 0.10.0, Windows - MinGW32](https://sdl-gpu.googlecode.com/svn/builds/SDL2_gpu-0.10.0-mingw32.zip)
77+> SDL 1.2:
88+ * [SDL\_gpu 0.10.0, Windows - MinGW32](https://sdl-gpu.googlecode.com/svn/builds/SDL_gpu-0.10.0-mingw32.zip)
99+1010+For other builds, check the ['builds' directory](https://code.google.com/p/sdl-gpu/source/browse/#svn%2Fbuilds) in the repository.
+72
ImplementationNotes.md
···11+# Introduction #
22+33+This page contains notes that explain or argue the implementation details of the library. If you have anything to say about them, let us know!
44+55+66+# Notes #
77+88+Couldn't there be GPU\_BLEND\_NONE instead of GPU\_Image::use\_blending?
99+> Yeah, that is what SDL2 does. However, I feel that the separation is a useful and intuitive convention. It separates "how" blending is done (blend mode) from "whether" it is done (use\_blending). To combine them would be to change the abstraction to "pixel transfer mode".
1010+1111+Clearing new blank textures.
1212+> glClearTexImage() extension is very new, so not well supported.
1313+> Clearing via upload works but is a little slower.
1414+> > Allocate a zeroed array and grow it when more is needed.
1515+1616+Rendering to intermediate buffer that has an odd dimension size will blur the result a little. I think the rule should be: If you want pixel-perfect, don't use odd sizes!
1717+1818+GPU\_Init() sets an empty window caption. It's not a big deal to change after init by using target->context->window\_id, so adding stuff to SDL\_gpu to do it would just be unnecessary. Maybe GPU\_GetWindowID().
1919+2020+Making every shape able to be textured would mean either a lot of assumptions about the texture coordinates or else a few extra function arguments to specify the texture coordinates and number of vertices to use (which would also lead to ambiguity). The current functions are only untextured and their number of vertices is not specified (which makes shader attributes not work reliably with them). The best way to texture shapes is to write your own textured shape functions using GPU\_TriangleBatch().
2121+2222+Attributes
2323+2424+> Don't try to use expanded (per-sprite) attributes for positions or texcoords... You would have 4 vertices on top of each other for each sprite.
2525+2626+Shader blocks
2727+> Used to pass default shader variables (attributes and a uniform) to the shader.
2828+> Has 3 default attributes: position, color, texcoords. Has 1 default uniform: gpu\_ModelViewProjectionMatrix. These are handled by the blit buffer and flush.
2929+3030+State contained in images:
3131+> Pixel descriptors
3232+> > width, height
3333+> > channels
3434+3535+> Modulation color (GPU\_SetRGBA())
3636+> Blending on/off (GPU\_SetBlending())
3737+> Blend mode (GPU\_SetBlendMode())
3838+3939+State contained in render targets:
4040+> Camera transform (via matrix stack for GL 3+)
4141+> Virtual width and height
4242+> Framebuffer width and height (duplicated from image or window)
4343+> Clipping rect
4444+> Modulation color (GPU\_SetTargetRGBA())
4545+4646+State contained in context targets:
4747+> Current shader
4848+> Default shaders
4949+> Blit buffer
5050+> Window ID
5151+> Shape blending
5252+> Shape blend mode
5353+> Line thickness (GPU\_SetThickness())
5454+> GL Context (SDL\_GLContext is just a void`*`)
5555+> Matrix stack
5656+5757+State contained in renderer:
5858+> Renderer ID
5959+> Renderer tier
6060+> Renderer features
6161+> Current context target
6262+6363+Windowless OpenGL context would be useful for triggering renderer init failure, but it gets messy and platform-specific.
6464+6565+FlushBlitBuffer() uses GL\_TRIANGLES instead of a fan or strip because a single glDrawArrays/glDrawElements call can't draw separate strips. Thankfully, I can use an index buffer to reduce the vertex count back to 4, instead of the 6 that two triangles would normally use.
6666+6767+GLES does not support GL\_UNPACK\_ROW\_LENGTH, which is a shame. It means that if image data is not tightly-packed, it has to be re-copied into a tightly-packed array first. This makes the GL and GLES renderers do loading/updating images in slightly different ways. I think there's a GLES2 extension for it though, so that might be worth looking into.
6868+6969+Multiple windows can be done in two ways:
7070+ 1. GPU\_CreateTargetFromWindow() creates a separate context for rendering, shaders, and textures.
7171+> 2) GPU\_MakeCurrent() can be used to switch the window of a GPU\_Target in order to share a context between windows.
7272+> What about SDL\_GL\_SHARE\_WITH\_CURRENT\_CONTEXT?
+34
MainPage.md
···11+# What is it? #
22+33+SDL\_gpu is a rendering system for SDL 1.2 and SDL 2.0 (http://libsdl.org/) that presents a powerful hardware-accelerated API for 2D applications and games. The source code is portable to a variety of platforms which have SDL and OpenGL support, including Windows, Mac OS X, Linux, iOS, and Android. The library and demos can be built for most platforms by using CMake (http://www.cmake.org/).
44+55+66+# Where do I get it? #
77+88+Binary builds are available in the 'builds' directory of the repository:
99+https://code.google.com/p/sdl-gpu/source/browse/#svn%2Fbuilds
1010+1111+If you want to build the source yourself, just grab a copy of the repository via SVN. See the [README](https://sdl-gpu.googlecode.com/svn/trunk/README.txt) for details.
1212+1313+1414+# How do I use it? #
1515+1616+## Tutorials ##
1717+1818+DinoMage Games has produced a simple tutorial for getting a sprite on the screen with SDL\_gpu:
1919+http://www.dinomage.com/2015/01/sdl_gpu-simple-tutorial/
2020+2121+## Demos ##
2222+2323+The demos directory contains a suite of test programs for the various available features. Perusing these demos is the best way to get a feel for what SDL\_gpu can do. The "init" demo is the base project for many of the other demos, so it is a good place to start.
2424+2525+2626+## Documentation ##
2727+2828+SDL\_gpu is currently in feature development. As such, features are liable to be added or changed in the future. This means that the documentation is also changing. The header comments are kept up-to-date, so the best documentation can be generated directly via Doxygen. However, you can find pregenerated documentation in the source repository or online at:
2929+http://dinomage.com/reference/SDL_gpu/
3030+3131+3232+# How am I allowed to use it? #
3333+3434+Pretty much any way you want! The source code is distributed under the very permissive MIT license. You are free to do much with the source code including study and reuse. See the [LICENSE](https://sdl-gpu.googlecode.com/svn/trunk/LICENSE.txt) for details.
+18
ProjectHome.md
···11+SDL\_gpu is a C library based on SDL that makes hardware-accelerated 2D graphics easy. It is intended as an alternative to SDL\_Renderer with modern features which may not belong in the SDL core.
22+33+Features:
44+ * Cross-platform (tested on Windows, Mac, Linux, iOS, and Android)
55+ * Works with SDL 1.2 and SDL 2.0 - Great for transitioning to SDL2
66+ * Simple initialization
77+ * Virtual resolution control to separate drawing logic from display resolution
88+ * Image loading of popular image formats and from SDL\_Surfaces
99+ * Render-to-texture
1010+ * Clear abstraction for textures (GPU\_Image) and render targets (GPU\_Target)
1111+ * Rotation and scaling
1212+ * Primitive shape rendering (points, lines, circles, polygons, etc.)
1313+ * Integration with native API (e.g. OpenGL) calls
1414+ * 2D camera control
1515+ * Custom renderer support
1616+1717+You can get it at the [Downloads](https://code.google.com/p/sdl-gpu/wiki/Downloads) page.
1818+Want to see more? Check out the [Wiki](https://code.google.com/p/sdl-gpu/wiki/MainPage)!
+25
RoadMap.md
···11+# Versions #
22+33+1.0.0 (future)
44+> Needs your help! Feedback on the current version is great! Patches welcome!
55+66+0.10.0 (2/5/14)
77+> Better native API call integration. Custom renderer support.
88+99+0.9.0 (10/22/14)
1010+> Pixel snapping. Header cleanup and build system improvements.
1111+1212+0.8.0 (3/6/14)
1313+> First binary release. Renderers for OpenGL 1/2/3 and GL ES 1/2.
1414+1515+0.0.0 (1/4/12)
1616+> Public project created. Basic fixed-function OpenGL renderer to render to screen with rotation and scaling.
1717+1818+# Wishlist #
1919+2020+ * Direct3D renderer(s)
2121+ * Wrapping modes for image atlases and power-of-two based textures
2222+ * Bezier shape rendering
2323+ * Support 1-channel and 2-channel textures (for shader access)
2424+ * Support video texture formats (YUV of some sort)
2525+ * Multi-target rendering