Graphics API documentation

Version: alpha

FUNCTIONS
AddVertexStream() Adds a stream to a stream declaration
AddVertexStream() Adds a stream to a stream declaration
DeleteIndexBuffer() Delete the index buffer
DeleteVertexBuffer() Delete vertex buffer
DeleteVertexDeclaration() Delete vertex declaration
DeleteVertexStreamDeclaration() Delete vertex stream declaration
dmGraphics::GetNativeAndroidActivity() get Android native jobject
dmGraphics::GetNativeAndroidApp() get Android app object
dmGraphics::GetNativeAndroidEGLContext() get Android EGLContext
dmGraphics::GetNativeAndroidEGLSurface() get Android EGLSurface
dmGraphics::GetNativeAndroidJavaVM() get Android native JavaVM
dmGraphics::GetNativeiOSEAGLContext() get iOS EAGLContext
dmGraphics::GetNativeiOSUIView() get iOS UIView
dmGraphics::GetNativeiOSUIWindow() get iOS UIWindow
dmGraphics::GetNativeOSXNSOpenGLContext() get OSX NSOpenGLContext
dmGraphics::GetNativeOSXNSView() get OSX NSView
dmGraphics::GetNativeOSXNSWindow() get OSX NSWindow
dmGraphics::GetNativeWindowsHGLRC() get Win32 HGLRC
dmGraphics::GetNativeWindowsHWND() get Win32 HWND
dmGraphics::GetNativeX11GLXContext() get Linux X11GLXContext
dmGraphics::GetNativeX11Window() get Linux X11Window
GetMaxElementsIndices() Get the max number of indices allowed by the syste...
GetMaxElementsVertices() Get the max number of vertices allowed by the syst...
GetNumSupportedExtensions()
GetRenderTargetAttachment() Get the attachment texture from a render target. R...
GetSupportedExtension() get the supported extension
GetTextureHandle() Get the native graphics API texture object from an...
GetVertexStreamOffset() Get the physical offset into the vertex data for a...
INVALID_STREAM_OFFSET() Invalid stream offset
IsExtensionSupported() check if an extension is supported
IsIndexBufferFormatSupported() Check if the index format is supported
IsTextureFormatSupported() check if a specific texture format is supported
MAX_BUFFER_COLOR_ATTACHMENTS() Max buffer color attachments
NewIndexBuffer() Create new index buffer with initial data
NewVertexBuffer() Create new vertex buffer with initial data
NewVertexDeclaration() Create new vertex declaration from a vertex stream...
NewVertexDeclaration() Create new vertex declaration from a vertex stream...
NewVertexStreamDeclaration() Create new vertex stream declaration. A stream dec...
NewVertexStreamDeclaration() Create new vertex stream declaration. A stream dec...
OpenGLGetRenderTargetId() Get the OpenGL render target id from a render targ...
SetIndexBufferData() Set index buffer data
SetIndexBufferSubData() Set subset of index buffer data
SetVertexBufferData() Set vertex buffer data
SetVertexBufferSubData() Set subset of vertex buffer data
VulkanGetActiveSwapChainTexture() Get the current swap chain texture
VulkanGraphicsCommandQueueToMetal() Get the native MTLCommandQueue from the Vulkan con...
VulkanTextureToMetal() Get a native MTLTexture from a Vulkan HTexture. On...
ENUMS
AttachmentOp
BlendFactor Blend factor
BufferAccess
BufferUsage
CompareFunc
FaceWinding
HandleResult
IndexBufferFormat
PrimitiveType Primitive type
RenderTargetAttachment
StencilOp
TextureFormat
Type Data type

Functions

AddVertexStream()

AddVertexStream(context,name,size,type,normalize)

Adds a stream to a stream declaration

PARAMETERS

context dmGraphics::HContext the context
name const char* the name of the stream
size uint32_t the size of the stream, i.e number of components
type dmGraphics::Type the data type of the stream
normalize bool true if the stream should be normalized in the 0..1 range

AddVertexStream()

AddVertexStream(context,name_hash,size,type,normalize)

Adds a stream to a stream declaration

PARAMETERS

context dmGraphics::HContext the context
name_hash uint64_t the name hash of the stream
size uint32_t the size of the stream, i.e number of components
type dmGraphics::Type the data type of the stream
normalize bool true if the stream should be normalized in the 0..1 range

DeleteIndexBuffer()

DeleteIndexBuffer(buffer)

Delete the index buffer

PARAMETERS

buffer dmGraphics::HIndexBuffer the index buffer

DeleteVertexBuffer()

DeleteVertexBuffer(buffer)

Delete vertex buffer

PARAMETERS

buffer dmGraphics::HVertexBuffer the buffer

DeleteVertexDeclaration()

DeleteVertexDeclaration(vertex_declaration)

Delete vertex declaration

PARAMETERS

vertex_declaration dmGraphics::HVertexDeclaration the vertex declaration

DeleteVertexStreamDeclaration()

DeleteVertexStreamDeclaration(stream_declaration)

Delete vertex stream declaration

PARAMETERS

stream_declaration dmGraphics::HVertexStreamDeclaration the vertex stream declaration

dmGraphics::GetNativeAndroidActivity()

dmGraphics::GetNativeAndroidActivity()

Get Android native jobject. Any other platform return zero.

PARAMETERS

None

RETURNS

jobject jobject native handle

dmGraphics::GetNativeAndroidApp()

dmGraphics::GetNativeAndroidApp()

Get Android app object. Any other platform return zero.

PARAMETERS

None

RETURNS

app struct android_app* native handle

dmGraphics::GetNativeAndroidEGLContext()

dmGraphics::GetNativeAndroidEGLContext()

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

PARAMETERS

None

RETURNS

EGLContext EGLContext native handle

dmGraphics::GetNativeAndroidEGLSurface()

dmGraphics::GetNativeAndroidEGLSurface()

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

PARAMETERS

None

RETURNS

EGLSurface EGLSurface native handle

dmGraphics::GetNativeAndroidJavaVM()

dmGraphics::GetNativeAndroidJavaVM()

Get Android JavaVM ptr. Any other platform return zero.

PARAMETERS

None

RETURNS

JavaVM* JavaVM* native handle

dmGraphics::GetNativeiOSEAGLContext()

dmGraphics::GetNativeiOSEAGLContext()

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

PARAMETERS

None

RETURNS

id id native handle

dmGraphics::GetNativeiOSUIView()

dmGraphics::GetNativeiOSUIView()

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

PARAMETERS

None

RETURNS

id id native handle

dmGraphics::GetNativeiOSUIWindow()

dmGraphics::GetNativeiOSUIWindow()

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

PARAMETERS

None

RETURNS

id id native handle

dmGraphics::GetNativeOSXNSOpenGLContext()

dmGraphics::GetNativeOSXNSOpenGLContext()

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

PARAMETERS

None

RETURNS

id id native handle

dmGraphics::GetNativeOSXNSView()

dmGraphics::GetNativeOSXNSView()

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

PARAMETERS

None

RETURNS

id id native handle

dmGraphics::GetNativeOSXNSWindow()

dmGraphics::GetNativeOSXNSWindow()

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

PARAMETERS

None

RETURNS

id id native handle

dmGraphics::GetNativeWindowsHGLRC()

dmGraphics::GetNativeWindowsHGLRC()

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

PARAMETERS

None

RETURNS

HGLRC HGLRC native handle

dmGraphics::GetNativeWindowsHWND()

dmGraphics::GetNativeWindowsHWND()

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

PARAMETERS

None

RETURNS

HWND HWND native handle

dmGraphics::GetNativeX11GLXContext()

dmGraphics::GetNativeX11GLXContext()

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

PARAMETERS

None

RETURNS

GLXContext GLXContext native handle

dmGraphics::GetNativeX11Window()

dmGraphics::GetNativeX11Window()

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

PARAMETERS

None

RETURNS

Window Window native handle

GetMaxElementsIndices()

GetMaxElementsIndices(context)

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

PARAMETERS

context dmGraphics::HContext the context

RETURNS

count uint32_t the count

GetMaxElementsVertices()

GetMaxElementsVertices(context)

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

PARAMETERS

context dmGraphics::HContext the context

RETURNS

count uint32_t the count

GetNumSupportedExtensions()

GetNumSupportedExtensions(context)

PARAMETERS

context dmGraphics::HContext the context

RETURNS

count uint32_t the number of supported extensions

GetRenderTargetAttachment()

GetRenderTargetAttachment(render_target,attachment_type)

Get the attachment texture from a render target. Returns zero if no such attachment texture exists.

PARAMETERS

render_target dmGraphics::HRenderTarget the render target
attachment_type dmGraphics::RenderTargetAttachment the attachment to get

RETURNS

attachment dmGraphics::HTexture the attachment texture

GetSupportedExtension()

GetSupportedExtension(context,index)

get the supported extension

PARAMETERS

context dmGraphics::HContext the context
index uint32_t the index of the extension

RETURNS

extension const char* the extension. 0 if index was out of bounds

GetTextureHandle()

GetTextureHandle(texture,out_handle)

Get the native graphics API texture object from an engine texture handle. This depends on the graphics backend and is not guaranteed to be implemented on the currently running adapter.

PARAMETERS

texture dmGraphics::HTexture the texture handle
out_handle void** a pointer to where the raw object should be stored

RETURNS

handle_result dmGraphics::HandleResult the result of the query

GetVertexStreamOffset()

GetVertexStreamOffset(vertex_declaration,name_hash)

Get the physical offset into the vertex data for a particular stream

PARAMETERS

vertex_declaration dmGraphics::HVertexDeclaration the vertex declaration
name_hash uint64_t the name hash of the vertex stream (as passed into AddVertexStream())

RETURNS

Offset in bytes into the vertex or INVALID_STREAM_OFFSET if not found

INVALID_STREAM_OFFSET()

INVALID_STREAM_OFFSET()

Invalid stream offset

PARAMETERS

None


IsExtensionSupported()

IsExtensionSupported(context,extension)

check if an extension is supported

PARAMETERS

context dmGraphics::HContext the context
extension const char* the extension.

RETURNS

result bool true if the extension was supported

IsIndexBufferFormatSupported()

IsIndexBufferFormatSupported(context,format,result)

Check if the index format is supported

PARAMETERS

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

IsTextureFormatSupported()

IsTextureFormatSupported(context,format)

check if a specific texture format is supported

PARAMETERS

context dmGraphics::HContext the context
format TextureFormat the texture format.

RETURNS

result bool true if the texture format was supported

MAX_BUFFER_COLOR_ATTACHMENTS()

MAX_BUFFER_COLOR_ATTACHMENTS()

Max buffer color attachments

PARAMETERS

None


NewIndexBuffer()

NewIndexBuffer(context,size,data,buffer_usage)

Create new index buffer with initial data

PARAMETERS

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

RETURNS

buffer dmGraphics::HIndexBuffer the index buffer

NewVertexBuffer()

NewVertexBuffer(context,size,data,buffer_usage)

Create new vertex buffer with initial data

PARAMETERS

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

RETURNS

buffer dmGraphics::HVertexBuffer the vertex buffer

NewVertexDeclaration()

NewVertexDeclaration(context,stream_declaration)

Create new vertex declaration from a vertex stream declaration

PARAMETERS

context dmGraphics::HContext the context
stream_declaration dmGraphics::HVertexStreamDeclaration the vertex stream declaration

RETURNS

declaration dmGraphics::HVertexDeclaration the vertex declaration

NewVertexDeclaration()

NewVertexDeclaration(context,stream_declaration,stride)

Create new vertex declaration from a vertex stream declaration and an explicit stride value, where the stride is the number of bytes between each consecutive vertex in a vertex buffer

PARAMETERS

context dmGraphics::HContext the context
stream_declaration dmGraphics::HVertexStreamDeclaration the vertex stream declaration
stride uint32_t the stride between the start of each vertex (in bytes)

RETURNS

declaration dmGraphics::HVertexDeclaration the vertex declaration

NewVertexStreamDeclaration()

NewVertexStreamDeclaration(context)

Create new vertex stream declaration. A stream declaration contains a list of vertex streams that should be used to create a vertex declaration from.

PARAMETERS

context dmGraphics::HContext the context

RETURNS

declaration dmGraphics::HVertexStreamDeclaration the vertex declaration

NewVertexStreamDeclaration()

NewVertexStreamDeclaration(context,step_function)

Create new vertex stream declaration. A stream declaration contains a list of vertex streams that should be used to create a vertex declaration from.

PARAMETERS

context dmGraphics::HContext the context
step_function dmGraphics::VertexStepFunction the vertex step function to use

RETURNS

declaration dmGraphics::HVertexStreamDeclaration the vertex declaration

OpenGLGetRenderTargetId()

OpenGLGetRenderTargetId(context,render_target)

Get the OpenGL render target id from a render target

PARAMETERS

context dmGraphics::HContext the OpenGL context
render_target dmGraphics::HRenderTarget the render target to get the ID from

RETURNS

id uint32_t the OpenGL render target id

SetIndexBufferData()

SetIndexBufferData(buffer,size,data,buffer_usage)

Set index buffer data

PARAMETERS

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

SetIndexBufferSubData()

SetIndexBufferSubData(buffer,offset,size,data)

Set subset of index buffer data

PARAMETERS

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

SetVertexBufferData()

SetVertexBufferData(buffer,size,data,buffer_usage)

Set vertex buffer data

PARAMETERS

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

SetVertexBufferSubData()

SetVertexBufferSubData(buffer,offset,size,data)

Set subset of vertex buffer data

PARAMETERS

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

VulkanGetActiveSwapChainTexture()

VulkanGetActiveSwapChainTexture(context)

Get the current swap chain texture

PARAMETERS

context dmGraphics::HContext the vulkan context

RETURNS

swapchain dmGraphics::HTexture the swap chain texture for the current frame

VulkanGraphicsCommandQueueToMetal()

VulkanGraphicsCommandQueueToMetal(context)

Get the native MTLCommandQueue from the Vulkan context. Only available when using Mac/iOS.

PARAMETERS

context dmGraphics::HContext the vulkan context

RETURNS

mtl_queue id the Metal graphics queue wrapped with a (__bridge void*)

VulkanTextureToMetal()

VulkanTextureToMetal(context,texture)

Get a native MTLTexture from a Vulkan HTexture. Only available when using Mac/iOS.

PARAMETERS

context dmGraphics::HContext the vulkan context
texture dmGraphics::HTexture the texture

RETURNS

mtl_texture id the Metal texture wrapped with a (__bridge void*)