HGE::Gfx_StartBatch
Starts rendering of user's graphic primitives batch.
hgeVertex *Gfx_StartBatch(
int prim_type,
HTEXTURE tex,
int blend,
int *max_prim
);
Parameters
- prim_type
- Type of graphic primitives to be rendered:
HGEPRIM_LINES - lines
HGEPRIM_TRIPLES - triples
HGEPRIM_QUADS - quads
- tex
- Handle of the texture to use or 0.
- blend
- Blending mode.
- max_prim
- Pointer to an int that will receive the maximum number of primitives allowed within a single batch.
Return value
If successful, returns pointer to the vertex buffer to be filled with vertices and stores the maximum allowed number
of primitives into max_prim. Otherwise returns 0.
Remarks
Gfx_StartBatch is a backdoor to the heart of HGE and DirectX for expert use.
It provides direct access to hardware vertex buffer and allows extremely fast rendering of large
arrays of graphic primitives. This may be used for tasks like sofisticated geometry or texture effects
or complex precalculated objects rendering.
Gfx_StartBatch function must be called between the Gfx_BeginScene
and Gfx_EndScene calls. To finish a batch use
Gfx_FinishBatch function. No other rendering functions
are allowed inside Gfx_StartBatch/Gfx_FinishBatch calls pair.
Vertex buffer size is constant and unlikely to change. It can hold up to 1000 quads / 1333 triples /
2000 lines. You should write to the buffer 2 vertices per line, 3 vertices per triple or 4 vertices per quad.
The actual number of primitives written to the buffer should be passed to Gfx_FinishBatch.
Gfx_StartBatch flushes all previously accumulated graphic primitives.
Requirements
Header: hge.h
Import library: hge.lib
See also
Gfx_FinishBatch,
Gfx_BeginScene,
Gfx_EndScene
|