Sdk graphics api documentation

Platform specific native graphics functions.

Namespace: dmGraphics
Include: #include <dmsdk/graphics/graphics_native.h>
ENUMS
CompareFunc
FaceWinding
StencilOp
BufferUsage
BufferAccess
IndexBufferFormat
PrimitiveType Primitive type
Type Data type
Type Blend factor
STRUCTS
struct VertexElement
FUNCTIONS
dmGraphics::HVertexDeclaration NewVertexDeclaration(dmGraphics::HContext context, dmGraphics::VertexElement* element, uint32_t count) Create new vertex declaration
dmGraphics::HVertexDeclaration NewVertexDeclaration(dmGraphics::HContext context, dmGraphics::VertexElement* element, uint32_t count, uint32_t stride) Create new vertex declaration
void DeleteVertexDeclaration(dmGraphics::HVertexDeclaration vertex_declaration) Delete vertex declaration
dmGraphics::HVertexBuffer NewVertexBuffer(dmGraphics::HContext context, uint32_t size, void* data, dmGraphics::BufferUsage buffer_usage) Create new vertex buffer with initial data
void DeleteVertexBuffer(dmGraphics::HVertexBuffer buffer) Delete vertex buffer
void SetVertexBufferData(dmGraphics::HVertexBuffer buffer, uint32_t size, void* data, dmGraphics::BufferUsage buffer_usage) Set vertex buffer data
void SetVertexBufferSubData(dmGraphics::HVertexBuffer buffer, uint32_t offset, uint32_t size, void* data) Set subset of vertex buffer data
uint32_t GetMaxElementsVertices(dmGraphics::HContext context) Get the max number of vertices allowed by the syst...
dmGraphics::HIndexBuffer NewIndexBuffer(dmGraphics::HContext context, uint32_t size, void* data, dmGraphics::BufferUsage buffer_usage) Create new index buffer with initial data
void DeleteIndexBuffer(dmGraphics::HIndexBuffer buffer) Delete the index buffer
void SetIndexBufferData(dmGraphics::HIndexBuffer buffer, uint32_t size, void* data, dmGraphics::BufferUsage buffer_usage) Set index buffer data
void SetIndexBufferSubData(dmGraphics::HVertexBuffer buffer, uint32_t offset, uint32_t size, void* data) Set subset of index buffer data
void IsIndexBufferFormatSupported(dmGraphics::HContext context, dmGraphics::IndexBufferFormat format, bool result) Check if the index format is supported
uint32_t GetMaxElementsIndices(dmGraphics::HContext context) Get the max number of indices allowed by the syste...
id dmGraphics::GetNativeiOSUIWindow() get iOS UIWindow
id dmGraphics::GetNativeiOSUIView() get iOS UIView
id dmGraphics::GetNativeiOSEAGLContext() get iOS EAGLContext
id dmGraphics::GetNativeOSXNSWindow() get OSX NSWindow
id dmGraphics::GetNativeOSXNSView() get OSX NSView
id dmGraphics::GetNativeOSXNSOpenGLContext() get OSX NSOpenGLContext
HWND dmGraphics::GetNativeWindowsHWND() get Win32 HWND
HGLRC dmGraphics::GetNativeWindowsHGLRC() get Win32 HGLRC
EGLContext dmGraphics::GetNativeAndroidEGLContext() get Android EGLContext
EGLSurface dmGraphics::GetNativeAndroidEGLSurface() get Android EGLSurface
JavaVM* dmGraphics::GetNativeAndroidJavaVM() get Android native JavaVM
jobject dmGraphics::GetNativeAndroidActivity() get Android native jobject
struct android_app* dmGraphics::GetNativeAndroidApp() get Android app object
Window dmGraphics::GetNativeX11Window() get Linux X11Window
GLXContext dmGraphics::GetNativeX11GLXContext() get Linux X11GLXContext

Functions

NewVertexDeclaration

dmGraphics::HVertexDeclaration NewVertexDeclaration(dmGraphics::HContext context, dmGraphics::VertexElement* element, uint32_t count)

Create new vertex declaration

PARAMETERS

dmGraphics::HContext context the context
dmGraphics::VertexElement* element the array of vertex elements
uint32_t count the number of items in the element array

RETURNS

dmGraphics::HVertexDeclaration the vertex declaration

NewVertexDeclaration

dmGraphics::HVertexDeclaration NewVertexDeclaration(dmGraphics::HContext context, dmGraphics::VertexElement* element, uint32_t count, uint32_t stride)

Create new vertex declaration

PARAMETERS

dmGraphics::HContext context the context
dmGraphics::VertexElement* element the array of vertex elements
uint32_t count the number of items in the element array
uint32_t stride the stride between the start of each vertex (in bytes)

RETURNS

dmGraphics::HVertexDeclaration the vertex declaration

DeleteVertexDeclaration

void DeleteVertexDeclaration(dmGraphics::HVertexDeclaration vertex_declaration)

Delete vertex declaration

PARAMETERS

dmGraphics::HVertexDeclaration vertex_declaration the vertex declaration

NewVertexBuffer

dmGraphics::HVertexBuffer NewVertexBuffer(dmGraphics::HContext context, uint32_t size, void* data, dmGraphics::BufferUsage buffer_usage)

Create new vertex buffer with initial data

PARAMETERS

dmGraphics::HContext context the context
uint32_t size the size of the buffer (in bytes). May be 0
void* data the data
dmGraphics::BufferUsage buffer_usage the usage

RETURNS

dmGraphics::HVertexBuffer the vertex buffer

DeleteVertexBuffer

void DeleteVertexBuffer(dmGraphics::HVertexBuffer buffer)

Delete vertex buffer

PARAMETERS

dmGraphics::HVertexBuffer buffer the buffer

SetVertexBufferData

void SetVertexBufferData(dmGraphics::HVertexBuffer buffer, uint32_t size, void* data, dmGraphics::BufferUsage buffer_usage)

Set vertex buffer data

PARAMETERS

dmGraphics::HVertexBuffer buffer the buffer
uint32_t size the size of the buffer (in bytes). May be 0
void* data the data
dmGraphics::BufferUsage buffer_usage the usage

SetVertexBufferSubData

void SetVertexBufferSubData(dmGraphics::HVertexBuffer buffer, uint32_t offset, uint32_t size, void* data)

Set subset of vertex buffer data

PARAMETERS

dmGraphics::HVertexBuffer buffer the buffer
uint32_t offset the offset into the desination buffer (in bytes)
uint32_t size the size of the buffer (in bytes). May be 0
void* data the data

GetMaxElementsVertices

uint32_t GetMaxElementsVertices(dmGraphics::HContext context)

Get the max number of vertices allowed by the system in a vertex buffer

PARAMETERS

dmGraphics::HContext context the context

RETURNS

uint32_t the count

NewIndexBuffer

dmGraphics::HIndexBuffer NewIndexBuffer(dmGraphics::HContext context, uint32_t size, void* data, dmGraphics::BufferUsage buffer_usage)

Create new index buffer with initial data

PARAMETERS

dmGraphics::HContext context the context
uint32_t size the size of the buffer (in bytes). May be 0
void* data the data
dmGraphics::BufferUsage buffer_usage the usage

RETURNS

dmGraphics::HIndexBuffer the index buffer

DeleteIndexBuffer

void DeleteIndexBuffer(dmGraphics::HIndexBuffer buffer)

Delete the index buffer

PARAMETERS

dmGraphics::HIndexBuffer buffer the index buffer

SetIndexBufferData

void SetIndexBufferData(dmGraphics::HIndexBuffer buffer, uint32_t size, void* data, dmGraphics::BufferUsage buffer_usage)

Set index buffer data

PARAMETERS

dmGraphics::HIndexBuffer buffer the buffer
uint32_t size the size of the buffer (in bytes). May be 0
void* data the data
dmGraphics::BufferUsage buffer_usage the usage

SetIndexBufferSubData

void SetIndexBufferSubData(dmGraphics::HVertexBuffer buffer, uint32_t offset, uint32_t size, void* data)

Set subset of index buffer data

PARAMETERS

dmGraphics::HVertexBuffer buffer the buffer
uint32_t offset the offset into the desination buffer (in bytes)
uint32_t size the size of the buffer (in bytes). May be 0
void* data the data

IsIndexBufferFormatSupported

void IsIndexBufferFormatSupported(dmGraphics::HContext context, dmGraphics::IndexBufferFormat format, bool result)

Check if the index format is supported

PARAMETERS

dmGraphics::HContext context the context
dmGraphics::IndexBufferFormat format the format
bool result true if the format is supoprted

GetMaxElementsIndices

uint32_t GetMaxElementsIndices(dmGraphics::HContext context)

Get the max number of indices allowed by the system in an index buffer

PARAMETERS

dmGraphics::HContext context the context

RETURNS

uint32_t the count

dmGraphics::GetNativeiOSUIWindow

id dmGraphics::GetNativeiOSUIWindow()

Get iOS UIWindow native handle (id). Any other platform return zero.

PARAMETERS

RETURNS

id native handle

dmGraphics::GetNativeiOSUIView

id dmGraphics::GetNativeiOSUIView()

Get iOS UIView native handle (id). Any other platform return zero.

PARAMETERS

RETURNS

id native handle

dmGraphics::GetNativeiOSEAGLContext

id dmGraphics::GetNativeiOSEAGLContext()

Get iOS EAGLContext native handle (id). Any other platform return zero.

PARAMETERS

RETURNS

id native handle

dmGraphics::GetNativeOSXNSWindow

id dmGraphics::GetNativeOSXNSWindow()

Get OSX NSWindow native handle (id). Any other platform return zero.

PARAMETERS

RETURNS

id native handle

dmGraphics::GetNativeOSXNSView

id dmGraphics::GetNativeOSXNSView()

Get OSX NSView native handle (id). Any other platform return zero.

PARAMETERS

RETURNS

id native handle

dmGraphics::GetNativeOSXNSOpenGLContext

id dmGraphics::GetNativeOSXNSOpenGLContext()

Get OSX NSOpenGLContext native handle (id). Any other platform return zero.

PARAMETERS

RETURNS

id native handle

dmGraphics::GetNativeWindowsHWND

HWND dmGraphics::GetNativeWindowsHWND()

Get Win32 windows native handle (HWND). Any other platform return zero.

PARAMETERS

RETURNS

HWND native handle

dmGraphics::GetNativeWindowsHGLRC

HGLRC dmGraphics::GetNativeWindowsHGLRC()

Get Win32 gl rendercontext native handle (HGLRC). Any other platform return zero.

PARAMETERS

RETURNS

HGLRC native handle

dmGraphics::GetNativeAndroidEGLContext

EGLContext dmGraphics::GetNativeAndroidEGLContext()

Get Android EGLContext native handle (EGLContext). Any other platform return zero.

PARAMETERS

RETURNS

EGLContext native handle

dmGraphics::GetNativeAndroidEGLSurface

EGLSurface dmGraphics::GetNativeAndroidEGLSurface()

Get Android EGLSurface native handle (EGLSurface). Any other platform return zero.

PARAMETERS

RETURNS

EGLSurface native handle

dmGraphics::GetNativeAndroidJavaVM

JavaVM* dmGraphics::GetNativeAndroidJavaVM()

Get Android JavaVM ptr. Any other platform return zero.

PARAMETERS

RETURNS

JavaVM* native handle

dmGraphics::GetNativeAndroidActivity

jobject dmGraphics::GetNativeAndroidActivity()

Get Android native jobject. Any other platform return zero.

PARAMETERS

RETURNS

jobject native handle

dmGraphics::GetNativeAndroidApp

struct android_app* dmGraphics::GetNativeAndroidApp()

Get Android app object. Any other platform return zero.

PARAMETERS

RETURNS

struct android_app* native handle

dmGraphics::GetNativeX11Window

Window dmGraphics::GetNativeX11Window()

Get Linux X11Window windows native handle (Window). Any other platform return zero.

PARAMETERS

RETURNS

Window native handle

dmGraphics::GetNativeX11GLXContext

GLXContext dmGraphics::GetNativeX11GLXContext()

Get Linux X11GLXContext native handle (GLXContext). Any other platform return zero.

PARAMETERS

RETURNS

GLXContext native handle

Structs

VertexElement

TYPE

struct VertexElement

MEMBERS

const char* m_Name name of the element (e.g. "position")
uint32_t m_Stream stream index
uint32_t m_Size number of elements (e.g. 3 for "position")
dmGraphics::Type m_Type data type
bool m_Normalize if set, will normalize the output in the program


Enums

CompareFunc

COMPARE_FUNC_NEVER
COMPARE_FUNC_LESS
COMPARE_FUNC_LEQUAL
COMPARE_FUNC_GREATER
COMPARE_FUNC_GEQUAL
COMPARE_FUNC_EQUAL
COMPARE_FUNC_NOTEQUAL
COMPARE_FUNC_ALWAYS

FaceWinding

FACE_WINDING_CCW
FACE_WINDING_CW

StencilOp

STENCIL_OP_KEEP
STENCIL_OP_ZERO
STENCIL_OP_REPLACE
STENCIL_OP_INCR
STENCIL_OP_INCR_WRAP
STENCIL_OP_DECR
STENCIL_OP_DECR_WRAP
STENCIL_OP_INVERT

BufferUsage

BUFFER_USAGE_STREAM_DRAW
BUFFER_USAGE_DYNAMIC_DRAW
BUFFER_USAGE_STATIC_DRAW
Preferred for buffers that never change

BufferAccess

BUFFER_ACCESS_READ_ONLY
BUFFER_ACCESS_WRITE_ONLY
BUFFER_ACCESS_READ_WRITE

IndexBufferFormat

INDEXBUFFER_FORMAT_16
INDEXBUFFER_FORMAT_32

PrimitiveType

Primitive type

PRIMITIVE_LINES
PRIMITIVE_TRIANGLES
PRIMITIVE_TRIANGLE_STRIP

Type

Data type

TYPE_BYTE
TYPE_UNSIGNED_BYTE
TYPE_SHORT
TYPE_UNSIGNED_SHORT
TYPE_INT
TYPE_UNSIGNED_INT
TYPE_FLOAT
TYPE_FLOAT_VEC4
TYPE_FLOAT_MAT4
TYPE_SAMPLER_2D
TYPE_SAMPLER_CUBE

Type

Blend factor

BLEND_FACTOR_ZERO
BLEND_FACTOR_ONE
BLEND_FACTOR_SRC_COLOR
BLEND_FACTOR_ONE_MINUS_SRC_COLOR
BLEND_FACTOR_DST_COLOR
BLEND_FACTOR_ONE_MINUS_DST_COLOR
BLEND_FACTOR_SRC_ALPHA
BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
BLEND_FACTOR_DST_ALPHA
BLEND_FACTOR_ONE_MINUS_DST_ALPHA
BLEND_FACTOR_SRC_ALPHA_SATURATE
BLEND_FACTOR_CONSTANT_COLOR
BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR
BLEND_FACTOR_CONSTANT_ALPHA
BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA