mirror of
https://github.com/glest/glest-source.git
synced 2025-08-22 07:52:51 +02:00
- added the ability to toggle hardware acceleration and full screen anti-aliasing via ini settings
- added video card info screen to options menu
This commit is contained in:
@@ -29,7 +29,7 @@ namespace Shared{ namespace Graphics{ namespace Gl{
|
||||
|
||||
void ContextGl::init(){
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
pcgl.init(colorBits, depthBits, stencilBits);
|
||||
pcgl.init(colorBits, depthBits, stencilBits, hardware_acceleration, fullscreen_anti_aliasing);
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
}
|
||||
|
||||
|
@@ -35,11 +35,11 @@ namespace Shared{ namespace Platform{
|
||||
// class PlatformContextGl
|
||||
// ======================================
|
||||
|
||||
void PlatformContextGl::init(int colorBits, int depthBits, int stencilBits) {
|
||||
void PlatformContextGl::init(int colorBits, int depthBits, int stencilBits,bool hardware_acceleration, bool fullscreen_anti_aliasing) {
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
Window::setupGraphicsScreen(depthBits, stencilBits);
|
||||
Window::setupGraphicsScreen(depthBits, stencilBits, hardware_acceleration, fullscreen_anti_aliasing);
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
|
@@ -345,7 +345,7 @@ void Window::destroy() {
|
||||
SDL_PushEvent(&event);
|
||||
}
|
||||
|
||||
void Window::setupGraphicsScreen(int depthBits, int stencilBits) {
|
||||
void Window::setupGraphicsScreen(int depthBits, int stencilBits, bool hardware_acceleration, bool fullscreen_anti_aliasing) {
|
||||
static int newDepthBits = depthBits;
|
||||
static int newStencilBits = stencilBits;
|
||||
if(depthBits >= 0)
|
||||
@@ -353,7 +353,13 @@ void Window::setupGraphicsScreen(int depthBits, int stencilBits) {
|
||||
if(stencilBits >= 0)
|
||||
newStencilBits = stencilBits;
|
||||
|
||||
//SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);
|
||||
if(fullscreen_anti_aliasing == true) {
|
||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS,1);
|
||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 16);
|
||||
}
|
||||
if(hardware_acceleration == true) {
|
||||
SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);
|
||||
}
|
||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
||||
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 1);
|
||||
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 1);
|
||||
|
44
source/shared_lib/sources/platform/sdl/window_gl.cpp
Normal file
44
source/shared_lib/sources/platform/sdl/window_gl.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest Shared Library (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
|
||||
//
|
||||
// You can redistribute this code and/or modify it under
|
||||
// the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
#include "window_gl.h"
|
||||
|
||||
#include "gl_wrap.h"
|
||||
#include "graphics_interface.h"
|
||||
#include "leak_dumper.h"
|
||||
|
||||
using namespace Shared::Graphics;
|
||||
|
||||
namespace Shared{ namespace Platform{
|
||||
|
||||
// =====================================================
|
||||
// class WindowGl
|
||||
// =====================================================
|
||||
|
||||
void WindowGl::initGl(int colorBits, int depthBits, int stencilBits,bool hardware_acceleration, bool fullscreen_anti_aliasing){
|
||||
context.setColorBits(colorBits);
|
||||
context.setDepthBits(depthBits);
|
||||
context.setStencilBits(stencilBits);
|
||||
context.setHardware_acceleration(hardware_acceleration);
|
||||
context.setFullscreen_anti_aliasing(fullscreen_anti_aliasing);
|
||||
|
||||
context.init();
|
||||
}
|
||||
|
||||
void WindowGl::makeCurrentGl() {
|
||||
GraphicsInterface::getInstance().setCurrentContext(&context);
|
||||
context.makeCurrent();
|
||||
}
|
||||
|
||||
void WindowGl::swapBuffersGl(){
|
||||
context.swapBuffers();
|
||||
}
|
||||
|
||||
}}//end namespace
|
Reference in New Issue
Block a user