SDL_gpu
0.11.0
A hardware-accelerated, cross-platform 2D graphics API
|
#include "SDL_gpu.h"
#include "SDL_gpu_RendererImpl.h"
#include "SDL_platform.h"
#include "stb_image.h"
#include "stb_image_write.h"
#include <stdlib.h>
#include <string.h>
Go to the source code of this file.
Data Structures | |
struct | GPU_WindowMapping |
Macros | |
#define | GET_ALPHA(sdl_color) ((sdl_color).unused) |
#define | CHECK_RENDERER (_gpu_current_renderer != NULL) |
#define | MAKE_CURRENT_IF_NONE(target) do{ if(_gpu_current_renderer->current_context_target == NULL && target != NULL && target->context != NULL) GPU_MakeCurrent(target, target->context->windowID); } while(0) |
#define | CHECK_CONTEXT (_gpu_current_renderer->current_context_target != NULL) |
#define | RETURN_ERROR(code, details) do{ GPU_PushErrorCode(__func__, code, "%s", details); return; } while(0) |
#define | GPU_DEFAULT_MAX_NUM_ERRORS 20 |
#define | GPU_ERROR_FUNCTION_STRING_MAX 128 |
#define | GPU_ERROR_DETAILS_STRING_MAX 512 |
#define | GPU_INITIAL_WINDOW_MAPPINGS_SIZE 10 |
Functions | |
int | gpu_strcasecmp (const char *s1, const char *s2) |
void | gpu_init_renderer_register (void) |
void | gpu_free_renderer_register (void) |
GPU_Renderer * | gpu_create_and_add_renderer (GPU_RendererID id) |
int | gpu_default_print (GPU_LogLevelEnum log_level, const char *format, va_list args) |
SDL_version | GPU_GetLinkedVersion (void) |
void | GPU_SetCurrentRenderer (GPU_RendererID id) |
void | GPU_ResetRendererState (void) |
void | GPU_SetCoordinateMode (GPU_bool use_math_coords) |
GPU_bool | GPU_GetCoordinateMode (void) |
GPU_Renderer * | GPU_GetCurrentRenderer (void) |
Uint32 | GPU_GetCurrentShaderProgram (void) |
void | GPU_SetLogCallback (int(*callback)(GPU_LogLevelEnum log_level, const char *format, va_list args)) |
void | GPU_LogInfo (const char *format,...) |
void | GPU_LogWarning (const char *format,...) |
void | GPU_LogError (const char *format,...) |
void | GPU_SetInitWindow (Uint32 windowID) |
Uint32 | GPU_GetInitWindow (void) |
void | GPU_SetPreInitFlags (GPU_InitFlagEnum GPU_flags) |
GPU_InitFlagEnum | GPU_GetPreInitFlags (void) |
void | GPU_SetRequiredFeatures (GPU_FeatureEnum features) |
GPU_FeatureEnum | GPU_GetRequiredFeatures (void) |
void | GPU_AddWindowMapping (GPU_Target *target) |
void | GPU_RemoveWindowMapping (Uint32 windowID) |
void | GPU_RemoveWindowMappingByTarget (GPU_Target *target) |
GPU_Target * | GPU_GetWindowTarget (Uint32 windowID) |
GPU_Target * | GPU_Init (Uint16 w, Uint16 h, GPU_WindowFlagEnum SDL_flags) |
GPU_Target * | GPU_InitRenderer (GPU_RendererEnum renderer_enum, Uint16 w, Uint16 h, GPU_WindowFlagEnum SDL_flags) |
GPU_Target * | GPU_InitRendererByID (GPU_RendererID renderer_request, Uint16 w, Uint16 h, GPU_WindowFlagEnum SDL_flags) |
GPU_bool | GPU_IsFeatureEnabled (GPU_FeatureEnum feature) |
GPU_Target * | GPU_CreateTargetFromWindow (Uint32 windowID) |
GPU_Target * | GPU_CreateAliasTarget (GPU_Target *target) |
void | GPU_MakeCurrent (GPU_Target *target, Uint32 windowID) |
GPU_bool | GPU_SetFullscreen (GPU_bool enable_fullscreen, GPU_bool use_desktop_resolution) |
GPU_bool | GPU_GetFullscreen (void) |
GPU_bool | GPU_SetWindowResolution (Uint16 w, Uint16 h) |
void | GPU_GetVirtualResolution (GPU_Target *target, Uint16 *w, Uint16 *h) |
void | GPU_SetVirtualResolution (GPU_Target *target, Uint16 w, Uint16 h) |
void | GPU_UnsetVirtualResolution (GPU_Target *target) |
void | GPU_SetImageVirtualResolution (GPU_Image *image, Uint16 w, Uint16 h) |
void | GPU_UnsetImageVirtualResolution (GPU_Image *image) |
void | gpu_free_error_queue (void) |
void | GPU_SetErrorQueueMax (unsigned int max) |
void | GPU_CloseCurrentRenderer (void) |
void | GPU_Quit (void) |
void | GPU_SetDebugLevel (GPU_DebugLevelEnum level) |
GPU_DebugLevelEnum | GPU_GetDebugLevel (void) |
void | GPU_PushErrorCode (const char *function, GPU_ErrorEnum error, const char *details,...) |
GPU_ErrorObject | GPU_PopErrorCode (void) |
const char * | GPU_GetErrorString (GPU_ErrorEnum error) |
void | GPU_GetVirtualCoords (GPU_Target *target, float *x, float *y, float displayX, float displayY) |
GPU_Rect | GPU_MakeRect (float x, float y, float w, float h) |
SDL_Color | GPU_MakeColor (Uint8 r, Uint8 g, Uint8 b, Uint8 a) |
GPU_RendererID | GPU_MakeRendererID (const char *name, GPU_RendererEnum renderer, int major_version, int minor_version) |
void | GPU_SetViewport (GPU_Target *target, GPU_Rect viewport) |
void | GPU_UnsetViewport (GPU_Target *target) |
GPU_Camera | GPU_GetDefaultCamera (void) |
GPU_Camera | GPU_GetCamera (GPU_Target *target) |
GPU_Camera | GPU_SetCamera (GPU_Target *target, GPU_Camera *cam) |
void | GPU_EnableCamera (GPU_Target *target, GPU_bool use_camera) |
GPU_bool | GPU_IsCameraEnabled (GPU_Target *target) |
GPU_Image * | GPU_CreateImage (Uint16 w, Uint16 h, GPU_FormatEnum format) |
GPU_Image * | GPU_CreateImageUsingTexture (Uint32 handle, GPU_bool take_ownership) |
GPU_Image * | GPU_LoadImage (const char *filename) |
GPU_Image * | GPU_LoadImage_RW (SDL_RWops *rwops, GPU_bool free_rwops) |
GPU_Image * | GPU_CreateAliasImage (GPU_Image *image) |
GPU_bool | GPU_SaveImage (GPU_Image *image, const char *filename, GPU_FileFormatEnum format) |
GPU_bool | GPU_SaveImage_RW (GPU_Image *image, SDL_RWops *rwops, GPU_bool free_rwops, GPU_FileFormatEnum format) |
GPU_Image * | GPU_CopyImage (GPU_Image *image) |
void | GPU_UpdateImage (GPU_Image *image, const GPU_Rect *image_rect, SDL_Surface *surface, const GPU_Rect *surface_rect) |
void | GPU_UpdateImageBytes (GPU_Image *image, const GPU_Rect *image_rect, const unsigned char *bytes, int bytes_per_row) |
GPU_bool | GPU_ReplaceImage (GPU_Image *image, SDL_Surface *surface, const GPU_Rect *surface_rect) |
SDL_Surface * | GPU_LoadSurface_RW (SDL_RWops *rwops, GPU_bool free_rwops) |
SDL_Surface * | GPU_LoadSurface (const char *filename) |
GPU_bool | GPU_SaveSurface (SDL_Surface *surface, const char *filename, GPU_FileFormatEnum format) |
GPU_bool | GPU_SaveSurface_RW (SDL_Surface *surface, SDL_RWops *rwops, GPU_bool free_rwops, GPU_FileFormatEnum format) |
GPU_Image * | GPU_CopyImageFromSurface (SDL_Surface *surface) |
GPU_Image * | GPU_CopyImageFromTarget (GPU_Target *target) |
SDL_Surface * | GPU_CopySurfaceFromTarget (GPU_Target *target) |
SDL_Surface * | GPU_CopySurfaceFromImage (GPU_Image *image) |
void | GPU_FreeImage (GPU_Image *image) |
GPU_Target * | GPU_GetContextTarget (void) |
GPU_Target * | GPU_LoadTarget (GPU_Image *image) |
GPU_Target * | GPU_GetTarget (GPU_Image *image) |
void | GPU_FreeTarget (GPU_Target *target) |
void | GPU_Blit (GPU_Image *image, GPU_Rect *src_rect, GPU_Target *target, float x, float y) |
void | GPU_BlitRotate (GPU_Image *image, GPU_Rect *src_rect, GPU_Target *target, float x, float y, float degrees) |
void | GPU_BlitScale (GPU_Image *image, GPU_Rect *src_rect, GPU_Target *target, float x, float y, float scaleX, float scaleY) |
void | GPU_BlitTransform (GPU_Image *image, GPU_Rect *src_rect, GPU_Target *target, float x, float y, float degrees, float scaleX, float scaleY) |
void | GPU_BlitTransformX (GPU_Image *image, GPU_Rect *src_rect, GPU_Target *target, float x, float y, float pivot_x, float pivot_y, float degrees, float scaleX, float scaleY) |
void | GPU_BlitRect (GPU_Image *image, GPU_Rect *src_rect, GPU_Target *target, GPU_Rect *dest_rect) |
void | GPU_BlitRectX (GPU_Image *image, GPU_Rect *src_rect, GPU_Target *target, GPU_Rect *dest_rect, float degrees, float pivot_x, float pivot_y, GPU_FlipEnum flip_direction) |
void | GPU_TriangleBatch (GPU_Image *image, GPU_Target *target, unsigned short num_vertices, float *values, unsigned int num_indices, unsigned short *indices, GPU_BatchFlagEnum flags) |
void | GPU_TriangleBatchX (GPU_Image *image, GPU_Target *target, unsigned short num_vertices, void *values, unsigned int num_indices, unsigned short *indices, GPU_BatchFlagEnum flags) |
void | GPU_GenerateMipmaps (GPU_Image *image) |
GPU_Rect | GPU_SetClipRect (GPU_Target *target, GPU_Rect rect) |
GPU_Rect | GPU_SetClip (GPU_Target *target, Sint16 x, Sint16 y, Uint16 w, Uint16 h) |
void | GPU_UnsetClip (GPU_Target *target) |
GPU_bool | GPU_IntersectRect (GPU_Rect A, GPU_Rect B, GPU_Rect *result) |
GPU_bool | GPU_IntersectClipRect (GPU_Target *target, GPU_Rect B, GPU_Rect *result) |
void | GPU_SetColor (GPU_Image *image, SDL_Color color) |
void | GPU_SetRGB (GPU_Image *image, Uint8 r, Uint8 g, Uint8 b) |
void | GPU_SetRGBA (GPU_Image *image, Uint8 r, Uint8 g, Uint8 b, Uint8 a) |
void | GPU_UnsetColor (GPU_Image *image) |
void | GPU_SetTargetColor (GPU_Target *target, SDL_Color color) |
void | GPU_SetTargetRGB (GPU_Target *target, Uint8 r, Uint8 g, Uint8 b) |
void | GPU_SetTargetRGBA (GPU_Target *target, Uint8 r, Uint8 g, Uint8 b, Uint8 a) |
void | GPU_UnsetTargetColor (GPU_Target *target) |
GPU_bool | GPU_GetBlending (GPU_Image *image) |
void | GPU_SetBlending (GPU_Image *image, GPU_bool enable) |
void | GPU_SetShapeBlending (GPU_bool enable) |
GPU_BlendMode | GPU_GetBlendModeFromPreset (GPU_BlendPresetEnum preset) |
void | GPU_SetBlendFunction (GPU_Image *image, GPU_BlendFuncEnum source_color, GPU_BlendFuncEnum dest_color, GPU_BlendFuncEnum source_alpha, GPU_BlendFuncEnum dest_alpha) |
void | GPU_SetBlendEquation (GPU_Image *image, GPU_BlendEqEnum color_equation, GPU_BlendEqEnum alpha_equation) |
void | GPU_SetBlendMode (GPU_Image *image, GPU_BlendPresetEnum preset) |
void | GPU_SetShapeBlendFunction (GPU_BlendFuncEnum source_color, GPU_BlendFuncEnum dest_color, GPU_BlendFuncEnum source_alpha, GPU_BlendFuncEnum dest_alpha) |
void | GPU_SetShapeBlendEquation (GPU_BlendEqEnum color_equation, GPU_BlendEqEnum alpha_equation) |
void | GPU_SetShapeBlendMode (GPU_BlendPresetEnum preset) |
void | GPU_SetImageFilter (GPU_Image *image, GPU_FilterEnum filter) |
void | GPU_SetDefaultAnchor (float anchor_x, float anchor_y) |
void | GPU_GetDefaultAnchor (float *anchor_x, float *anchor_y) |
void | GPU_SetAnchor (GPU_Image *image, float anchor_x, float anchor_y) |
void | GPU_GetAnchor (GPU_Image *image, float *anchor_x, float *anchor_y) |
GPU_SnapEnum | GPU_GetSnapMode (GPU_Image *image) |
void | GPU_SetSnapMode (GPU_Image *image, GPU_SnapEnum mode) |
void | GPU_SetWrapMode (GPU_Image *image, GPU_WrapEnum wrap_mode_x, GPU_WrapEnum wrap_mode_y) |
SDL_Color | GPU_GetPixel (GPU_Target *target, Sint16 x, Sint16 y) |
void | GPU_Clear (GPU_Target *target) |
void | GPU_ClearColor (GPU_Target *target, SDL_Color color) |
void | GPU_ClearRGB (GPU_Target *target, Uint8 r, Uint8 g, Uint8 b) |
void | GPU_ClearRGBA (GPU_Target *target, Uint8 r, Uint8 g, Uint8 b, Uint8 a) |
void | GPU_FlushBlitBuffer (void) |
void | GPU_Flip (GPU_Target *target) |
Uint32 | GPU_CompileShader_RW (GPU_ShaderEnum shader_type, SDL_RWops *shader_source, GPU_bool free_rwops) |
Uint32 | GPU_LoadShader (GPU_ShaderEnum shader_type, const char *filename) |
Uint32 | GPU_CompileShader (GPU_ShaderEnum shader_type, const char *shader_source) |
GPU_bool | GPU_LinkShaderProgram (Uint32 program_object) |
Uint32 | GPU_CreateShaderProgram (void) |
Uint32 | GPU_LinkShaders (Uint32 shader_object1, Uint32 shader_object2) |
Uint32 | GPU_LinkManyShaders (Uint32 *shader_objects, int count) |
void | GPU_FreeShader (Uint32 shader_object) |
void | GPU_FreeShaderProgram (Uint32 program_object) |
void | GPU_AttachShader (Uint32 program_object, Uint32 shader_object) |
void | GPU_DetachShader (Uint32 program_object, Uint32 shader_object) |
GPU_bool | GPU_IsDefaultShaderProgram (Uint32 program_object) |
void | GPU_ActivateShaderProgram (Uint32 program_object, GPU_ShaderBlock *block) |
void | GPU_DeactivateShaderProgram (void) |
const char * | GPU_GetShaderMessage (void) |
int | GPU_GetAttributeLocation (Uint32 program_object, const char *attrib_name) |
GPU_AttributeFormat | GPU_MakeAttributeFormat (int num_elems_per_vertex, GPU_TypeEnum type, GPU_bool normalize, int stride_bytes, int offset_bytes) |
GPU_Attribute | GPU_MakeAttribute (int location, void *values, GPU_AttributeFormat format) |
int | GPU_GetUniformLocation (Uint32 program_object, const char *uniform_name) |
GPU_ShaderBlock | GPU_LoadShaderBlock (Uint32 program_object, const char *position_name, const char *texcoord_name, const char *color_name, const char *modelViewMatrix_name) |
void | GPU_SetShaderBlock (GPU_ShaderBlock block) |
GPU_ShaderBlock | GPU_GetShaderBlock (void) |
void | GPU_SetShaderImage (GPU_Image *image, int location, int image_unit) |
void | GPU_GetUniformiv (Uint32 program_object, int location, int *values) |
void | GPU_SetUniformi (int location, int value) |
void | GPU_SetUniformiv (int location, int num_elements_per_value, int num_values, int *values) |
void | GPU_GetUniformuiv (Uint32 program_object, int location, unsigned int *values) |
void | GPU_SetUniformui (int location, unsigned int value) |
void | GPU_SetUniformuiv (int location, int num_elements_per_value, int num_values, unsigned int *values) |
void | GPU_GetUniformfv (Uint32 program_object, int location, float *values) |
void | GPU_SetUniformf (int location, float value) |
void | GPU_SetUniformfv (int location, int num_elements_per_value, int num_values, float *values) |
void | GPU_GetUniformMatrixfv (Uint32 program_object, int location, float *values) |
void | GPU_SetUniformMatrixfv (int location, int num_matrices, int num_rows, int num_columns, GPU_bool transpose, float *values) |
void | GPU_SetAttributef (int location, float value) |
void | GPU_SetAttributei (int location, int value) |
void | GPU_SetAttributeui (int location, unsigned int value) |
void | GPU_SetAttributefv (int location, int num_elements, float *value) |
void | GPU_SetAttributeiv (int location, int num_elements, int *value) |
void | GPU_SetAttributeuiv (int location, int num_elements, unsigned int *value) |
void | GPU_SetAttributeSource (int num_values, GPU_Attribute source) |
#define CHECK_CONTEXT (_gpu_current_renderer->current_context_target != NULL) |
#define MAKE_CURRENT_IF_NONE | ( | target | ) | do{ if(_gpu_current_renderer->current_context_target == NULL && target != NULL && target->context != NULL) GPU_MakeCurrent(target, target->context->windowID); } while(0) |
#define RETURN_ERROR | ( | code, | |
details | |||
) | do{ GPU_PushErrorCode(__func__, code, "%s", details); return; } while(0) |
void GPU_ActivateShaderProgram | ( | Uint32 | program_object, |
GPU_ShaderBlock * | block | ||
) |
Activates the given shader program. Passing NULL for 'block' will disable the built-in shader variables for custom shaders until a GPU_ShaderBlock is set again.
void GPU_AddWindowMapping | ( | GPU_Target * | target | ) |
void GPU_AttachShader | ( | Uint32 | program_object, |
Uint32 | shader_object | ||
) |
void GPU_Blit | ( | GPU_Image * | image, |
GPU_Rect * | src_rect, | ||
GPU_Target * | target, | ||
float | x, | ||
float | y | ||
) |
void GPU_BlitRect | ( | GPU_Image * | image, |
GPU_Rect * | src_rect, | ||
GPU_Target * | target, | ||
GPU_Rect * | dest_rect | ||
) |
Draws the given image to the given render target, scaling it to fit the destination region.
src_rect | The region of the source image to use. Pass NULL for the entire image. |
dest_rect | The region of the destination target image to draw upon. Pass NULL for the entire target. |
void GPU_BlitRectX | ( | GPU_Image * | image, |
GPU_Rect * | src_rect, | ||
GPU_Target * | target, | ||
GPU_Rect * | dest_rect, | ||
float | degrees, | ||
float | pivot_x, | ||
float | pivot_y, | ||
GPU_FlipEnum | flip_direction | ||
) |
Draws the given image to the given render target, scaling it to fit the destination region.
src_rect | The region of the source image to use. Pass NULL for the entire image. |
dest_rect | The region of the destination target image to draw upon. Pass NULL for the entire target. |
degrees | Rotation angle (in degrees) |
pivot_x | Pivot x-position (in image coordinates) |
pivot_y | Pivot y-position (in image coordinates) |
flip_direction | A GPU_FlipEnum value (or bitwise OR'd combination) that specifies which direction the image should be flipped. |
void GPU_BlitRotate | ( | GPU_Image * | image, |
GPU_Rect * | src_rect, | ||
GPU_Target * | target, | ||
float | x, | ||
float | y, | ||
float | degrees | ||
) |
void GPU_BlitScale | ( | GPU_Image * | image, |
GPU_Rect * | src_rect, | ||
GPU_Target * | target, | ||
float | x, | ||
float | y, | ||
float | scaleX, | ||
float | scaleY | ||
) |
Scales and draws the given image to the given render target.
src_rect | The region of the source image to use. Pass NULL for the entire image. |
x | Destination x-position |
y | Destination y-position |
scaleX | Horizontal stretch factor |
scaleY | Vertical stretch factor |
void GPU_BlitTransform | ( | GPU_Image * | image, |
GPU_Rect * | src_rect, | ||
GPU_Target * | target, | ||
float | x, | ||
float | y, | ||
float | degrees, | ||
float | scaleX, | ||
float | scaleY | ||
) |
Scales, rotates, and draws the given image to the given render target.
src_rect | The region of the source image to use. Pass NULL for the entire image. |
x | Destination x-position |
y | Destination y-position |
degrees | Rotation angle (in degrees) |
scaleX | Horizontal stretch factor |
scaleY | Vertical stretch factor |
void GPU_BlitTransformX | ( | GPU_Image * | image, |
GPU_Rect * | src_rect, | ||
GPU_Target * | target, | ||
float | x, | ||
float | y, | ||
float | pivot_x, | ||
float | pivot_y, | ||
float | degrees, | ||
float | scaleX, | ||
float | scaleY | ||
) |
Scales, rotates around a pivot point, and draws the given image to the given render target. The drawing point (x, y) coincides with the pivot point on the src image (pivot_x, pivot_y).
src_rect | The region of the source image to use. Pass NULL for the entire image. |
x | Destination x-position |
y | Destination y-position |
pivot_x | Pivot x-position (in image coordinates) |
pivot_y | Pivot y-position (in image coordinates) |
degrees | Rotation angle (in degrees) |
scaleX | Horizontal stretch factor |
scaleY | Vertical stretch factor |
void GPU_ClearColor | ( | GPU_Target * | target, |
SDL_Color | color | ||
) |
void GPU_ClearRGB | ( | GPU_Target * | target, |
Uint8 | r, | ||
Uint8 | g, | ||
Uint8 | b | ||
) |
void GPU_ClearRGBA | ( | GPU_Target * | target, |
Uint8 | r, | ||
Uint8 | g, | ||
Uint8 | b, | ||
Uint8 | a | ||
) |
void GPU_CloseCurrentRenderer | ( | void | ) |
Uint32 GPU_CompileShader | ( | GPU_ShaderEnum | shader_type, |
const char * | shader_source | ||
) |
Uint32 GPU_CompileShader_RW | ( | GPU_ShaderEnum | shader_type, |
SDL_RWops * | shader_source, | ||
GPU_bool | free_rwops | ||
) |
Copy an image to a new image. Don't forget to GPU_FreeImage() both.
GPU_Image* GPU_CopyImageFromTarget | ( | GPU_Target * | target | ) |
Copy GPU_Target data into a new GPU_Image. Don't forget to GPU_FreeImage() the image.
SDL_Surface* GPU_CopySurfaceFromImage | ( | GPU_Image * | image | ) |
Copy GPU_Image data into a new SDL_Surface. Don't forget to SDL_FreeSurface() the surface and GPU_FreeImage() the image.
SDL_Surface* GPU_CopySurfaceFromTarget | ( | GPU_Target * | target | ) |
Copy GPU_Target data into a new SDL_Surface. Don't forget to SDL_FreeSurface() the surface.
GPU_Renderer* gpu_create_and_add_renderer | ( | GPU_RendererID | id | ) |
Definition at line 433 of file SDL_gpu_renderer.c.
Creates an image that aliases the given image. Aliases can be used to store image settings (e.g. modulation color) for easy switching. GPU_FreeImage() frees the alias's memory, but does not affect the original.
GPU_Target* GPU_CreateTargetFromWindow | ( | Uint32 | windowID | ) |
Creates a separate context for the given window using the current renderer and returns a GPU_Target that represents it.
void GPU_DeactivateShaderProgram | ( | void | ) |
int gpu_default_print | ( | GPU_LogLevelEnum | log_level, |
const char * | format, | ||
va_list | args | ||
) |
void GPU_DetachShader | ( | Uint32 | program_object, |
Uint32 | shader_object | ||
) |
void GPU_EnableCamera | ( | GPU_Target * | target, |
GPU_bool | use_camera | ||
) |
void GPU_Flip | ( | GPU_Target * | target | ) |
void GPU_FlushBlitBuffer | ( | void | ) |
void gpu_free_renderer_register | ( | void | ) |
Definition at line 266 of file SDL_gpu_renderer.c.
void GPU_FreeImage | ( | GPU_Image * | image | ) |
Deletes an image in the proper way for this renderer. Also deletes the corresponding GPU_Target if applicable. Be careful not to use that target afterward!
void GPU_FreeShader | ( | Uint32 | shader_object | ) |
void GPU_FreeShaderProgram | ( | Uint32 | program_object | ) |
void GPU_FreeTarget | ( | GPU_Target * | target | ) |
void GPU_GenerateMipmaps | ( | GPU_Image * | image | ) |
void GPU_GetAnchor | ( | GPU_Image * | image, |
float * | anchor_x, | ||
float * | anchor_y | ||
) |
int GPU_GetAttributeLocation | ( | Uint32 | program_object, |
const char * | attrib_name | ||
) |
GPU_BlendMode GPU_GetBlendModeFromPreset | ( | GPU_BlendPresetEnum | preset | ) |
GPU_Camera GPU_GetCamera | ( | GPU_Target * | target | ) |
GPU_Renderer* GPU_GetCurrentRenderer | ( | void | ) |
Uint32 GPU_GetCurrentShaderProgram | ( | void | ) |
GPU_DebugLevelEnum GPU_GetDebugLevel | ( | void | ) |
void GPU_GetDefaultAnchor | ( | float * | anchor_x, |
float * | anchor_y | ||
) |
Returns the default image blitting anchor through the given variables.
GPU_Camera GPU_GetDefaultCamera | ( | void | ) |
const char* GPU_GetErrorString | ( | GPU_ErrorEnum | error | ) |
GPU_bool GPU_GetFullscreen | ( | void | ) |
Uint32 GPU_GetInitWindow | ( | void | ) |
Returns the window ID that has been set via GPU_SetInitWindow().
SDL_Color GPU_GetPixel | ( | GPU_Target * | target, |
Sint16 | x, | ||
Sint16 | y | ||
) |
GPU_InitFlagEnum GPU_GetPreInitFlags | ( | void | ) |
GPU_FeatureEnum GPU_GetRequiredFeatures | ( | void | ) |
GPU_ShaderBlock GPU_GetShaderBlock | ( | void | ) |
const char* GPU_GetShaderMessage | ( | void | ) |
GPU_SnapEnum GPU_GetSnapMode | ( | GPU_Image * | image | ) |
GPU_Target* GPU_GetTarget | ( | GPU_Image * | image | ) |
void GPU_GetUniformfv | ( | Uint32 | program_object, |
int | location, | ||
float * | values | ||
) |
void GPU_GetUniformiv | ( | Uint32 | program_object, |
int | location, | ||
int * | values | ||
) |
int GPU_GetUniformLocation | ( | Uint32 | program_object, |
const char * | uniform_name | ||
) |
void GPU_GetUniformMatrixfv | ( | Uint32 | program_object, |
int | location, | ||
float * | values | ||
) |
Fills "values" with the value of the uniform shader variable at the given location. The results are identical to calling GPU_GetUniformfv(). Matrices are gotten in column-major order.
void GPU_GetUniformuiv | ( | Uint32 | program_object, |
int | location, | ||
unsigned int * | values | ||
) |
void GPU_GetVirtualCoords | ( | GPU_Target * | target, |
float * | x, | ||
float * | y, | ||
float | displayX, | ||
float | displayY | ||
) |
Converts screen space coordinates (such as from mouse input) to logical drawing coordinates. This interacts with GPU_SetCoordinateMode() when the y-axis is flipped (screen space is assumed to be inverted: (0,0) in the upper-left corner).
void GPU_GetVirtualResolution | ( | GPU_Target * | target, |
Uint16 * | w, | ||
Uint16 * | h | ||
) |
GPU_Target* GPU_GetWindowTarget | ( | Uint32 | windowID | ) |
GPU_Target* GPU_Init | ( | Uint16 | w, |
Uint16 | h, | ||
GPU_WindowFlagEnum | SDL_flags | ||
) |
Initializes SDL's video subsystem (if necessary) and all of SDL_gpu's internal structures. Chooses a renderer and creates a window with the given dimensions and window creation flags. A pointer to the resulting window's render target is returned.
w | Desired window width in pixels |
h | Desired window height in pixels |
SDL_flags | The bit flags to pass to SDL when creating the window. Use GPU_DEFAULT_INIT_FLAGS if you don't care. |
Initializes these systems: The 'error queue': Stores error codes and description strings. The 'renderer registry': An array of information about the supported renderers on the current platform, such as the renderer name and id and its life cycle functions. The SDL library and its video subsystem: Calls SDL_Init() if SDL has not already been initialized. Use SDL_InitSubsystem() to initialize more parts of SDL. The current renderer: Walks through each renderer in the renderer registry and tries to initialize them until one succeeds.
void gpu_init_renderer_register | ( | void | ) |
Definition at line 240 of file SDL_gpu_renderer.c.
GPU_Target* GPU_InitRenderer | ( | GPU_RendererEnum | renderer_enum, |
Uint16 | w, | ||
Uint16 | h, | ||
GPU_WindowFlagEnum | SDL_flags | ||
) |
GPU_Target* GPU_InitRendererByID | ( | GPU_RendererID | renderer_request, |
Uint16 | w, | ||
Uint16 | h, | ||
GPU_WindowFlagEnum | SDL_flags | ||
) |
Initializes SDL and SDL_gpu. Creates a window and the requested renderer context. By requesting a renderer via ID, you can specify the major and minor versions of an individual renderer backend.
GPU_bool GPU_IntersectClipRect | ( | GPU_Target * | target, |
GPU_Rect | B, | ||
GPU_Rect * | result | ||
) |
Returns GPU_TRUE if the given target's clip rect and the given B rect overlap, in which case it also fills the given result rect with the intersection. result
can be NULL if you don't need the intersection. If the target doesn't have a clip rect enabled, this uses the whole target area.
GPU_bool GPU_IsCameraEnabled | ( | GPU_Target * | target | ) |
GPU_bool GPU_IsDefaultShaderProgram | ( | Uint32 | program_object | ) |
GPU_bool GPU_IsFeatureEnabled | ( | GPU_FeatureEnum | feature | ) |
Checks for important GPU features which may not be supported depending on a device's extension support. Feature flags (GPU_FEATURE_*) can be bitwise OR'd together.
Uint32 GPU_LinkManyShaders | ( | Uint32 * | shader_objects, |
int | count | ||
) |
GPU_bool GPU_LinkShaderProgram | ( | Uint32 | program_object | ) |
Uint32 GPU_LinkShaders | ( | Uint32 | shader_object1, |
Uint32 | shader_object2 | ||
) |
GPU_Image* GPU_LoadImage | ( | const char * | filename | ) |
Load image from an image file that is supported by this renderer. Don't forget to GPU_FreeImage() it.
Load image from an image file in memory. Don't forget to GPU_FreeImage() it.
Uint32 GPU_LoadShader | ( | GPU_ShaderEnum | shader_type, |
const char * | filename | ||
) |
GPU_ShaderBlock GPU_LoadShaderBlock | ( | Uint32 | program_object, |
const char * | position_name, | ||
const char * | texcoord_name, | ||
const char * | color_name, | ||
const char * | modelViewMatrix_name | ||
) |
SDL_Surface* GPU_LoadSurface_RW | ( | SDL_RWops * | rwops, |
GPU_bool | free_rwops | ||
) |
GPU_Target* GPU_LoadTarget | ( | GPU_Image * | image | ) |
Creates a new render target from the given image. It can then be accessed from image->target. This increments the internal refcount of the target, so it should be matched with a GPU_FreeTarget().
void GPU_LogError | ( | const char * | format, |
... | |||
) |
void GPU_LogInfo | ( | const char * | format, |
... | |||
) |
void GPU_LogWarning | ( | const char * | format, |
... | |||
) |
GPU_Attribute GPU_MakeAttribute | ( | int | location, |
void * | values, | ||
GPU_AttributeFormat | format | ||
) |
Returns a filled GPU_Attribute object.
GPU_AttributeFormat GPU_MakeAttributeFormat | ( | int | num_elems_per_vertex, |
GPU_TypeEnum | type, | ||
GPU_bool | normalize, | ||
int | stride_bytes, | ||
int | offset_bytes | ||
) |
Returns a filled GPU_AttributeFormat object.
SDL_Color GPU_MakeColor | ( | Uint8 | r, |
Uint8 | g, | ||
Uint8 | b, | ||
Uint8 | a | ||
) |
void GPU_MakeCurrent | ( | GPU_Target * | target, |
Uint32 | windowID | ||
) |
GPU_Rect GPU_MakeRect | ( | float | x, |
float | y, | ||
float | w, | ||
float | h | ||
) |
GPU_ErrorObject GPU_PopErrorCode | ( | void | ) |
void GPU_PushErrorCode | ( | const char * | function, |
GPU_ErrorEnum | error, | ||
const char * | details, | ||
... | |||
) |
Pushes a new error code into the error queue. If the queue is full, the queue is not modified.
function | The name of the function that pushed the error |
error | The error code to push on the error queue |
details | Additional information string, can be NULL. |
void GPU_Quit | ( | void | ) |
void GPU_RemoveWindowMappingByTarget | ( | GPU_Target * | target | ) |
void GPU_ResetRendererState | ( | void | ) |
GPU_bool GPU_SaveImage | ( | GPU_Image * | image, |
const char * | filename, | ||
GPU_FileFormatEnum | format | ||
) |
GPU_bool GPU_SaveImage_RW | ( | GPU_Image * | image, |
SDL_RWops * | rwops, | ||
GPU_bool | free_rwops, | ||
GPU_FileFormatEnum | format | ||
) |
GPU_bool GPU_SaveSurface | ( | SDL_Surface * | surface, |
const char * | filename, | ||
GPU_FileFormatEnum | format | ||
) |
GPU_bool GPU_SaveSurface_RW | ( | SDL_Surface * | surface, |
SDL_RWops * | rwops, | ||
GPU_bool | free_rwops, | ||
GPU_FileFormatEnum | format | ||
) |
void GPU_SetAnchor | ( | GPU_Image * | image, |
float | anchor_x, | ||
float | anchor_y | ||
) |
void GPU_SetAttributef | ( | int | location, |
float | value | ||
) |
void GPU_SetAttributefv | ( | int | location, |
int | num_elements, | ||
float * | value | ||
) |
void GPU_SetAttributei | ( | int | location, |
int | value | ||
) |
void GPU_SetAttributeiv | ( | int | location, |
int | num_elements, | ||
int * | value | ||
) |
void GPU_SetAttributeSource | ( | int | num_values, |
GPU_Attribute | source | ||
) |
void GPU_SetAttributeui | ( | int | location, |
unsigned int | value | ||
) |
void GPU_SetAttributeuiv | ( | int | location, |
int | num_elements, | ||
unsigned int * | value | ||
) |
void GPU_SetBlendEquation | ( | GPU_Image * | image, |
GPU_BlendEqEnum | color_equation, | ||
GPU_BlendEqEnum | alpha_equation | ||
) |
void GPU_SetBlendFunction | ( | GPU_Image * | image, |
GPU_BlendFuncEnum | source_color, | ||
GPU_BlendFuncEnum | dest_color, | ||
GPU_BlendFuncEnum | source_alpha, | ||
GPU_BlendFuncEnum | dest_alpha | ||
) |
void GPU_SetBlendMode | ( | GPU_Image * | image, |
GPU_BlendPresetEnum | mode | ||
) |
GPU_Camera GPU_SetCamera | ( | GPU_Target * | target, |
GPU_Camera * | cam | ||
) |
GPU_Rect GPU_SetClip | ( | GPU_Target * | target, |
Sint16 | x, | ||
Sint16 | y, | ||
Uint16 | w, | ||
Uint16 | h | ||
) |
GPU_Rect GPU_SetClipRect | ( | GPU_Target * | target, |
GPU_Rect | rect | ||
) |
void GPU_SetColor | ( | GPU_Image * | image, |
SDL_Color | color | ||
) |
void GPU_SetCoordinateMode | ( | GPU_bool | use_math_coords | ) |
Sets the coordinate mode for this renderer. Target and image coordinates will be either "inverted" (0,0 is the upper left corner, y increases downward) or "mathematical" (0,0 is the bottom-left corner, y increases upward). The default is inverted (0), as this is traditional for 2D graphics.
inverted | 0 is for inverted coordinates, 1 is for mathematical coordinates |
void GPU_SetCurrentRenderer | ( | GPU_RendererID | id | ) |
void GPU_SetDefaultAnchor | ( | float | anchor_x, |
float | anchor_y | ||
) |
Sets the default image blitting anchor for newly created images.
void GPU_SetErrorQueueMax | ( | unsigned int | max | ) |
Enable/disable fullscreen mode for the current context target's window. On some platforms, this may destroy the renderer context and require that textures be reloaded. Unfortunately, SDL does not provide a notification mechanism for this.
enable_fullscreen | If true, make the application go fullscreen. If false, make the application go to windowed mode. |
use_desktop_resolution | If true, lets the window change its resolution when it enters fullscreen mode (via SDL_WINDOW_FULLSCREEN_DESKTOP). |
void GPU_SetImageFilter | ( | GPU_Image * | image, |
GPU_FilterEnum | filter | ||
) |
void GPU_SetImageVirtualResolution | ( | GPU_Image * | image, |
Uint16 | w, | ||
Uint16 | h | ||
) |
void GPU_SetInitWindow | ( | Uint32 | windowID | ) |
void GPU_SetLogCallback | ( | int(*)(GPU_LogLevelEnum log_level, const char *format, va_list args) | callback | ) |
void GPU_SetPreInitFlags | ( | GPU_InitFlagEnum | GPU_flags | ) |
Set special flags to use for initialization. Set these before calling GPU_Init().
GPU_flags | An OR'ed combination of GPU_InitFlagEnum flags. Default flags (0) enable late swap vsync and double buffering. |
void GPU_SetRequiredFeatures | ( | GPU_FeatureEnum | features | ) |
Set required features to use for initialization. Set these before calling GPU_Init().
features | An OR'ed combination of GPU_FeatureEnum flags. Required features will force GPU_Init() to create a renderer that supports all of the given flags or else fail. |
void GPU_SetRGB | ( | GPU_Image * | image, |
Uint8 | r, | ||
Uint8 | g, | ||
Uint8 | b | ||
) |
void GPU_SetRGBA | ( | GPU_Image * | image, |
Uint8 | r, | ||
Uint8 | g, | ||
Uint8 | b, | ||
Uint8 | a | ||
) |
void GPU_SetShaderBlock | ( | GPU_ShaderBlock | block | ) |
void GPU_SetShaderImage | ( | GPU_Image * | image, |
int | location, | ||
int | image_unit | ||
) |
Sets the given image unit to the given image so that a custom shader can sample multiple textures.
image | The source image/texture. Pass NULL to disable the image unit. |
location | The uniform location of a texture sampler |
image_unit | The index of the texture unit to set. 0 is the first unit, which is used by SDL_gpu's blitting functions. 1 would be the second unit. |
void GPU_SetShapeBlendEquation | ( | GPU_BlendEqEnum | color_equation, |
GPU_BlendEqEnum | alpha_equation | ||
) |
void GPU_SetShapeBlendFunction | ( | GPU_BlendFuncEnum | source_color, |
GPU_BlendFuncEnum | dest_color, | ||
GPU_BlendFuncEnum | source_alpha, | ||
GPU_BlendFuncEnum | dest_alpha | ||
) |
void GPU_SetShapeBlending | ( | GPU_bool | enable | ) |
void GPU_SetShapeBlendMode | ( | GPU_BlendPresetEnum | mode | ) |
void GPU_SetSnapMode | ( | GPU_Image * | image, |
GPU_SnapEnum | mode | ||
) |
void GPU_SetTargetColor | ( | GPU_Target * | target, |
SDL_Color | color | ||
) |
Sets the modulation color for subsequent drawing of images and shapes on the given target. This has a cumulative effect with the image coloring functions. e.g. GPU_SetRGB(image, 255, 128, 0); GPU_SetTargetRGB(target, 128, 128, 128); Would make the image draw with color of roughly (128, 64, 0).
void GPU_SetTargetRGB | ( | GPU_Target * | target, |
Uint8 | r, | ||
Uint8 | g, | ||
Uint8 | b | ||
) |
Sets the modulation color for subsequent drawing of images and shapes on the given target. This has a cumulative effect with the image coloring functions. e.g. GPU_SetRGB(image, 255, 128, 0); GPU_SetTargetRGB(target, 128, 128, 128); Would make the image draw with color of roughly (128, 64, 0).
void GPU_SetTargetRGBA | ( | GPU_Target * | target, |
Uint8 | r, | ||
Uint8 | g, | ||
Uint8 | b, | ||
Uint8 | a | ||
) |
Sets the modulation color for subsequent drawing of images and shapes on the given target. This has a cumulative effect with the image coloring functions. e.g. GPU_SetRGB(image, 255, 128, 0); GPU_SetTargetRGB(target, 128, 128, 128); Would make the image draw with color of roughly (128, 64, 0).
void GPU_SetUniformf | ( | int | location, |
float | value | ||
) |
void GPU_SetUniformfv | ( | int | location, |
int | num_elements_per_value, | ||
int | num_values, | ||
float * | values | ||
) |
void GPU_SetUniformi | ( | int | location, |
int | value | ||
) |
void GPU_SetUniformiv | ( | int | location, |
int | num_elements_per_value, | ||
int | num_values, | ||
int * | values | ||
) |
void GPU_SetUniformMatrixfv | ( | int | location, |
int | num_matrices, | ||
int | num_rows, | ||
int | num_columns, | ||
GPU_bool | transpose, | ||
float * | values | ||
) |
void GPU_SetUniformui | ( | int | location, |
unsigned int | value | ||
) |
void GPU_SetUniformuiv | ( | int | location, |
int | num_elements_per_value, | ||
int | num_values, | ||
unsigned int * | values | ||
) |
void GPU_SetViewport | ( | GPU_Target * | target, |
GPU_Rect | viewport | ||
) |
void GPU_SetVirtualResolution | ( | GPU_Target * | target, |
Uint16 | w, | ||
Uint16 | h | ||
) |
GPU_bool GPU_SetWindowResolution | ( | Uint16 | w, |
Uint16 | h | ||
) |
Change the actual size of the current context target's window. This resets the virtual resolution and viewport of the context target. Aside from direct resolution changes, this should also be called in response to SDL_WINDOWEVENT_RESIZED window events for resizable windows.
void GPU_SetWrapMode | ( | GPU_Image * | image, |
GPU_WrapEnum | wrap_mode_x, | ||
GPU_WrapEnum | wrap_mode_y | ||
) |
void GPU_TriangleBatch | ( | GPU_Image * | image, |
GPU_Target * | target, | ||
unsigned short | num_vertices, | ||
float * | values, | ||
unsigned int | num_indices, | ||
unsigned short * | indices, | ||
GPU_BatchFlagEnum | flags | ||
) |
Renders triangles from the given set of vertices. This lets you render arbitrary 2D geometry. It is a direct path to the GPU, so the format is different than typical SDL_gpu calls.
values | A tightly-packed array of vertex position (e.g. x,y), texture coordinates (e.g. s,t), and color (e.g. r,g,b,a) values. Texture coordinates and color values are expected to be already normalized to 0.0 - 1.0. Pass NULL to render with only custom shader attributes. |
indices | If not NULL, this is used to specify which vertices to use and in what order (i.e. it indexes the vertices in the 'values' array). |
flags | Bit flags to control the interpretation of the 'values' array parameters. |
void GPU_TriangleBatchX | ( | GPU_Image * | image, |
GPU_Target * | target, | ||
unsigned short | num_vertices, | ||
void * | values, | ||
unsigned int | num_indices, | ||
unsigned short * | indices, | ||
GPU_BatchFlagEnum | flags | ||
) |
Renders triangles from the given set of vertices. This lets you render arbitrary 2D geometry. It is a direct path to the GPU, so the format is different than typical SDL_gpu calls.
values | A tightly-packed array of vertex position (e.g. x,y), texture coordinates (e.g. s,t), and color (e.g. r,g,b,a) values. Texture coordinates and color values are expected to be already normalized to 0.0 - 1.0 (or 0 - 255 for 8-bit color components). Pass NULL to render with only custom shader attributes. |
indices | If not NULL, this is used to specify which vertices to use and in what order (i.e. it indexes the vertices in the 'values' array). |
flags | Bit flags to control the interpretation of the 'values' array parameters. |
void GPU_UnsetClip | ( | GPU_Target * | target | ) |
void GPU_UnsetColor | ( | GPU_Image * | image | ) |
void GPU_UnsetImageVirtualResolution | ( | GPU_Image * | image | ) |
void GPU_UnsetTargetColor | ( | GPU_Target * | target | ) |
void GPU_UnsetViewport | ( | GPU_Target * | target | ) |
void GPU_UnsetVirtualResolution | ( | GPU_Target * | target | ) |