Exemple #1
0
void Batch2D::End(){
	//as long as a texture is bound, draw sprites
	if (texture)
		Flush();
	texture = nullptr;
	UnmapBuffers();
	glBindVertexArray(0);
}
void Deferred::ClearBuffers()
{	
	UnmapBuffers();

	deviceContext->ClearRenderTargetView(finalImage,BLACK);
	deviceContext->ClearRenderTargetView(lightPass,REALBLACK);
	deviceContext->ClearRenderTargetView(SSAOPass,WHITE);
	deviceContext->ClearDepthStencilView(depthStencilView,D3D11_CLEAR_DEPTH,1.0f,0);

	for(unsigned int i = 0; i < NUMBUFFERS; i++)
	{
		deviceContext->ClearRenderTargetView(gBuffer[i],BLACK);
	}

	// !!! SPECIAL FOR ALPHA LAYER IN ALBEDO BUFFER !!!
	deviceContext->ClearRenderTargetView(gBuffer[1],REALBLACK);
}
Exemple #3
0
//draw sprites to framebuffer
void Batch2D::Flush(){
	UnmapBuffers();
	glDrawElements(GL_TRIANGLES, instanceCount * indexPerSprite, GL_UNSIGNED_SHORT, 0);
	instanceCount = 0;
	MapBuffers();
}