コード例 #1
0
	// /////////////////////////////////////////////////////////////////
	//
	// /////////////////////////////////////////////////////////////////
	void TextureManager::SetTextureFilterMode(const TextureFilterMode mode)
	{
		if(mode < eNumberModes && mode != m_currTexFilterMode)
		{
			TextureFilterMode oldMode(m_currTexFilterMode);
			m_currTexFilterMode = mode;

			// Update all loaded textures with the new filter mode.
			switch(m_currTexFilterMode)
			{
				case eBasic: m_currMinFilter = GL_NEAREST; m_currMagFilter = GL_NEAREST; break;
				case eBasicMipMap: m_currMinFilter = GL_NEAREST_MIPMAP_NEAREST; m_currMagFilter = GL_LINEAR; break;
				case eBilinear: m_currMinFilter = GL_LINEAR_MIPMAP_NEAREST; m_currMagFilter = GL_LINEAR; break;
				case eTrilinear:
#ifdef GLEW_EXT_texture_filter_anisotropic
				case eAnisotropic:
#endif
					m_currMinFilter = GL_LINEAR_MIPMAP_LINEAR; m_currMagFilter = GL_LINEAR;
				break;
			}

			// Update the filter levels of all the textures to match the new filter levels.
			UpdateTextureFilters(boost::optional<TextureFilterMode>(oldMode));
		}
	}
コード例 #2
0
void SDLWindow::updateSize(bool reinit) {
	
	const SDL_VideoInfo * vid = SDL_GetVideoInfo();
	
	DisplayMode oldMode(size_, depth_);
	
	size_ = Vec2i(vid->current_w, vid->current_h);
	depth_ = vid->vfmt->BitsPerPixel;
	
	// Finally, set the viewport for the newly created device
	arx_assert(renderer != NULL);
	
#if ARX_PLATFORM == ARX_PLATFORM_WIN32
	// use reinit as-is
#elif ARX_PLATFORM == ARX_PLATFORM_LINUX || ARX_PLATFORM == ARX_PLATFORM_BSD
	reinit = false; // Never needed under linux & bsd
#else
	reinit = true; // By default, always reinit to avoid issues on untested platforms
#endif
	
	if(reinit && !reinterpret_cast<OpenGLRenderer *>(renderer)->isInitialized()) {
		reinterpret_cast<OpenGLRenderer *>(renderer)->reinit();
		renderer->SetViewport(Rect(size_.x, size_.y));
		onRendererInit();
	} else {
		renderer->SetViewport(Rect(size_.x, size_.y));
	}
	
	if(size_ != oldMode.resolution) {
		onResize(size_.x, size_.y);
	}
}