Functions
rs_graphics.rsh File Reference
#include "rs_mesh.rsh"
#include "rs_program.rsh"

Functions

void  rsgBindProgramFragment (rs_program_fragment pf)
void  rsgBindProgramStore (rs_program_store ps)
void  rsgBindProgramVertex (rs_program_vertex pv)
void  rsgBindProgramRaster (rs_program_raster pr)
void  rsgBindSampler (rs_program_fragment, uint slot, rs_sampler)
void  rsgBindTexture (rs_program_fragment, uint slot, rs_allocation)
void  rsgProgramVertexLoadProjectionMatrix (const rs_matrix4x4 *proj)
void  rsgProgramVertexLoadModelMatrix (const rs_matrix4x4 *model)
void  rsgProgramVertexLoadTextureMatrix (const rs_matrix4x4 *tex)
void  rsgProgramVertexGetProjectionMatrix (rs_matrix4x4 *proj)
void  rsgProgramFragmentConstantColor (rs_program_fragment pf, float r, float g, float b, float a)
void  rsgBindConstant (rs_program_fragment ps, uint slot, rs_allocation c)
void  rsgBindConstant (rs_program_vertex pv, uint slot, rs_allocation c)
uint  rsgGetWidth (void)
uint  rsgGetHeight (void)
void  rsgAllocationSyncAll (rs_allocation alloc)
void  rsgDrawRect (float x1, float y1, float x2, float y2, float z)
void  rsgDrawQuad (float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4)
void  rsgDrawQuadTexCoords (float x1, float y1, float z1, float u1, float v1, float x2, float y2, float z2, float u2, float v2, float x3, float y3, float z3, float u3, float v3, float x4, float y4, float z4, float u4, float v4)
void  rsgDrawSpriteScreenspace (float x, float y, float z, float w, float h)
void  rsgDrawMesh (rs_mesh ism)
void  rsgDrawMesh (rs_mesh ism, uint primitiveIndex)
void  rsgDrawMesh (rs_mesh ism, uint primitiveIndex, uint start, uint len)
void  rsgClearColor (float r, float g, float b, float a)
void  rsgClearDepth (float value)
void  rsgDrawText (const char *, int x, int y)
void  rsgDrawText (rs_allocation, int x, int y)
void  rsgBindFont (rs_font font)
void  rsgFontColor (float r, float g, float b, float a)
void  rsgMeasureText (const char *, int *left, int *right, int *top, int *bottom)
void  rsgMeasureText (rs_allocation, int *left, int *right, int *top, int *bottom)
void  rsgMeshComputeBoundingBox (rs_mesh mesh, float *minX, float *minY, float *minZ, float *maxX, float *maxY, float *maxZ)
static __inline__ void  rsgMeshComputeBoundingBox (rs_mesh mesh, float3 *bBoxMin, float3 *bBoxMax)

Detailed Description

Renderscript graphics API.

A set of graphics functions used by Renderscript.

Definition in file rs_graphics.rsh.


Function Documentation

void rsgAllocationSyncAll ( rs_allocation  alloc )

Sync the contents of an allocation from its SCRIPT memory space to its HW memory spaces.

Parameters:
alloc
void rsgBindConstant ( rs_program_fragment  ps,
uint  slot,
rs_allocation  c 
)

Bind a new Allocation object to a ProgramFragment. The Allocation must be a valid constant input for the Program.

Parameters:
ps program object
slot index of the constant buffer on the program
c constants to bind
void rsgBindConstant ( rs_program_vertex  pv,
uint  slot,
rs_allocation  c 
)

Bind a new Allocation object to a ProgramVertex. The Allocation must be a valid constant input for the Program.

Parameters:
pv program object
slot index of the constant buffer on the program
c constants to bind
void rsgBindFont ( rs_font  font )

Binds the font object to be used for all subsequent font rendering calls

Parameters:
font object to bind
void rsgBindProgramFragment ( rs_program_fragment  pf )

Bind a new ProgramFragment to the rendering context.

Parameters:
pf
void rsgBindProgramRaster ( rs_program_raster  pr )

Bind a new ProgramRaster to the rendering context.

Parameters:
pr
void rsgBindProgramStore ( rs_program_store  ps )

Bind a new ProgramStore to the rendering context.

Parameters:
ps
void rsgBindProgramVertex ( rs_program_vertex  pv )

Bind a new ProgramVertex to the rendering context.

Parameters:
pv
void rsgBindSampler ( rs_program_fragment  ,
uint  slot,
rs_sampler   
)

Bind a new Sampler object to a ProgramFragment. The sampler will operate on the texture bound at the matching slot.

Parameters:
slot
void rsgBindTexture ( rs_program_fragment  ,
uint  slot,
rs_allocation   
)

Bind a new Allocation object to a ProgramFragment. The Allocation must be a valid texture for the Program. The sampling of the texture will be controled by the Sampler bound at the matching slot.

Parameters:
slot
void rsgClearColor ( float  r,
float  g,
float  b,
float  a 
)

Clears the rendering surface to the specified color.

Parameters:
r
g
b
a
void rsgClearDepth ( float  value )

Clears the depth suface to the specified value.

void rsgDrawMesh ( rs_mesh  ism )

Draw a mesh using the current context state. The whole mesh is rendered.

Parameters:
ism
void rsgDrawMesh ( rs_mesh  ism,
uint  primitiveIndex 
)

Draw part of a mesh using the current context state.

Parameters:
ism mesh object to render
primitiveIndex for meshes that contain multiple primitive groups this parameter specifies the index of the group to draw.
void rsgDrawMesh ( rs_mesh  ism,
uint  primitiveIndex,
uint  start,
uint  len 
)

Draw specified index range of part of a mesh using the current context state.

Parameters:
ism mesh object to render
primitiveIndex for meshes that contain multiple primitive groups this parameter specifies the index of the group to draw.
start starting index in the range
len number of indices to draw
void rsgDrawQuad ( float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2,
float  x3,
float  y3,
float  z3,
float  x4,
float  y4,
float  z4 
)

Low performance utility function for drawing a simple quad. Not intended for drawing large quantities of geometry.

Parameters:
x1
y1
z1
x2
y2
z2
x3
y3
z3
x4
y4
z4
void rsgDrawQuadTexCoords ( float  x1,
float  y1,
float  z1,
float  u1,
float  v1,
float  x2,
float  y2,
float  z2,
float  u2,
float  v2,
float  x3,
float  y3,
float  z3,
float  u3,
float  v3,
float  x4,
float  y4,
float  z4,
float  u4,
float  v4 
)

Low performance utility function for drawing a textured quad. Not intended for drawing large quantities of geometry.

Parameters:
x1
y1
z1
u1
v1
x2
y2
z2
u2
v2
x3
y3
z3
u3
v3
x4
y4
z4
u4
v4
void rsgDrawRect ( float  x1,
float  y1,
float  x2,
float  y2,
float  z 
)

Low performance utility function for drawing a simple rectangle. Not intended for drawing large quantities of geometry.

Parameters:
x1
y1
x2
y2
z
void rsgDrawSpriteScreenspace ( float  x,
float  y,
float  z,
float  w,
float  h 
)

Low performance function for drawing rectangles in screenspace. This function uses the default passthough ProgramVertex. Any bound ProgramVertex is ignored. This function has considerable overhead and should not be used for drawing in shipping applications.

Parameters:
x
y
z
w
h
void rsgDrawText ( const char *  ,
int  x,
int  y 
)

Draws text given a string and location

void rsgDrawText ( rs_allocation  ,
int  x,
int  y 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void rsgFontColor ( float  r,
float  g,
float  b,
float  a 
)

Sets the font color for all subsequent rendering calls

Parameters:
r red component
g green component
b blue component
a alpha component
uint rsgGetHeight ( void  )

Get the height of the current rendering surface.

Returns:
uint
uint rsgGetWidth ( void  )

Get the width of the current rendering surface.

Returns:
uint
void rsgMeasureText ( const char *  ,
int *  left,
int *  right,
int *  top,
int *  bottom 
)

Returns the bounding box of the text relative to (0, 0) Any of left, right, top, bottom could be NULL

void rsgMeasureText ( rs_allocation  ,
int *  left,
int *  right,
int *  top,
int *  bottom 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void rsgMeshComputeBoundingBox ( rs_mesh  mesh,
float *  minX,
float *  minY,
float *  minZ,
float *  maxX,
float *  maxY,
float *  maxZ 
)

Computes an axis aligned bounding box of a mesh object

static __inline__ void rsgMeshComputeBoundingBox ( rs_mesh  mesh,
float3 bBoxMin,
float3 bBoxMax 
) [static]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 409 of file rs_graphics.rsh.

void rsgProgramFragmentConstantColor ( rs_program_fragment  pf,
float  r,
float  g,
float  b,
float  a 
)

Set the constant color for a fixed function emulation program.

Parameters:
pf
r
g
b
a
void rsgProgramVertexGetProjectionMatrix ( rs_matrix4x4 proj )

Get the projection matrix for a currently bound fixed function vertex program. Calling this function with a custom vertex shader would result in an error.

Parameters:
proj matrix to store the current projection matrix into
void rsgProgramVertexLoadModelMatrix ( const rs_matrix4x4 model )

Load the model matrix for a currently bound fixed function vertex program. Calling this function with a custom vertex shader would result in an error.

Parameters:
model model matrix
void rsgProgramVertexLoadProjectionMatrix ( const rs_matrix4x4 proj )

Load the projection matrix for a currently bound fixed function vertex program. Calling this function with a custom vertex shader would result in an error.

Parameters:
proj projection matrix
void rsgProgramVertexLoadTextureMatrix ( const rs_matrix4x4 tex )

Load the texture matrix for a currently bound fixed function vertex program. Calling this function with a custom vertex shader would result in an error.

Parameters:
tex texture matrix
No examples for this method.
Frequently called with: [Clear]
Portions of this page are reproduced from work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License. The original page is available here.