My Project
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations
Target Controls

Classes

struct  GPU_Camera
 
struct  GPU_Target
 

Typedefs

typedef struct GPU_Camera GPU_Camera
 

Enumerations

enum  GPU_ComparisonEnum {
  GPU_NEVER = 0x0200 , GPU_LESS = 0x0201 , GPU_EQUAL = 0x0202 , GPU_LEQUAL = 0x0203 ,
  GPU_GREATER = 0x0204 , GPU_NOTEQUAL = 0x0205 , GPU_GEQUAL = 0x0206 , GPU_ALWAYS = 0x0207
}
 
DECLSPEC GPU_Target *SDLCALL GPU_CreateAliasTarget (GPU_Target *target)
 
DECLSPEC GPU_Target *SDLCALL GPU_LoadTarget (GPU_Image *image)
 
DECLSPEC GPU_Target *SDLCALL GPU_GetTarget (GPU_Image *image)
 
DECLSPEC void SDLCALL GPU_FreeTarget (GPU_Target *target)
 
DECLSPEC void SDLCALL GPU_SetVirtualResolution (GPU_Target *target, Uint16 w, Uint16 h)
 
DECLSPEC void SDLCALL GPU_GetVirtualResolution (GPU_Target *target, Uint16 *w, Uint16 *h)
 
DECLSPEC void SDLCALL GPU_GetVirtualCoords (GPU_Target *target, float *x, float *y, float displayX, float displayY)
 
DECLSPEC void SDLCALL GPU_UnsetVirtualResolution (GPU_Target *target)
 
DECLSPEC GPU_Rect SDLCALL GPU_MakeRect (float x, float y, float w, float h)
 
DECLSPEC SDL_Color SDLCALL GPU_MakeColor (Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 
DECLSPEC void SDLCALL GPU_SetViewport (GPU_Target *target, GPU_Rect viewport)
 
DECLSPEC void SDLCALL GPU_UnsetViewport (GPU_Target *target)
 
DECLSPEC GPU_Camera SDLCALL GPU_GetDefaultCamera (void)
 
DECLSPEC GPU_Camera SDLCALL GPU_GetCamera (GPU_Target *target)
 
DECLSPEC GPU_Camera SDLCALL GPU_SetCamera (GPU_Target *target, GPU_Camera *cam)
 
DECLSPEC void SDLCALL GPU_EnableCamera (GPU_Target *target, GPU_bool use_camera)
 
DECLSPEC GPU_bool SDLCALL GPU_IsCameraEnabled (GPU_Target *target)
 
DECLSPEC GPU_bool SDLCALL GPU_AddDepthBuffer (GPU_Target *target)
 
DECLSPEC void SDLCALL GPU_SetDepthTest (GPU_Target *target, GPU_bool enable)
 
DECLSPEC void SDLCALL GPU_SetDepthWrite (GPU_Target *target, GPU_bool enable)
 
DECLSPEC void SDLCALL GPU_SetDepthFunction (GPU_Target *target, GPU_ComparisonEnum compare_operation)
 
DECLSPEC SDL_Color SDLCALL GPU_GetPixel (GPU_Target *target, Sint16 x, Sint16 y)
 
DECLSPEC GPU_Rect SDLCALL GPU_SetClipRect (GPU_Target *target, GPU_Rect rect)
 
DECLSPEC GPU_Rect SDLCALL GPU_SetClip (GPU_Target *target, Sint16 x, Sint16 y, Uint16 w, Uint16 h)
 
DECLSPEC void SDLCALL GPU_UnsetClip (GPU_Target *target)
 
DECLSPEC GPU_bool SDLCALL GPU_IntersectRect (GPU_Rect A, GPU_Rect B, GPU_Rect *result)
 
DECLSPEC GPU_bool SDLCALL GPU_IntersectClipRect (GPU_Target *target, GPU_Rect B, GPU_Rect *result)
 
DECLSPEC void SDLCALL GPU_SetTargetColor (GPU_Target *target, SDL_Color color)
 
DECLSPEC void SDLCALL GPU_SetTargetRGB (GPU_Target *target, Uint8 r, Uint8 g, Uint8 b)
 
DECLSPEC void SDLCALL GPU_SetTargetRGBA (GPU_Target *target, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 
DECLSPEC void SDLCALL GPU_UnsetTargetColor (GPU_Target *target)
 

Detailed Description

Typedef Documentation

◆ GPU_Camera

typedef struct GPU_Camera GPU_Camera

Camera object that determines viewing transform.

See also
GPU_SetCamera()
GPU_GetDefaultCamera()
GPU_GetCamera()

Enumeration Type Documentation

◆ GPU_ComparisonEnum

Comparison operations (for depth testing)

See also
GPU_SetDepthFunction() Values chosen for direct OpenGL compatibility.

Function Documentation

◆ GPU_AddDepthBuffer()

DECLSPEC GPU_bool SDLCALL GPU_AddDepthBuffer ( GPU_Target target)

Attach a new depth buffer to the given target so that it can use depth testing. Context targets automatically have a depth buffer already. If successful, also enables depth testing for this target.

◆ GPU_CreateAliasTarget()

DECLSPEC GPU_Target *SDLCALL GPU_CreateAliasTarget ( GPU_Target target)

Creates a target that aliases the given target. Aliases can be used to store target settings (e.g. viewports) for easy switching. GPU_FreeTarget() frees the alias's memory, but does not affect the original.

◆ GPU_EnableCamera()

DECLSPEC void SDLCALL GPU_EnableCamera ( GPU_Target target,
GPU_bool  use_camera 
)

Enables or disables using the built-in camera matrix transforms.

◆ GPU_FreeTarget()

DECLSPEC void SDLCALL GPU_FreeTarget ( GPU_Target target)

Deletes a render target in the proper way for this renderer.

◆ GPU_GetCamera()

DECLSPEC GPU_Camera SDLCALL GPU_GetCamera ( GPU_Target target)
Returns
The camera of the given render target. If target is NULL, returns the default camera.

◆ GPU_GetDefaultCamera()

DECLSPEC GPU_Camera SDLCALL GPU_GetDefaultCamera ( void  )
Returns
A GPU_Camera with position (0, 0, 0), angle of 0, zoom of 1, centered origin, and near/far clipping planes of -100 and 100.

◆ GPU_GetPixel()

DECLSPEC SDL_Color SDLCALL GPU_GetPixel ( GPU_Target target,
Sint16  x,
Sint16  y 
)
Returns
The RGBA color of a pixel.

◆ GPU_GetTarget()

DECLSPEC GPU_Target *SDLCALL GPU_GetTarget ( GPU_Image image)

Creates a new render target from the given image. It can then be accessed from image->target. This does not increment the internal refcount of the target, so it will be invalidated when the image is freed.

◆ GPU_GetVirtualCoords()

DECLSPEC void SDLCALL 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).

◆ GPU_GetVirtualResolution()

DECLSPEC void SDLCALL GPU_GetVirtualResolution ( GPU_Target target,
Uint16 *  w,
Uint16 *  h 
)

Query the logical size of the given target.

◆ GPU_IntersectClipRect()

DECLSPEC GPU_bool SDLCALL 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_IntersectRect()

DECLSPEC GPU_bool SDLCALL GPU_IntersectRect ( GPU_Rect  A,
GPU_Rect  B,
GPU_Rect result 
)

Returns GPU_TRUE if the given rects A and B 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.

◆ GPU_IsCameraEnabled()

DECLSPEC GPU_bool SDLCALL GPU_IsCameraEnabled ( GPU_Target target)

Returns 1 if the camera transforms are enabled, 0 otherwise.

◆ GPU_LoadTarget()

DECLSPEC GPU_Target *SDLCALL 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().

◆ GPU_MakeColor()

DECLSPEC SDL_Color SDLCALL GPU_MakeColor ( Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)
Returns
An SDL_Color with the given values.

◆ GPU_MakeRect()

DECLSPEC GPU_Rect SDLCALL GPU_MakeRect ( float  x,
float  y,
float  w,
float  h 
)
Returns
A GPU_Rect with the given values.

◆ GPU_SetCamera()

DECLSPEC GPU_Camera SDLCALL GPU_SetCamera ( GPU_Target target,
GPU_Camera cam 
)

Sets the current render target's current camera.

Parameters
targetA pointer to the target that will copy this camera.
camA pointer to the camera data to use or NULL to use the default camera.
Returns
The old camera.

◆ GPU_SetClip()

DECLSPEC GPU_Rect SDLCALL GPU_SetClip ( GPU_Target target,
Sint16  x,
Sint16  y,
Uint16  w,
Uint16  h 
)

Sets the clipping rect for the given render target.

◆ GPU_SetClipRect()

DECLSPEC GPU_Rect SDLCALL GPU_SetClipRect ( GPU_Target target,
GPU_Rect  rect 
)

Sets the clipping rect for the given render target.

◆ GPU_SetDepthFunction()

DECLSPEC void SDLCALL GPU_SetDepthFunction ( GPU_Target target,
GPU_ComparisonEnum  compare_operation 
)

Sets the operation to perform when depth testing.

◆ GPU_SetDepthTest()

DECLSPEC void SDLCALL GPU_SetDepthTest ( GPU_Target target,
GPU_bool  enable 
)

Enables or disables the depth test, which will skip drawing pixels/fragments behind other fragments. Disabled by default. This has implications for alpha blending, where compositing might not work correctly depending on render order.

◆ GPU_SetDepthWrite()

DECLSPEC void SDLCALL GPU_SetDepthWrite ( GPU_Target target,
GPU_bool  enable 
)

Enables or disables writing the depth (effective view z-coordinate) of new pixels to the depth buffer. Enabled by default, but you must call GPU_SetDepthTest() to use it.

◆ GPU_SetTargetColor()

DECLSPEC void SDLCALL 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).

◆ GPU_SetTargetRGB()

DECLSPEC void SDLCALL 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).

◆ GPU_SetTargetRGBA()

DECLSPEC void SDLCALL 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).

◆ GPU_SetViewport()

DECLSPEC void SDLCALL GPU_SetViewport ( GPU_Target target,
GPU_Rect  viewport 
)

Sets the given target's viewport.

◆ GPU_SetVirtualResolution()

DECLSPEC void SDLCALL GPU_SetVirtualResolution ( GPU_Target target,
Uint16  w,
Uint16  h 
)

Change the logical size of the given target. Rendering to this target will be scaled as if the dimensions were actually the ones given.

◆ GPU_UnsetClip()

DECLSPEC void SDLCALL GPU_UnsetClip ( GPU_Target target)

Turns off clipping for the given target.

◆ GPU_UnsetTargetColor()

DECLSPEC void SDLCALL GPU_UnsetTargetColor ( GPU_Target target)

Unsets the modulation color for subsequent drawing of images and shapes on the given target. This has the same effect as coloring with pure opaque white (255, 255, 255, 255).

◆ GPU_UnsetViewport()

DECLSPEC void SDLCALL GPU_UnsetViewport ( GPU_Target target)

Resets the given target's viewport to the entire target area.

◆ GPU_UnsetVirtualResolution()

DECLSPEC void SDLCALL GPU_UnsetVirtualResolution ( GPU_Target target)

Reset the logical size of the given target to its original value.