Exemple #1
0
void Window::Init(
	const std::string & windowcaption,
	unsigned int resx, unsigned int resy,
	unsigned int bpp, unsigned int depthbpp,
	bool fullscreen, unsigned int antialiasing,
	std::ostream & info_output,
	std::ostream & error_output)
{
	Uint32 sdl_flags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC;
	if (SDL_Init(sdl_flags) < 0)
	{
		error_output << "SDL initialization failed: " << SDL_GetError() << std::endl;
		assert(0);
	}

	ChangeDisplay(resx, resy, bpp, depthbpp, fullscreen, antialiasing, info_output, error_output);

	SDL_SetWindowTitle(window, windowcaption.c_str());

	// initialize GLEW
	GLenum glew_err = glewInit();
	if (glew_err != GLEW_OK)
	{
		error_output << "GLEW failed to initialize: " << glewGetErrorString(glew_err) << std::endl;
		assert(glew_err == GLEW_OK);
		initialized = false;
	}
	else
	{
		info_output << "Using GLEW " << glewGetString(GLEW_VERSION) << std::endl;
		initialized = true;
	}

	LogOpenGLInfo(info_output);
}
Exemple #2
0
void WINDOW_SDL::Init(const std::string & windowcaption, unsigned int resx, unsigned int resy, unsigned int bpp, unsigned int depthbpp, bool fullscreen, unsigned int antialiasing, bool enableGL3, std::ostream & info_output, std::ostream & error_output)
{
	if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK) < 0)
	{
        // Die...
		error_output << "SDL initialization failed: " << SDL_GetError() << std::endl;
		assert(0);
	}

	ChangeDisplay(resx, resy, bpp, depthbpp, fullscreen, antialiasing, enableGL3, info_output, error_output);

	SDL_WM_SetCaption(windowcaption.c_str(), NULL);

	initialized = true;
}
//-------------------------------------------------------------------------
void CSlot::SetDisplayList( const vector<IObject*>& p_Value )
{
	int i = p_Value.size();
	m_vecDisplayList.resize( i );
	while( i-- )
	{
		m_vecDisplayList[i] = p_Value[i];
	}
	if( m_nDisplayIndex >= 0 )
	{
		int nDisplayIndexBackup = m_nDisplayIndex;
		m_nDisplayIndex = -1;
		ChangeDisplay( nDisplayIndexBackup );
	}
}
bool GraphicsGL2::Init(
	const std::string & newshaderpath,
	unsigned resx, unsigned resy,
	unsigned bpp, unsigned depthbpp,
	bool fullscreen, unsigned antialiasing,
	bool enableshadows, int new_shadow_distance,
	int new_shadow_quality, int reflection_type,
	const std::string & static_reflectionmap_file,
	const std::string & static_ambientmap_file,
	int anisotropy, int texturesize,
	int lighting_quality, bool newbloom,
	bool newnormalmaps, bool dynamicsky,
	const std::string & renderconfig,
	std::ostream & info_output,
	std::ostream & error_output)
{
	shadows = enableshadows;
	shadow_distance = new_shadow_distance;
	shadow_quality = new_shadow_quality;
	lighting = lighting_quality;
	bloom = newbloom;
	normalmaps = newnormalmaps;
	renderconfigfile = renderconfig;
	shaderpath = newshaderpath;
	sky_dynamic = dynamicsky;

	if (reflection_type == 1)
		reflection_status = REFLECTION_STATIC;
	else if (reflection_type == 2)
		reflection_status = REFLECTION_DYNAMIC;

	ChangeDisplay(resx, resy, error_output);

	fsaa = 1;
	if (antialiasing > 1)
		fsaa = antialiasing;

	if (GLEW_EXT_texture_filter_anisotropic)
		glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &max_anisotropy);

	info_output << "Maximum anisotropy: " << max_anisotropy << std::endl;

	if (renderconfigfile == "noshaders.conf")
	{
		DisableShaders(error_output);
	}
	else if (!GLEW_ARB_multitexture)
	{
		info_output << "Your video card doesn't support multitexturing.  Disabling shaders." << std::endl;
		DisableShaders(error_output);
	}
	else if (!GLEW_ARB_texture_cube_map)
	{
		info_output << "Your video card doesn't support cube maps.  Disabling shaders." << std::endl;
		DisableShaders(error_output);
	}
	else if (!GLEW_ARB_texture_non_power_of_two)
	{
		info_output << "Your video card doesn't support non-power-of-two textures.  Disabling shaders." << std::endl;
		DisableShaders(error_output);
	}
	else
	{
		GLint maxattach;
		glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS, &maxattach);
		info_output << "Maximum color attachments: " << maxattach << std::endl;

		const GLint mrtreq = 1;
		GLint mrt = 0;
		glGetIntegerv(GL_MAX_DRAW_BUFFERS, &mrt);
		info_output << "Maximum draw buffers (" << mrtreq << " required): " << mrt << std::endl;

		#ifndef FBOEXT
		bool use_fbos = GLEW_ARB_framebuffer_object && mrt >= mrtreq && maxattach >= mrtreq;
		#else
		bool use_fbos = GLEW_EXT_framebuffer_object && mrt >= mrtreq && maxattach >= mrtreq;
		#endif

		if (renderconfigfile != "nofbos.conf" && !use_fbos)
		{
			info_output << "Your video card doesn't support framebuffer objects." << std::endl;
			info_output << "Fall back to nofbos.conf." << std::endl;
			renderconfigfile = "nofbos.conf";
		}

		if (GLEW_VERSION_2_0 && GLEW_ARB_shading_language_100 && GLEW_ARB_fragment_shader)
		{
			if ((reflection_status == REFLECTION_STATIC || reflection_status == REFLECTION_DYNAMIC) && !static_reflectionmap_file.empty())
			{
				TextureInfo t;
				t.cube = true;
				t.verticalcross = true;
				t.mipmap = true;
				t.anisotropy = anisotropy;
				t.maxsize = TextureInfo::Size(texturesize);
				static_reflection.Load(static_reflectionmap_file, t, error_output);
			}

			if (!static_ambientmap_file.empty())
			{
				TextureInfo t;
				t.cube = true;
				t.verticalcross = true;
				t.mipmap = false;
				t.anisotropy = anisotropy;
				t.maxsize = TextureInfo::Size(texturesize);
				static_ambient.Load(static_ambientmap_file, t, error_output);
			}

			EnableShaders(info_output, error_output);
		}
		else
		{
			info_output << "Your video card doesn't support shaders. Fall back to noshaders.conf." << std::endl;
			DisableShaders(error_output);
		}
	}

	info_output << "Renderer: " << shaderpath << "/" << renderconfigfile << std::endl;
	initialized = true;
	return true;
}
Exemple #5
0
OSStatus ComboBoxHandler(EventHandlerCallRef next,
                         EventRef event, void *data)
{
    WindowRef window;
    HIViewRef combo;
    CFIndex index;
    UInt32 id;

    // Get the window
    
    window = ActiveNonFloatingWindow();

    // Get the control

    GetEventParameter(event, kEventParamDirectObject,
                      typeControlRef, NULL, sizeof(combo),
                      NULL, &combo);

    // Get the index

    GetEventParameter(event, kEventParamComboBoxListSelectedItemIndex,
                      typeCFIndex, NULL, sizeof(index),
                      NULL, &index);

    // Get the command id

    HIViewGetCommandID(combo, &id);

    // Switch on the command id
        
    switch (id)
    {
        // Instrument

    case kCommandInst:
        instrument = index;
        ChangeInstrument(instrument);
        break;

        // Key

    case kCommandKey:
        key = index;
	type = types[key];
	ChangeDisplay();
        break;

        // Something else

    default:
        return eventNotHandledErr;
    }

    // Clear the keyboard focus, otherwise the focus stays on the
    // combo box and makes it drop down when the user presses a key

    ClearKeyboardFocus(window);

    // Report success

    return noErr;
}
Exemple #6
0
OSStatus CommandHandler(EventHandlerCallRef next,
                        EventRef event, void *data)
{
    HICommandExtended command;
    WindowRef window;
    UInt32 value;

    // Get the command

    GetEventParameter(event, kEventParamDirectObject,
                      typeHICommand, NULL, sizeof(command),
                      NULL, &command);

    // Get the value

    value = HIViewGetValue(command.source.control);

    // Switch on the command ID

    switch (command.commandID)
    {
        // Key or instrument control

    case kCommandKey:
    case kCommandInst:

	// If the combo box list isn't visible (the user just closed
	// it)

        if (!HIComboBoxIsListVisible(command.source.control))
        {
            // Get the window
    
            window = ActiveNonFloatingWindow();

            // Clear the keyboard focus, otherwise the focus stays on the
            // combo box and makes it drop down when the user presses a key

            ClearKeyboardFocus(window);
        }
        break;

        // Reverse

    case kCommandReverse:
        reverse = value;
	ChangeDisplay();
        break;

        // Volume

    case kCommandVolume:
        volume = value;
        break;

	// Notes

    case kCommandNote:
	shownotes = value;
	ChangeDisplay();
	break;

        // Quit

    case kHICommandQuit:

        // Let the default handler handle it

    default:
        return eventNotHandledErr;
    }

    // Report success

    return noErr;
}
Exemple #7
0
bool GraphicsGL2::Init(
	const std::string & newshaderpath,
	unsigned resx, unsigned resy,
	unsigned bpp, unsigned depthbpp,
	bool fullscreen, unsigned antialiasing,
	bool enableshadows, int new_shadow_distance,
	int new_shadow_quality, int reflection_type,
	const std::string & static_reflectionmap_file,
	const std::string & static_ambientmap_file,
	int anisotropy, int texturesize,
	int lighting_quality, bool newbloom,
	bool newnormalmaps, bool dynamicsky,
	const std::string & renderconfig,
	std::ostream & info_output,
	std::ostream & error_output)
{
	assert(!renderconfig.empty() && "Render configuration name string empty.");

	if (!GLEW_VERSION_2_0)
	{
		error_output << "Graphics card or driver does not support required GL_VERSION_2_0." << std::endl;
		return false;
	}

	shadows = enableshadows;
	shadow_distance = new_shadow_distance;
	shadow_quality = new_shadow_quality;
	lighting = lighting_quality;
	bloom = newbloom;
	normalmaps = newnormalmaps;
	renderconfigfile = renderconfig;
	shaderpath = newshaderpath;
	sky_dynamic = dynamicsky;

	if (reflection_type == 1)
		reflection_status = REFLECTION_STATIC;
	else if (reflection_type == 2)
		reflection_status = REFLECTION_DYNAMIC;

	fsaa = (antialiasing > 1) ? antialiasing : 1;

	ChangeDisplay(resx, resy, error_output);

	if (GLEW_EXT_texture_filter_anisotropic)
		glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &max_anisotropy);
	info_output << "Maximum anisotropy: " << max_anisotropy << std::endl;

	GLint maxattach;
	glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS, &maxattach);
	info_output << "Maximum color attachments: " << maxattach << std::endl;

	const GLint mrtreq = 1;
	GLint mrt = 0;
	glGetIntegerv(GL_MAX_DRAW_BUFFERS, &mrt);
	info_output << "Maximum draw buffers (" << mrtreq << " required): " << mrt << std::endl;

	#ifndef FBOEXT
	bool use_fbos = GLEW_ARB_framebuffer_object && mrt >= mrtreq && maxattach >= mrtreq;
	#else
	bool use_fbos = GLEW_EXT_framebuffer_object && mrt >= mrtreq && maxattach >= mrtreq;
	#endif

	if (renderconfigfile != "basic.conf" && !use_fbos)
	{
		info_output << "Graphics card doesn't support framebuffer objects." << std::endl;

		shadows = false;
		sky_dynamic = false;
		renderconfigfile = "basic.conf";
		info_output << "Fall back to: " << renderconfigfile << std::endl;
	}

	if (!static_reflectionmap_file.empty() && reflection_status != REFLECTION_DISABLED)
	{
		TextureInfo t;
		t.cube = true;
		t.verticalcross = true;
		t.mipmap = true;
		t.anisotropy = anisotropy;
		t.maxsize = TextureInfo::Size(texturesize);
		static_reflection.Load(static_reflectionmap_file, t, error_output);
	}

	if (!static_ambientmap_file.empty())
	{
		TextureInfo t;
		t.cube = true;
		t.verticalcross = true;
		t.mipmap = false;
		t.anisotropy = anisotropy;
		t.maxsize = TextureInfo::Size(texturesize);
		static_ambient.Load(static_ambientmap_file, t, error_output);
	}

	if (!EnableShaders(info_output, error_output))
	{
		// try to fall back to basic.conf
		if (renderconfigfile != "basic.conf")
		{
			shadows = false;
			sky_dynamic = false;
			renderconfigfile = "basic.conf";
			info_output << "Fall back to: " << renderconfigfile << std::endl;

			if (!EnableShaders(info_output, error_output))
				return false;
		}
	}

	if (sky_dynamic)
	{
		sky.reset(new Sky(*this, error_output));
		texture_inputs["sky"] = sky.get();
	}

	// gl state setup
	glEnable(GL_LINE_SMOOTH);
	glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
	glShadeModel(GL_SMOOTH);
	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
	glClearColor(0, 0, 0, 0);
	glClearDepth(1);
	glPolygonOffset(-1, -1);

	info_output << "Renderer: " << shaderpath << "/" << renderconfigfile << std::endl;
	initialized = true;

	return true;
}
void OculusWorldDemoApp::OnKey(OVR::KeyCode key, int chr, bool down, int modifiers)
{
    if (Menu.OnKey(key, chr, down, modifiers))
        return;

    // Handle player movement keys.
    if (ThePlayer.HandleMoveKey(key, down))
        return;

    switch(key)
    {
    case Key_Q:
        if (down && (modifiers & Mod_Control))
            pPlatform->Exit(0);
        break;
        
    case Key_Escape:
        // Back to primary windowed
        if (!down) ChangeDisplay ( true, false, false );
        break;

    case Key_F9:
        // Cycle through displays, going fullscreen on each one.
        if (!down) ChangeDisplay ( false, true, false );
        break;
        
#ifdef OVR_OS_MAC
     // F11 is reserved on Mac, F10 doesn't work on Windows
    case Key_F10:  
#else
    case Key_F11:
#endif
        if (!down) ChangeDisplay ( false, false, true );
        break;
        
    case Key_R:
        if (!down)
        {
            ovrHmd_ResetSensor(Hmd);
            Menu.SetPopupMessage("Sensor Fusion Reset");
        }
        break;

    case Key_Space:
        if (!down)
        {
            TextScreen = (enum TextScreen)((TextScreen + 1) % Text_Count);
        }
        break;

    // Distortion correction adjustments
    case Key_Backslash:        
        break;
        // Holding down Shift key accelerates adjustment velocity.
    case Key_Shift:
        ShiftDown = down;
        break;
    case Key_Control:
        CtrlDown = down;
        break;

       // Reset the camera position in case we get stuck
    case Key_T:
        if (down)
        {
            struct {
                float  x, z;
                float  YawDegrees;
            }  Positions[] =
            {
               // x         z           Yaw
                { 7.7f,     -1.0f,      180.0f },   // The starting position.
                { 10.0f,    10.0f,      90.0f  },   // Outside, looking at some trees.
                { 19.26f,   5.43f,      22.0f  },   // Outside, looking at the fountain.
            };

            static int nextPosition = 0;
            nextPosition = (nextPosition + 1) % (sizeof(Positions)/sizeof(Positions[0]));

            ThePlayer.BodyPos = Vector3f(Positions[nextPosition].x,
                                         ThePlayer.UserEyeHeight, Positions[nextPosition].z);
            ThePlayer.BodyYaw = DegreeToRad( Positions[nextPosition].YawDegrees );
        }
        break;

    case Key_Num1:
        ThePlayer.BodyPos = Vector3f(-1.85f, 6.0f, -0.52f);
        ThePlayer.BodyPos.y += ThePlayer.UserEyeHeight;
        ThePlayer.BodyYaw = 3.1415f / 2;
        ThePlayer.HandleMovement(0, &CollisionModels, &GroundCollisionModels, ShiftDown);
        break;

     default:
        break;
    }
}
Exemple #9
0
bool GRAPHICS_GL2::Init(
	const std::string & shaderpath,
	unsigned int resx, unsigned int resy, unsigned int bpp,
	unsigned int depthbpp, bool fullscreen, bool shaders,
	unsigned int antialiasing, bool enableshadows, int new_shadow_distance,
	int new_shadow_quality, int reflection_type,
	const std::string & static_reflectionmap_file,
	const std::string & static_ambientmap_file,
	int anisotropy, int texturesize,
	int lighting_quality, bool newbloom, bool newnormalmaps,
	const std::string & renderconfig,
	std::ostream & info_output, std::ostream & error_output)
{
	shadows = enableshadows;
	shadow_distance = new_shadow_distance;
	shadow_quality = new_shadow_quality;
	lighting = lighting_quality;
	bloom = newbloom;
	normalmaps = newnormalmaps;
	renderconfigfile = renderconfig;

	if (reflection_type == 1)
		reflection_status = REFLECTION_STATIC;
	else if (reflection_type == 2)
		reflection_status = REFLECTION_DYNAMIC;

	ChangeDisplay(resx, resy, error_output);

	fsaa = 1;
	if (antialiasing > 1)
		fsaa = antialiasing;

	if (!GLEW_ARB_multitexture)
	{
		info_output << "Your video card doesn't support multitexturing.  Disabling shaders." << std::endl;
		DisableShaders(shaderpath, error_output);
	}
	else if (!GLEW_ARB_texture_cube_map)
	{
		info_output << "Your video card doesn't support cube maps.  Disabling shaders." << std::endl;
		DisableShaders(shaderpath, error_output);
	}
	else if (!GLEW_ARB_framebuffer_object)
	{
		info_output << "Your video card doesn't support framebuffer objects.  Disabling shaders." << std::endl;
		DisableShaders(shaderpath, error_output);
	}
	else if (!GLEW_ARB_draw_buffers)
	{
		info_output << "Your video card doesn't support multiple draw buffers.  Disabling shaders." << std::endl;
		DisableShaders(shaderpath, error_output);
	}
	else if (!GLEW_ARB_texture_non_power_of_two)
	{
		info_output << "Your video card doesn't support non-power-of-two textures.  Disabling shaders." << std::endl;
		DisableShaders(shaderpath, error_output);
	}
	else if (!GLEW_ARB_texture_float)
	{
		info_output << "Your video card doesn't support floating point textures.  Disabling shaders." << std::endl;
		DisableShaders(shaderpath, error_output);
	}
	else if (!GLEW_ARB_half_float_pixel)
	{
		info_output << "Your video card doesn't support 16-bit floats.  Disabling shaders." << std::endl;
		DisableShaders(shaderpath, error_output);
	}
	else if (!GLEW_ARB_shader_texture_lod && !GLEW_VERSION_2_1) // texture2DLod in logluminance shader
	{
		info_output << "Your video card doesn't support texture2DLod.  Disabling shaders." << std::endl;
		DisableShaders(shaderpath, error_output);
	}
	else
	{
		GLint maxattach;
		glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS, &maxattach);
		info_output << "Maximum color attachments: " << maxattach << std::endl;

		const GLint reqmrt = 1;

		GLint mrt;
		glGetIntegerv(GL_MAX_DRAW_BUFFERS, &mrt);
		info_output << "Maximum draw buffers (" << reqmrt << " required): " << mrt << std::endl;

		if (GLEW_ARB_shading_language_100 && GLEW_VERSION_2_0 && shaders && GLEW_ARB_fragment_shader && mrt >= reqmrt && maxattach >= reqmrt)
		{
			EnableShaders(shaderpath, info_output, error_output);
		}
		else
		{
			info_output << "Disabling shaders" << std::endl;
			DisableShaders(shaderpath, error_output);
		}
	}

	//load static reflection map for dynamic reflections too, since we may need it
	if ((reflection_status == REFLECTION_STATIC || reflection_status == REFLECTION_DYNAMIC) && !static_reflectionmap_file.empty())
	{
		TEXTUREINFO t;
		t.cube = true;
		t.verticalcross = true;
		t.mipmap = true;
		t.anisotropy = anisotropy;
		t.maxsize = TEXTUREINFO::Size(texturesize);
		static_reflection.Load(static_reflectionmap_file, t, error_output);
	}

	if (!static_ambientmap_file.empty())
	{
		TEXTUREINFO t;
		t.cube = true;
		t.verticalcross = true;
		t.mipmap = false;
		t.anisotropy = anisotropy;
		t.maxsize = TEXTUREINFO::Size(texturesize);
		static_ambient.Load(static_ambientmap_file, t, error_output);
	}

	if (GLEW_EXT_texture_filter_anisotropic)
		glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &max_anisotropy);

	info_output << "Maximum anisotropy: " << max_anisotropy << std::endl;

	GLUTIL::CheckForOpenGLErrors("Shader loading", error_output);

	initialized = true;

	return true;
}
Exemple #10
0
bool GraphicsGL2::Init(
	const std::string & newshaderpath,
	unsigned resx, unsigned resy, unsigned depthbpp,
	bool fullscreen, unsigned antialiasing,
	bool enableshadows, int new_shadow_distance,
	int new_shadow_quality, int reflection_type,
	const std::string & static_reflectionmap_file,
	const std::string & static_ambientmap_file,
	int anisotropy, int texturesize,
	int lighting_quality, bool newbloom,
	bool newnormalmaps, bool dynamicsky,
	const std::string & renderconfig,
	std::ostream & info_output,
	std::ostream & error_output)
{
	assert(!renderconfig.empty() && "Render configuration name string empty.");

	const GLubyte * version = glGetString(GL_VERSION);
	if (version[0] < '2')
	{
		error_output << "Graphics card or driver does not support required GL Version: 2.0" << std::endl;
		return false;
	}
	if (version[0] > '2')
	{
		int major_version = 0;
		int minor_version = 0;
		glGetIntegerv(GL_MAJOR_VERSION, &major_version);
		glGetIntegerv(GL_MINOR_VERSION, &minor_version);
		glsl_330 = (major_version > 3 || (major_version == 3 && minor_version >= 3));
	}

	#ifdef _WIN32
	// workaround for broken vao implementation Intel/Windows
	{
		const std::string vendor = (const char*)glGetString(GL_VENDOR);
		if (vendor == "Intel")
			vertex_buffer.BindElementBufferExplicitly();
	}
	#endif

	shadows = enableshadows;
	shadow_distance = new_shadow_distance;
	shadow_quality = new_shadow_quality;
	lighting = lighting_quality;
	bloom = newbloom;
	normalmaps = newnormalmaps;
	renderconfigfile = renderconfig;
	shaderpath = newshaderpath;
	sky_dynamic = dynamicsky;

	if (reflection_type == 1)
		reflection_status = REFLECTION_STATIC;
	else if (reflection_type == 2)
		reflection_status = REFLECTION_DYNAMIC;

	fsaa = (antialiasing > 1) ? antialiasing : 1;

	ChangeDisplay(resx, resy, error_output);

	if (GLC_EXT_texture_filter_anisotropic)
		glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &max_anisotropy);
	info_output << "Maximum anisotropy: " << max_anisotropy << std::endl;

	GLint maxattach;
	glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS, &maxattach);
	info_output << "Maximum color attachments: " << maxattach << std::endl;

	const GLint mrtreq = 1;
	GLint mrt = 0;
	glGetIntegerv(GL_MAX_DRAW_BUFFERS, &mrt);
	info_output << "Maximum draw buffers (" << mrtreq << " required): " << mrt << std::endl;

	bool use_fbos = GLC_ARB_framebuffer_object && mrt >= mrtreq && maxattach >= mrtreq;
	if (renderconfigfile != "basic.conf" && !use_fbos)
	{
		info_output << "Graphics card doesn't support framebuffer objects." << std::endl;

		shadows = false;
		sky_dynamic = false;
		renderconfigfile = "basic.conf";
		info_output << "Fall back to: " << renderconfigfile << std::endl;
	}

	if (!static_reflectionmap_file.empty() && reflection_status != REFLECTION_DISABLED)
	{
		TextureInfo t;
		t.cube = true;
		t.verticalcross = true;
		t.mipmap = true;
		t.anisotropy = anisotropy;
		t.maxsize = TextureInfo::Size(texturesize);
		static_reflection.Load(static_reflectionmap_file, t, error_output);
	}

	if (!static_ambientmap_file.empty())
	{
		TextureInfo t;
		t.cube = true;
		t.verticalcross = true;
		t.mipmap = false;
		t.anisotropy = anisotropy;
		t.maxsize = TextureInfo::Size(texturesize);
		static_ambient.Load(static_ambientmap_file, t, error_output);
	}

	if (!EnableShaders(info_output, error_output))
	{
		// try to fall back to basic.conf
		if (renderconfigfile != "basic.conf")
		{
			shadows = false;
			sky_dynamic = false;
			renderconfigfile = "basic.conf";
			info_output << "Fall back to: " << renderconfigfile << std::endl;

			if (!EnableShaders(info_output, error_output))
				return false;
		}
	}

	if (sky_dynamic)
	{
		sky.reset(new Sky(*this, error_output));
		texture_inputs["sky"] = sky.get();
	}

	// gl state setup
	glPolygonOffset(-1, -1);

	info_output << "Renderer: " << shaderpath << "/" << renderconfigfile << std::endl;
	initialized = true;

	return true;
}