Beispiel #1
0
bool RendererGL2::SwapBuffers()
{
    PROFILE_SCOPED()
#ifndef NDEBUG
    // Check if an error occurred during the frame. This is not very useful for
    // determining *where* the error happened. For that purpose, try GDebugger or
    // the GL_KHR_DEBUG extension
    GLenum err;
    err = glGetError();
    if (err != GL_NO_ERROR) {
        std::stringstream ss;
        ss << "OpenGL error(s) during frame:\n";
        while (err != GL_NO_ERROR) {
            ss << glerr_to_string(err) << std::endl;
            err = glGetError();
            if( err == GL_OUT_OF_MEMORY ) {
                ss << "Out-of-memory on graphics card." << std::endl
                   << "Recommend enabling \"Compress Textures\" in game options." << std::endl
                   << "Also try reducing City and Planet detail settings." << std::endl;
            }
        }
        Error("%s", ss.str().c_str());
    }
#endif

    GetWindow()->SwapBuffers();
    return true;
}
Beispiel #2
0
void RendererOGL::CheckErrors()
{
	GLenum err = glGetError();
	if( err ) {
		std::stringstream ss;
		ss << "OpenGL error(s) during frame:\n";
		while (err != GL_NO_ERROR) {
			ss << glerr_to_string(err) << '\n';
			err = glGetError();
			if( err == GL_OUT_OF_MEMORY ) {
				ss << "Out-of-memory on graphics card." << std::endl
					<< "Recommend enabling \"Compress Textures\" in game options." << std::endl
					<< "Also try reducing City and Planet detail settings." << std::endl;
			}
		}
		Warning("%s", ss.str().c_str());
	}
}
void RendererOGL::CheckErrors(const char *func /*= nullptr*/, const int line /*= nullptr*/)
{
	PROFILE_SCOPED()
#ifndef PIONEER_PROFILER
	GLenum err = glGetError();
	if( err ) {
		// static-cache current err that sparked this
		static GLenum s_prevErr = GL_NO_ERROR;
		const bool showWarning = (s_prevErr != err);
		s_prevErr = err;
		// now build info string
		std::stringstream ss;
		if(func) {
			ss << "In function " << std::string(func) << "\nOn line " << std::to_string(line) << "\n";
		}
		ss << "OpenGL error(s) during frame:\n";
		while (err != GL_NO_ERROR) {
			ss << glerr_to_string(err) << '\n';
			err = glGetError();
			if( err == GL_OUT_OF_MEMORY ) {
				ss << "Out-of-memory on graphics card." << std::endl
					<< "Recommend enabling \"Compress Textures\" in game options." << std::endl
					<< "Also try reducing City and Planet detail settings." << std::endl;
			}
#ifdef _WIN32
			else if (err == GL_INVALID_OPERATION) {
				ss << "Invalid operations can occur if you are using overlay software." << std::endl
					<< "Such as FRAPS, RivaTuner, MSI Afterburner etc." << std::endl
					<< "Please try disabling this kind of software and testing again, thankyou." << std::endl;
			}
#endif
		}
		// show warning dialog or just log to output
		if(showWarning)
			Warning("%s", ss.str().c_str());
		else
			Output("%s", ss.str().c_str());
	}
#endif
}
bool RendererLegacy::SwapBuffers()
{
#ifndef NDEBUG
	// Check if an error occurred during the frame. This is not very useful for
	// determining *where* the error happened. For that purpose, try GDebugger or
	// the GL_KHR_DEBUG extension
	GLenum err;
	err = glGetError();
	if (err != GL_NO_ERROR) {
		std::stringstream ss;
		ss << "OpenGL error(s) during frame:\n";
		while (err != GL_NO_ERROR) {
			ss << glerr_to_string(err) << '\n';
			err = glGetError();
		}
		OS::Error("%s", ss.str().c_str());
	}
#endif

	GetWindow()->SwapBuffers();
	return true;
}