Esempio n. 1
0
static void LogFragmentShaderMaximumPrecision(const Platform::FileLogger& logger)
{
	const bool precisionResult = HasFragmentShaderMaximumPrecision();
	const str_type::string logStr = (precisionResult)
		? GS_L("High floating point fragment shader precision supported")
		: GS_L("High floating point fragment shader precision is not supported");
	logger.Log(logStr, (precisionResult) ? Platform::FileLogger::INFO : Platform::FileLogger::WARNING);
}
Esempio n. 2
0
void GLES2Video::CheckGLError(const str_type::string& op, const Platform::FileLogger& logger)
{
	for (GLint error = glGetError(); error; error = glGetError())
	{
		std::stringstream ss;
		ss << "ERROR: after " << op << ". Error code " << error;
		logger.Log(ss.str(), Platform::FileLogger::ERROR);
	}
}
Esempio n. 3
0
void CheckFrameBufferStatus(const Platform::FileLogger& logger, const GLuint fbo, const GLuint tex, const bool showSuccessMessage)
{
	const GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
	str_type::stringstream ss;
	ss << GS_L("fboID ") << fbo << GS_L(" (") << tex << GS_L("): ");
	switch (status)
	{
	case GL_FRAMEBUFFER_COMPLETE:
		if (showSuccessMessage)
		{
			ss << GS_L(" render target texture created successfully");
			logger.Log(ss.str(), Platform::FileLogger::INFO);
		}
		break;
	case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
		ss << GS_L(" incomplete attachment");
		logger.Log(ss.str(), Platform::FileLogger::ERROR);
		break;
	case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
		ss << GS_L(" incomplete dimensions");
		logger.Log(ss.str(), Platform::FileLogger::ERROR);
		break;
	case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
		ss << GS_L(" incomplete missing attachment");
		logger.Log(ss.str(), Platform::FileLogger::ERROR);
		break;
	case GL_FRAMEBUFFER_UNSUPPORTED:
		ss << GS_L(" unsupported");
		logger.Log(ss.str(), Platform::FileLogger::ERROR);
		break;
	default:
		ss << GS_L(" unknown status");
		logger.Log(ss.str(), Platform::FileLogger::ERROR);
	}
}
Esempio n. 4
0
void GLES2RectRenderer::SetPositionLocations(const int positionLocation, const int texCoordLocation, const Platform::FileLogger& logger) const
{
	if (m_latestLocations.positionLocation != positionLocation || m_latestLocations.texCoordLocation != texCoordLocation)
	{
		glBindBuffer(GL_ARRAY_BUFFER, m_vertexBuffer);
		glVertexAttribPointer(positionLocation, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 4, (void*)0);
		glEnableVertexAttribArray(positionLocation);

		glVertexAttribPointer(texCoordLocation, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 4, (void*)(sizeof(float) * 2));
		glEnableVertexAttribArray(texCoordLocation);

		glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_indexBuffer);

		m_latestLocations.positionLocation = positionLocation;
		m_latestLocations.texCoordLocation = texCoordLocation;
		logger.Log("GLES2RectRenderer::SetPositionLocations: new vertex attribute array set", Platform::FileLogger::INFO);
	}
}
Esempio n. 5
0
inline int GLES2UniformParameter::GetLocation(const GLuint program, const str_type::string& name, const Platform::FileLogger& logger)
{
	LocationMap& locations = *m_locations.get();
	std::map<GLuint, int>::iterator iter = locations.find(program);
	if (iter != locations.end())
	{
		return iter->second;
	}
	else
	{
		const int location = glGetUniformLocation(program, name.c_str());
		GLES2Video::CheckGLError(name + ": uniform parameter not found with glGetUniformLocation", logger);
		str_type::stringstream ss;
		ss << "Location obtained successfully [" << name << "] " << counter++ << ": " << location;
		logger.Log(ss.str(), Platform::FileLogger::INFO);
		locations[program] = location;
		return location;
	}
}