Пример #1
0
GLUSboolean GLUSAPIENTRY glusCreateWindow(const char* title, const GLUSint width, const GLUSint height, const EGLint* attribList, const GLUSboolean fullscreen)
{
	EGLConfig eglConfig;

	EGLint eglNativeVisualID;

	EGLNativeWindowType eglNativeWindowType;

	if (g_windowCreated)
	{
		glusLogPrint(GLUS_LOG_ERROR, "Window already exists");

		return GLUS_FALSE;
	}

	if (!glusEGLCreateContext(_glusGetNativeDisplayType(), &g_eglDisplay, &eglConfig, &g_eglContext, attribList, g_eglContextClientVersion))
	{
		glusLogPrint(GLUS_LOG_ERROR, "Could preinitialize EGL");

		glusDestroyWindow();

		return GLUS_FALSE;
	}

	if (!glusEGLGetNativeVisualID(g_eglDisplay, eglConfig, &eglNativeVisualID))
	{
		glusLogPrint(GLUS_LOG_ERROR, "Could not get native visual ID");

		glusDestroyWindow();

		return GLUS_FALSE;
	}

	eglNativeWindowType = _glusCreateNativeWindowType(title, width, height, fullscreen, g_noResize, eglNativeVisualID);

	if (!eglNativeWindowType)
	{
		glusLogPrint(GLUS_LOG_ERROR, "Could not create native window");

		glusDestroyWindow();

		return GLUS_FALSE;
	}

	if (!glusEGLCreateWindowSurfaceMakeCurrent(eglNativeWindowType, &g_eglDisplay, &eglConfig, &g_eglContext, &g_eglSurface))
	{
		glusLogPrint(GLUS_LOG_ERROR, "Could not post initialize EGL");

		glusDestroyWindow();

		return GLUS_FALSE;
	}

	_glusGetWindowSize(&g_width, &g_height);

	g_windowCreated = GLUS_TRUE;

	return GLUS_TRUE; // Success
}
Пример #2
0
GLUSboolean GLUSAPIENTRY glusWindowCreate(const GLUSchar* title, const GLUSint width, const GLUSint height, const GLUSboolean fullscreen, const GLUSboolean noResize, const EGLint* configAttribList, const EGLint* contextAttribList, const EGLint* surfaceAttribList)
{
	EGLConfig eglConfig;

	EGLNativeWindowType eglNativeWindowType;

	EGLint nativeVisualID = 0;

	if (g_windowCreated)
	{
		glusLogPrint(GLUS_LOG_ERROR, "Window already exists");

		return GLUS_FALSE;
	}

	if (!glusEGLCreateContext(_glusOsGetNativeDisplayType(), &g_eglDisplay, &eglConfig, &g_eglContext, configAttribList, contextAttribList))
	{
		glusWindowDestroy();

		return GLUS_FALSE;
	}

	eglGetConfigAttrib(g_eglDisplay, eglConfig, EGL_NATIVE_VISUAL_ID, &nativeVisualID);

	eglNativeWindowType = _glusOsCreateNativeWindowType(title, width, height, fullscreen, noResize, nativeVisualID);

	if (!eglNativeWindowType)
	{
		glusLogPrint(GLUS_LOG_ERROR, "Could not create native window");

		glusWindowDestroy();

		return GLUS_FALSE;
	}

	if (!glusEGLCreateWindowSurfaceMakeCurrent(eglNativeWindowType, &g_eglDisplay, &eglConfig, &g_eglContext, &g_eglSurface, surfaceAttribList))
	{
		glusWindowDestroy();

		return GLUS_FALSE;
	}

	_glusOsGetWindowSize(&g_width, &g_height);

	g_windowCreated = GLUS_TRUE;

	return GLUS_TRUE; // Success
}