Beispiel #1
0
void CGLDevice::DrawArrays(Renderer::PrimitiveType mode, uint32_t base_vertex, uint32_t count)
{
	if (!count)
		return;

	BindVertexArray();
	glDrawArrays(ToGLPrimitiveType(mode), base_vertex, count);
}
void C2DPrimitiveRenderer_GL::Render( General2DVertex *paVertex, int num_vertices, PrimitiveType::Name primitive_type )
{
	ShaderHandle shader
		= sg_2DPrimitiveCommonShaders.GetShader( C2DPrimitiveCommonShaders::ST_DIFFUSE_COLOR );

	ShaderManager *pShaderMgr = shader.GetShaderManager();

	if( !pShaderMgr )
	{
		LOG_PRINT_ERROR( "The shader for 2D primitives is not available." );
		return;
	}

	pShaderMgr->Begin();

	RenderViaVertexAttribArray( paVertex, num_vertices, NULL, 0, ToGLPrimitiveType(primitive_type) );
}
void C2DPrimitiveRenderer_GL::Render( const General2DVertex *pVertices, uint num_vertices, U16 *indices, uint num_indices, PrimitiveType::Name primitive_type, TextureHandle texture )
{
	ShaderHandle shader
		= sg_2DPrimitiveCommonShaders.GetShader( C2DPrimitiveCommonShaders::ST_DIFFUSE_COLOR_AND_TEXTURE );

	ShaderManager *pShaderMgr = shader.GetShaderManager();

	if( !pShaderMgr )
	{
		return;
	}

	pShaderMgr->SetTexture( 0, texture );

	pShaderMgr->Begin();

	RenderViaVertexAttribArray( pVertices, num_vertices, indices, num_indices, ToGLPrimitiveType(primitive_type) );
}
void C2DPrimitiveRenderer_GL::Render( ShaderManager& rShaderManager, General2DVertex *paVertex, int num_vertices, PrimitiveType::Name primitive_type )
{
	rShaderManager.Begin();

	RenderViaVertexAttribArray( paVertex, num_vertices, NULL, 0, ToGLPrimitiveType( primitive_type ) );
}
void C2DPrimitiveRenderer_GL::Render( const General2DVertex *pVertices, uint num_vertices, U16 *indices, uint num_indices, PrimitiveType::Name primitive_type )
{
	RenderViaVertexAttribArray( pVertices, num_vertices, indices, num_indices, ToGLPrimitiveType(primitive_type) );
}