예제 #1
0
파일: Debug.cpp 프로젝트: d-phaz/Eve
//=================================================================================================
void eve::ogl::check_frame_buffer(wchar_t * p_pFunction, wchar_t * p_pFile, int32_t p_line, GLuint p_framebufferId)
{
	GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);

	if (status != GL_FRAMEBUFFER_COMPLETE)
	{
		std::wstring mess;
		switch (status)
		{
		case GL_FRAMEBUFFER_UNDEFINED:						mess = EVE_TXT("GL_FRAMEBUFFER_UNDEFINED");							break;
		case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:			mess = EVE_TXT("GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT");				break;
		case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:  mess = EVE_TXT("GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT");		break;
		case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER:			mess = EVE_TXT("GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER");			break;
		case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER:			mess = EVE_TXT("GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER");			break;
		case GL_FRAMEBUFFER_UNSUPPORTED:					mess = EVE_TXT("GL_FRAMEBUFFER_UNSUPPORTED");						break;
		case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:			mess = EVE_TXT("GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE");			break;

#if !defined(EVE_OS_DARWIN)
		case GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS:		mess = EVE_TXT("GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS");			break;
#endif
		}

		EVE_LOG_ERROR("OpenGL Error: %s in function %s in file %s at line %d.", mess.c_str(), p_pFunction, p_pFile, p_line);
		EVE_ASSERT_FAILURE;
	}
}
예제 #2
0
파일: Context.cpp 프로젝트: mrvux/Eve
//=================================================================================================
void eve::ogl::Context::init_OpenGL(void)
{
	glewInit();

	static bool firstLaunch = true;
	if (firstLaunch)
	{
		GLenum err = glGetError();
		if (err != GL_NO_ERROR)
		{
			// Log error
			EVE_LOG_ERROR("OpenGL extensions initialization failed (GLEW).");
			// Create fatal error window and exit app
			eve::sys::notify_fatal_error(EVE_TXT("OpenGL initialization failed.\n \n Please check your hardware and drivers capabilities."));
		}

		// Retrieve OpenGL version
		GLint majorVersion;
		GLint minorVersion;
		glGetIntegerv(GL_MAJOR_VERSION, &majorVersion);
		glGetIntegerv(GL_MINOR_VERSION, &minorVersion);
		EVE_LOG_INFO("Detected OpenGL version %d.%d.", majorVersion, minorVersion);

		// Test OpenGL version
		if (majorVersion < EVE_WINDOWS_OPENGL_MAJOR_VERSION)
		{
			// Create fatal error window and exit app
			eve::sys::notify_fatal_error(EVE_TXT("OpenGL initialization failed.\n \n Please check your hardware and drivers capabilities."));
		}
		else
		{
			if (minorVersion < EVE_WINDOWS_OPENGL_MINOR_VERSION)
			{
				// Create fatal error window and exit app
				eve::sys::notify_fatal_error(EVE_TXT("OpenGL initialization failed.\n \n Please check your hardware and drivers capabilities."));
			}
		}

		eve::ogl::init_debug_stream();

		firstLaunch = false;
	}
}
예제 #3
0
파일: Utils.cpp 프로젝트: d-phaz/Eve
//=================================================================================================
std::wstring eve::files::get_file_name(const std::wstring & p_path)
{
	std::wstring str(p_path);

	const size_t last_slash_idx = str.find_last_of(EVE_TXT("\\/"));
	if (std::wstring::npos != last_slash_idx)
	{
		str.erase(0, last_slash_idx + 1);
	}

	return str;
}
예제 #4
0
파일: Utils.cpp 프로젝트: d-phaz/Eve
//=================================================================================================
std::wstring eve::files::normalize_path(const std::wstring & p_path)
{
	std::wstring str(p_path);

#if defined(EVE_OS_WIN)
	size_t inc = 0;
	for (size_t i = 0; i < p_path.length(); i++)
	{
		if (p_path.at(i) == EVE_TXT('\\'))
		{
			str.insert(i + inc, EVE_TXT("\\"));
			inc++;
		}
		else if (p_path.at(i) == EVE_TXT('/'))
		{
			str.replace(i + inc, 1, EVE_TXT("\\"));
		}
	}
#endif

	return str;
}
예제 #5
0
파일: Utils.cpp 프로젝트: d-phaz/Eve
//=================================================================================================
std::wstring eve::files::remove_extension(const std::wstring & p_name)
{
	std::wstring str(p_name);

	const size_t last_dot_idx = str.find_last_of(EVE_TXT("."));
	if (std::wstring::npos != last_dot_idx)
	{
		const size_t length = str.length();
		str.erase(last_dot_idx, length);
	}

	return str;
}
예제 #6
0
파일: Utils.cpp 프로젝트: d-phaz/Eve
//=================================================================================================
std::wstring eve::files::remove_file_name(const std::wstring & p_path)
{
	std::wstring str(p_path);

	const size_t last_slash_idx = str.find_last_of(EVE_TXT("\\/"));
	if (std::wstring::npos != last_slash_idx)
	{
		const size_t length = str.length();
		str.erase(last_slash_idx + 1, length);
	}

	return str;
}
예제 #7
0
파일: Utils.cpp 프로젝트: d-phaz/Eve
//=================================================================================================
bool eve::files::exists(const std::wstring & p_path)
{
	bool bret = false;

	// Try to open file
	FILE * file = _wfopen(p_path.c_str(), EVE_TXT("r"));
	// File exists
	if (file)
	{
		// Update return value
		bret = true;
		// Free mem
		fclose(file);
	}

	return bret;
}
예제 #8
0
파일: Debug.cpp 프로젝트: d-phaz/Eve
//=================================================================================================
void eve::ogl::check_error(wchar_t * p_pFunction, wchar_t * p_pFile, int32_t p_line)
{
	int32_t Error = glGetError();
	if (Error != GL_NO_ERROR)
	{
		std::wstring mess;
		switch (Error)
		{
		case GL_INVALID_ENUM:					mess = EVE_TXT("GL_INVALID_ENUM");					break;
		case GL_INVALID_VALUE:					mess = EVE_TXT("GL_INVALID_VALUE");					break;
		case GL_INVALID_OPERATION:				mess = EVE_TXT("GL_INVALID_OPERATION");				break;
		case GL_INVALID_FRAMEBUFFER_OPERATION:	mess = EVE_TXT("GL_INVALID_FRAMEBUFFER_OPERATION");	break;
		case GL_STACK_OVERFLOW:					mess = EVE_TXT("GL_STACK_OVERFLOW");				break;
		case GL_STACK_UNDERFLOW:				mess = EVE_TXT("GL_STACK_UNDERFLOW");				break;
		case GL_OUT_OF_MEMORY:					mess = EVE_TXT("GL_OUT_OF_MEMORY");					break;
		default:								mess = EVE_TXT("UNKNOWN");							break;
		}

		EVE_LOG_ERROR("OpenGL Error: %s in function %s in file %s at line %d.", mess.c_str(), p_pFunction, p_pFile, p_line);
		EVE_ASSERT_FAILURE;
	}
}