- 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:
parent
472abf62f2
commit
61b77fe645
|
@ -1876,8 +1876,9 @@ void Renderer::renderMinimap(){
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
|
|
||||||
glBegin(GL_TRIANGLES);
|
|
||||||
glColor4f(1.f, 1.f, 1.f, 1.f);
|
glColor4f(1.f, 1.f, 1.f, 1.f);
|
||||||
|
glBegin(GL_TRIANGLES);
|
||||||
|
|
||||||
glVertex2i(mx+x, my+mh-y);
|
glVertex2i(mx+x, my+mh-y);
|
||||||
|
|
||||||
glColor4f(1.f, 1.f, 1.f, 0.0f);
|
glColor4f(1.f, 1.f, 1.f, 0.0f);
|
||||||
|
|
|
@ -535,6 +535,9 @@ int glestMain(int argc, char** argv){
|
||||||
//string test = lang.get("ExitGameServer?");
|
//string test = lang.get("ExitGameServer?");
|
||||||
//printf("[%s]",test.c_str());
|
//printf("[%s]",test.c_str());
|
||||||
|
|
||||||
|
Renderer &renderer= Renderer::getInstance();
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] OpenGL Info:\n%s\n",__FILE__,__FUNCTION__,__LINE__,renderer.getGlInfo().c_str());
|
||||||
|
|
||||||
//main loop
|
//main loop
|
||||||
while(Window::handleEvent()){
|
while(Window::handleEvent()){
|
||||||
program->loop();
|
program->loop();
|
||||||
|
|
|
@ -454,7 +454,7 @@ void Program::init(WindowGl *window, bool initSound, bool toggleFullScreen){
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
window->initGl(config.getInt("ColorBits"), config.getInt("DepthBits"), config.getInt("StencilBits"));
|
window->initGl(config.getInt("ColorBits"), config.getInt("DepthBits"), config.getInt("StencilBits"),config.getBool("HardwareAcceleration","false"),config.getBool("FullScreenAntiAliasing","false"));
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "menu_state_root.h"
|
#include "menu_state_root.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include "menu_state_graphic_info.h"
|
||||||
|
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
@ -226,6 +227,9 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu):
|
||||||
buttonAutoConfig.setText(lang.get("AutoConfig"));
|
buttonAutoConfig.setText(lang.get("AutoConfig"));
|
||||||
buttonAutoConfig.init(450, buttonRowPos, 125);
|
buttonAutoConfig.init(450, buttonRowPos, 125);
|
||||||
|
|
||||||
|
buttonVideoInfo.setText(lang.get("VideoInfo"));
|
||||||
|
buttonVideoInfo.init(620, buttonRowPos, 100);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuStateOptions::showMessageBox(const string &text, const string &header, bool toggle){
|
void MenuStateOptions::showMessageBox(const string &text, const string &header, bool toggle){
|
||||||
|
@ -311,6 +315,10 @@ void MenuStateOptions::mouseClick(int x, int y, MouseButton mouseButton){
|
||||||
saveConfig();
|
saveConfig();
|
||||||
mainMenu->setState(new MenuStateOptions(program, mainMenu));
|
mainMenu->setState(new MenuStateOptions(program, mainMenu));
|
||||||
}
|
}
|
||||||
|
else if(buttonVideoInfo.mouseClick(x, y)){
|
||||||
|
soundRenderer.playFx(coreData.getClickSoundA());
|
||||||
|
mainMenu->setState(new MenuStateGraphicInfo(program, mainMenu));
|
||||||
|
}
|
||||||
else if(labelPlayerName.mouseClick(x, y) && ( activeInputLabel != &labelPlayerName )){
|
else if(labelPlayerName.mouseClick(x, y) && ( activeInputLabel != &labelPlayerName )){
|
||||||
setActiveInputLable(&labelPlayerName);
|
setActiveInputLable(&labelPlayerName);
|
||||||
}
|
}
|
||||||
|
@ -338,6 +346,7 @@ void MenuStateOptions::mouseMove(int x, int y, const MouseState *ms){
|
||||||
buttonOk.mouseMove(x, y);
|
buttonOk.mouseMove(x, y);
|
||||||
buttonAbort.mouseMove(x, y);
|
buttonAbort.mouseMove(x, y);
|
||||||
buttonAutoConfig.mouseMove(x, y);
|
buttonAutoConfig.mouseMove(x, y);
|
||||||
|
buttonVideoInfo.mouseMove(x, y);
|
||||||
listBoxLang.mouseMove(x, y);
|
listBoxLang.mouseMove(x, y);
|
||||||
listBoxVolumeFx.mouseMove(x, y);
|
listBoxVolumeFx.mouseMove(x, y);
|
||||||
listBoxVolumeAmbient.mouseMove(x, y);
|
listBoxVolumeAmbient.mouseMove(x, y);
|
||||||
|
@ -393,6 +402,7 @@ void MenuStateOptions::render(){
|
||||||
renderer.renderButton(&buttonOk);
|
renderer.renderButton(&buttonOk);
|
||||||
renderer.renderButton(&buttonAbort);
|
renderer.renderButton(&buttonAbort);
|
||||||
renderer.renderButton(&buttonAutoConfig);
|
renderer.renderButton(&buttonAutoConfig);
|
||||||
|
renderer.renderButton(&buttonVideoInfo);
|
||||||
renderer.renderListBox(&listBoxLang);
|
renderer.renderListBox(&listBoxLang);
|
||||||
renderer.renderListBox(&listBoxShadows);
|
renderer.renderListBox(&listBoxShadows);
|
||||||
renderer.renderListBox(&listBoxTextures3D);
|
renderer.renderListBox(&listBoxTextures3D);
|
||||||
|
|
|
@ -25,6 +25,7 @@ private:
|
||||||
GraphicButton buttonOk;
|
GraphicButton buttonOk;
|
||||||
GraphicButton buttonAbort;
|
GraphicButton buttonAbort;
|
||||||
GraphicButton buttonAutoConfig;
|
GraphicButton buttonAutoConfig;
|
||||||
|
GraphicButton buttonVideoInfo;
|
||||||
|
|
||||||
GraphicLabel labelLang;
|
GraphicLabel labelLang;
|
||||||
GraphicLabel labelShadows;
|
GraphicLabel labelShadows;
|
||||||
|
|
60
source/shared_lib/include/graphics/context.h
Normal file
60
source/shared_lib/include/graphics/context.h
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
// ==============================================================
|
||||||
|
// This file is part of Glest Shared Library (www.glest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001-2008 Martio Figueroa
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#ifndef _SHARED_GRAPHICS_CONTEXT_H_
|
||||||
|
#define _SHARED_GRAPHICS_CONTEXT_H_
|
||||||
|
|
||||||
|
#include "types.h"
|
||||||
|
|
||||||
|
namespace Shared{ namespace Graphics{
|
||||||
|
|
||||||
|
using Platform::uint32;
|
||||||
|
using Platform::int8;
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class Context
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class Context{
|
||||||
|
protected:
|
||||||
|
uint32 colorBits;
|
||||||
|
uint32 depthBits;
|
||||||
|
uint32 stencilBits;
|
||||||
|
int8 hardware_acceleration;
|
||||||
|
int8 fullscreen_anti_aliasing;
|
||||||
|
|
||||||
|
public:
|
||||||
|
Context();
|
||||||
|
virtual ~Context(){}
|
||||||
|
|
||||||
|
uint32 getColorBits() const {return colorBits;}
|
||||||
|
uint32 getDepthBits() const {return depthBits;}
|
||||||
|
uint32 getStencilBits() const {return stencilBits;}
|
||||||
|
int8 getHardware_acceleration() const { return hardware_acceleration; }
|
||||||
|
int8 getFullscreen_anti_aliasing() const { return fullscreen_anti_aliasing; }
|
||||||
|
|
||||||
|
void setColorBits(uint32 colorBits) {this->colorBits= colorBits;}
|
||||||
|
void setDepthBits(uint32 depthBits) {this->depthBits= depthBits;}
|
||||||
|
void setStencilBits(uint32 stencilBits) {this->stencilBits= stencilBits;}
|
||||||
|
void setHardware_acceleration(int8 value) { hardware_acceleration = value; }
|
||||||
|
void setFullscreen_anti_aliasing(int8 value) { fullscreen_anti_aliasing = value; }
|
||||||
|
|
||||||
|
virtual void init()= 0;
|
||||||
|
virtual void end()= 0;
|
||||||
|
virtual void reset()= 0;
|
||||||
|
|
||||||
|
virtual void makeCurrent()= 0;
|
||||||
|
virtual void swapBuffers()= 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
|
@ -48,7 +48,7 @@ class PlatformContextGl {
|
||||||
public:
|
public:
|
||||||
virtual ~PlatformContextGl() {}
|
virtual ~PlatformContextGl() {}
|
||||||
|
|
||||||
virtual void init(int colorBits, int depthBits, int stencilBits);
|
virtual void init(int colorBits, int depthBits, int stencilBits,bool hardware_acceleration, bool fullscreen_anti_aliasing);
|
||||||
virtual void end();
|
virtual void end();
|
||||||
|
|
||||||
virtual void makeCurrent();
|
virtual void makeCurrent();
|
||||||
|
|
|
@ -141,7 +141,7 @@ public:
|
||||||
static bool handleEvent();
|
static bool handleEvent();
|
||||||
static void revertMousePos();
|
static void revertMousePos();
|
||||||
static bool isKeyDown() { return isKeyPressedDown; }
|
static bool isKeyDown() { return isKeyPressedDown; }
|
||||||
static void setupGraphicsScreen(int depthBits=-1, int stencilBits=-1);
|
static void setupGraphicsScreen(int depthBits=-1, int stencilBits=-1, bool hardware_acceleration=false, bool fullscreen_anti_aliasing=false);
|
||||||
static const bool getIsFullScreen() { return isFullScreen; }
|
static const bool getIsFullScreen() { return isFullScreen; }
|
||||||
static void setIsFullScreen(bool value) { isFullScreen = value; }
|
static void setIsFullScreen(bool value) { isFullScreen = value; }
|
||||||
static SDL_keysym getKeystate() { return keystate; }
|
static SDL_keysym getKeystate() { return keystate; }
|
||||||
|
|
38
source/shared_lib/include/platform/sdl/window_gl.h
Normal file
38
source/shared_lib/include/platform/sdl/window_gl.h
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
// ==============================================================
|
||||||
|
// 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
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#ifndef _SHARED_PLATFORM_WINDOWGL_H_
|
||||||
|
#define _SHARED_PLATFORM_WINDOWGL_H_
|
||||||
|
|
||||||
|
#include "context_gl.h"
|
||||||
|
#include "window.h"
|
||||||
|
|
||||||
|
using Shared::Graphics::Gl::ContextGl;
|
||||||
|
|
||||||
|
namespace Shared{ namespace Platform{
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class WindowGl
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class WindowGl: public Window{
|
||||||
|
private:
|
||||||
|
ContextGl context;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void initGl(int colorBits, int depthBits, int stencilBits,bool hardware_acceleration, bool fullscreen_anti_aliasing);
|
||||||
|
void makeCurrentGl();
|
||||||
|
void swapBuffersGl();
|
||||||
|
};
|
||||||
|
|
||||||
|
}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
|
@ -29,7 +29,7 @@ namespace Shared{ namespace Graphics{ namespace Gl{
|
||||||
|
|
||||||
void ContextGl::init(){
|
void ContextGl::init(){
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//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__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,11 +35,11 @@ namespace Shared{ namespace Platform{
|
||||||
// class PlatformContextGl
|
// 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__);
|
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__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
|
|
@ -345,7 +345,7 @@ void Window::destroy() {
|
||||||
SDL_PushEvent(&event);
|
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 newDepthBits = depthBits;
|
||||||
static int newStencilBits = stencilBits;
|
static int newStencilBits = stencilBits;
|
||||||
if(depthBits >= 0)
|
if(depthBits >= 0)
|
||||||
|
@ -353,7 +353,13 @@ void Window::setupGraphicsScreen(int depthBits, int stencilBits) {
|
||||||
if(stencilBits >= 0)
|
if(stencilBits >= 0)
|
||||||
newStencilBits = stencilBits;
|
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_DOUBLEBUFFER, 1);
|
||||||
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 1);
|
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 1);
|
||||||
SDL_GL_SetAttribute(SDL_GL_GREEN_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
|
Loading…
Reference in New Issue
Block a user