Example #1
0
static void GlobalGL_sharedContextCreated (void)
{
	// report OpenGL information
	globalOutputStream() << "GL_VENDOR: " << reinterpret_cast<const char*> (glGetString(GL_VENDOR)) << "\n";
	globalOutputStream() << "GL_RENDERER: " << reinterpret_cast<const char*> (glGetString(GL_RENDERER)) << "\n";
	globalOutputStream() << "GL_VERSION: " << reinterpret_cast<const char*> (glGetString(GL_VERSION)) << "\n";
	globalOutputStream() << "GL_EXTENSIONS: " << reinterpret_cast<const char*> (glGetString(GL_EXTENSIONS)) << "\n";

	QGL_sharedContextCreated(GlobalOpenGL());

	GlobalShaderCache().realise();
	GlobalTexturesCache().realise();

	/* use default font here (Sans 10 is gtk default) */
	GtkSettings *settings = gtk_settings_get_default();
	gchar* fontname;
	g_object_get(settings, "gtk-font-name", &fontname, (char*) 0);
	g_font = glfont_create(fontname);
	// Fallbacks
	if (g_font.getPixelHeight() == -1)
		g_font = glfont_create("Sans 10");
	if (g_font.getPixelHeight() == -1)
		g_font = glfont_create("fixed 10");
	if (g_font.getPixelHeight() == -1)
		g_font = glfont_create("courier new 10");

	GlobalOpenGL().m_font = g_font.getDisplayList();
	GlobalOpenGL().m_fontHeight = g_font.getPixelHeight();
}
Example #2
0
void OpenGLModule::sharedContextCreated()
{
    // report OpenGL information
    globalOutputStream() << "GL_VENDOR: "
                         << reinterpret_cast<const char*>(glGetString(GL_VENDOR)) << "\n";
    globalOutputStream() << "GL_RENDERER: "
                         << reinterpret_cast<const char*>(glGetString(GL_RENDERER)) << "\n";
    globalOutputStream() << "GL_VERSION: "
                         << reinterpret_cast<const char*>(glGetString(GL_VERSION)) << "\n";
    globalOutputStream() << "GL_EXTENSIONS: "
                         << reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)) << "\n";

    GLenum err = glewInit();
    if (err != GLEW_OK)	{
        // glewInit failed
        globalErrorStream() << "GLEW error: " <<
                            reinterpret_cast<const char*>(glewGetErrorString(err));
    }

    GlobalRenderSystem().extensionsInitialised();
    GlobalRenderSystem().realise();

    _font = glfont_create("Sans 8");
    m_font = _font.getDisplayList();
    m_fontHeight = _font.getPixelHeight();
}