From a1e2ad60d4524d31ae0b7379e485218b7e95f86d Mon Sep 17 00:00:00 2001 From: milek7 Date: Mon, 26 Feb 2018 18:05:53 +0100 Subject: [PATCH] texture compressing switch --- Globals.cpp | 4 ++++ Globals.h | 1 + Texture.cpp | 5 ++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Globals.cpp b/Globals.cpp index 62c33e69..076738b9 100644 --- a/Globals.cpp +++ b/Globals.cpp @@ -617,6 +617,10 @@ global_settings::ConfigParse(cParser &Parser) { Parser.getTokens( 1 ); Parser >> uart_conf.debug; } + else if( token == "compresstex" ) { + Parser.getTokens( 1 ); + Parser >> compress_tex; + } } while ((token != "") && (token != "endconfig")); //(!Parser->EndOfFile) // na koniec trochę zależności if (!bLoadTraction) // wczytywanie drutów i słupów diff --git a/Globals.h b/Globals.h index 7a86dcfe..cfa502ab 100644 --- a/Globals.h +++ b/Globals.h @@ -118,6 +118,7 @@ struct global_settings { float SplineFidelity{ 1.f }; // determines segment size during conversion of splines to geometry bool ResourceSweep{ true }; // gfx resource garbage collection bool ResourceMove{ false }; // gfx resources are moved between cpu and gpu side instead of sending a copy + bool compress_tex{ true }; // all textures are compressed on gpu side std::string asSky{ "1" }; bool bGlutFont{ false }; // czy tekst generowany przez GLUT32.DLL double fFpsAverage{ 20.0 }; // oczekiwana wartosć FPS diff --git a/Texture.cpp b/Texture.cpp index cec43583..2715af97 100644 --- a/Texture.cpp +++ b/Texture.cpp @@ -589,7 +589,10 @@ opengl_texture::create() { else { // uncompressed texture data. have the gfx card do the compression as it sees fit ::glTexImage2D( - GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA, + GL_TEXTURE_2D, 0, + ( Global.compress_tex ? + GL_COMPRESSED_RGBA : + GL_RGBA ), data_width, data_height, 0, data_format, GL_UNSIGNED_BYTE, (GLubyte *)&data[ 0 ] ); }