Overview
GraphicsObjectInterface is the base interface for all renderable graphics objects in the Open Mobile Maps SDK. It defines the contract for graphics primitives that can be rendered on the map, including setup, lifecycle management, and rendering operations.
Graphics objects are created through the GraphicsObjectFactoryInterface and are used by layers to display visual content.
Header Location: shared/public/GraphicsObjectInterface.h:13
Lifecycle Methods
Initializes the graphics object with a rendering context. Must be called on the graphics/rendering thread.
context
std::shared_ptr<RenderingContextInterface>
required
The rendering context to use for setup
Clears the graphics object and invalidates its ready state. After calling this method, isReady() will return false until setup() is called again.
Checks if the graphics object is ready to be rendered. True if the object is ready to be drawn, false otherwise
Configuration Methods
Sets whether masking should be applied inversely. By default, masked objects are only rendered where the mask is set. Setting this flag applies the mask inversely, rendering only where the mask is not set. True to apply inverse masking, false for normal masking
Sets a debug label for the graphics object. This label can be used for debugging and profiling purposes.
Rendering Methods
Renders the graphics object. Must be called on the graphics/rendering thread.
context
std::shared_ptr<RenderingContextInterface>
required
The rendering context
Configuration for the current render pass
View-projection matrix pointer
Origin point for rendering
Whether masking is active
screenPixelAsRealMeterFactor
Conversion factor from screen pixels to real-world meters
Whether coordinates are in screen space
Graphics Object Factory
Graphics objects are created using the GraphicsObjectFactoryInterface, which provides factory methods for different types of primitives:
2D Primitives
createQuad
std::shared_ptr<Quad2dInterface>
Creates a 2D quad (rectangle) graphics object. shader
std::shared_ptr<ShaderProgramInterface>
required
Shader program to use for rendering
createQuadTessellated
std::shared_ptr<Quad2dInterface>
Creates a tessellated 2D quad for smooth curved surfaces. shader
std::shared_ptr<ShaderProgramInterface>
required
Shader program to use for rendering
createPolygon
std::shared_ptr<Polygon2dInterface>
Creates a 2D polygon graphics object. shader
std::shared_ptr<ShaderProgramInterface>
required
Shader program to use for rendering
createPolygonTessellated
std::shared_ptr<Polygon2dInterface>
Creates a tessellated 2D polygon. shader
std::shared_ptr<ShaderProgramInterface>
required
Shader program to use for rendering
Instanced Rendering
createQuadInstanced
std::shared_ptr<Quad2dInstancedInterface>
Creates an instanced quad for efficient batch rendering. shader
std::shared_ptr<ShaderProgramInterface>
required
Shader program to use for rendering
createQuadStretchedInstanced
std::shared_ptr<Quad2dStretchedInstancedInterface>
Creates an instanced stretched quad. shader
std::shared_ptr<ShaderProgramInterface>
required
Shader program to use for rendering
Groups and Collections
createLineGroup
std::shared_ptr<LineGroup2dInterface>
Creates a line group for rendering multiple lines efficiently. shader
std::shared_ptr<ShaderProgramInterface>
required
Shader program to use for rendering
createPolygonGroup
std::shared_ptr<PolygonGroup2dInterface>
Creates a polygon group for rendering multiple polygons efficiently. shader
std::shared_ptr<ShaderProgramInterface>
required
Shader program to use for rendering
createPolygonPatternGroup
std::shared_ptr<PolygonPatternGroup2dInterface>
Creates a polygon pattern group for textured polygons. shader
std::shared_ptr<ShaderProgramInterface>
required
Shader program to use for rendering
Text Rendering
createText
std::shared_ptr<TextInterface>
Creates a text graphics object. shader
std::shared_ptr<ShaderProgramInterface>
required
Shader program to use for rendering
createTextInstanced
std::shared_ptr<TextInstancedInterface>
Creates an instanced text object for efficient text rendering. shader
std::shared_ptr<ShaderProgramInterface>
required
Shader program to use for rendering
3D Primitives
createIcosahedronObject
std::shared_ptr<IcosahedronInterface>
Creates an icosahedron (20-sided polyhedron) for 3D rendering. shader
std::shared_ptr<ShaderProgramInterface>
required
Shader program to use for rendering
Masking Objects
createQuadMask
std::shared_ptr<Quad2dInterface>
Creates a quad for use as a mask. Whether the mask is for 3D rendering
createPolygonMask
std::shared_ptr<Polygon2dInterface>
Creates a polygon for use as a mask. Whether the mask is for 3D rendering
createPolygonMaskTessellated
std::shared_ptr<Polygon2dInterface>
Creates a tessellated polygon for use as a mask. Whether the mask is for 3D rendering
Usage Example
// Get the graphics object factory from the map
auto factory = map -> getGraphicsObjectFactory ();
auto shaderFactory = map -> getShaderFactory ();
// Create a shader for the quad
auto shader = shaderFactory -> createAlphaShader ();
// Create a quad graphics object
auto quad = factory -> createQuad (shader);
// Set debug label
quad -> setDebugLabel ( "MyQuad" );
// Setup the graphics object (on rendering thread)
auto context = map -> getRenderingContext ();
quad -> setup (context);
// Check if ready
if ( quad -> isReady ()) {
// Render the quad (on rendering thread)
RenderPassConfig renderPass;
quad -> render (
context,
renderPass,
vpMatrixPtr,
mMatrixPtr,
Vec3D{ 0 , 0 , 0 },
false , // not masked
1.0 , // pixel to meter factor
false // not screen space
);
}
// Clean up
quad -> clear ();
Render Object Wrapper
Graphics objects are typically wrapped in RenderObjectInterface which provides additional rendering control:
class RenderObjectInterface {
virtual std :: shared_ptr < GraphicsObjectInterface > getGraphicsObject () = 0 ;
virtual bool hasCustomModelMatrix () = 0 ;
virtual bool isScreenSpaceCoords () = 0 ;
virtual std :: vector < float > getCustomModelMatrix () = 0 ;
virtual void setHidden ( bool hidden ) = 0 ;
virtual bool isHidden () = 0 ;
};
Graphics Object Types
The SDK provides several specialized graphics object types:
Quad2dInterface - 2D rectangles
Polygon2dInterface - 2D polygons
LineGroup2dInterface - Collections of lines
PolygonGroup2dInterface - Collections of polygons
TextInterface - Text rendering
IcosahedronInterface - 3D spherical objects
Instanced variants - For efficient batch rendering
See Also