예제 #1
0
bool GLVideo::SetVertexShader(ShaderPtr pShader)
{
	if (!pShader)
	{
		if (m_currentVS != m_defaultVS)
			m_currentVS->UnbindShader();
		m_currentVS = m_defaultVS;
	}
	else
	{
		if (pShader->GetShaderFocus() != Shader::SF_VERTEX)
		{
			ShowMessage("The shader set is not a vertex program", GSMT_ERROR);
			return false;
		}
		else
		{
			m_currentVS->UnbindShader();
			m_currentVS = pShader;
		}
	}

	const math::Vector2 screenSize = GetScreenSizeF();
	UpdateViewMatrix(screenSize, m_ortho, m_zNear, m_zFar, (m_currentTarget.lock()) ? true : false);
	UpdateShaderViewData(m_currentVS, screenSize, m_ortho);
	return true;
}
예제 #2
0
bool GLVideo::SetPixelShader(ShaderPtr pShader)
{
	if (pShader)
	{
		if (pShader->GetShaderFocus() != Shader::SF_PIXEL)
		{
			ShowMessage("The shader set is not a fragment program", GSMT_ERROR);
			return false;
		}
	}
	if (m_currentPS != pShader && m_currentPS)
		m_currentPS->UnbindShader();

	m_currentPS = pShader;
	return true;
}