mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-09 07:18:34 -04:00
OpenGL: Always restore all state
This commit is contained in:
parent
cdd32375c6
commit
03b17f565a
@ -378,8 +378,8 @@ void Gfx_BindTexture(GfxResourceID texId) {
|
||||
*-----------------------------------------------------State management----------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
static PackedCol gfx_fogColor;
|
||||
static float gfx_fogEnd = -1.0f, gfx_fogDensity = -1.0f;
|
||||
static int gfx_fogMode = -1;
|
||||
static float gfx_fogEnd, gfx_fogDensity;
|
||||
static int gfx_fogMode;
|
||||
|
||||
void Gfx_SetFog(cc_bool enabled) {
|
||||
gfx_fogEnabled = enabled;
|
||||
@ -477,7 +477,15 @@ static void Gfx_RestoreState(void) {
|
||||
InitDefaultResources();
|
||||
_glEnableClientState(GL_VERTEX_ARRAY);
|
||||
_glEnableClientState(GL_COLOR_ARRAY);
|
||||
|
||||
gfx_format = -1;
|
||||
lastMatrix = -1;
|
||||
|
||||
gfx_clearColor = 0;
|
||||
gfx_fogColor = 0;
|
||||
gfx_fogEnd = -1.0f;
|
||||
gfx_fogDensity = -1.0f;
|
||||
gfx_fogMode = -1;
|
||||
|
||||
_glHint(GL_FOG_HINT, GL_NICEST);
|
||||
#if defined CC_BUILD_SYMBIAN
|
||||
@ -518,8 +526,16 @@ cc_bool Gfx_WarnIfNecessary(void) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
cc_bool Gfx_GetUIOptions(struct MenuOptionsScreen* s) { return false; }
|
||||
|
||||
void Gfx_GetApiInfo(cc_string* info) {
|
||||
int pointerSize = sizeof(void*) * 8;
|
||||
|
||||
String_Format1(info, "-- Using OpenGL (%i bit) --\n", &pointerSize);
|
||||
GetGLApiInfo(info);
|
||||
}
|
||||
|
||||
|
||||
/*########################################################################################################################*
|
||||
*-------------------------------------------------------Compatibility-----------------------------------------------------*
|
||||
|
@ -600,8 +600,15 @@ static void Gfx_RestoreState(void) {
|
||||
InitDefaultResources();
|
||||
glEnableVertexAttribArray(0);
|
||||
glEnableVertexAttribArray(1);
|
||||
|
||||
gfx_format = -1;
|
||||
|
||||
gfx_clearColor = 0;
|
||||
gfx_fogColor = 0;
|
||||
gfx_fogEnd = -1.0f;
|
||||
gfx_fogDensity = -1.0f;
|
||||
gfx_fogMode = -1;
|
||||
|
||||
DirtyUniform(UNI_MASK_ALL);
|
||||
GL_ClearColor(gfx_clearColor);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
@ -639,6 +646,13 @@ cc_bool Gfx_GetUIOptions(struct MenuOptionsScreen* s) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void Gfx_GetApiInfo(cc_string* info) {
|
||||
int pointerSize = sizeof(void*) * 8;
|
||||
|
||||
String_Format1(info, "-- Using OpenGL Modern (%i bit) --\n", &pointerSize);
|
||||
GetGLApiInfo(info);
|
||||
}
|
||||
|
||||
|
||||
/*########################################################################################################################*
|
||||
*----------------------------------------------------------Drawing--------------------------------------------------------*
|
||||
|
@ -352,16 +352,10 @@ static void AppendVRAMStats(cc_string* info) {
|
||||
String_Format2(info, "Video memory: %f2 MB total, %f2 free\n", &total, &cur);
|
||||
}
|
||||
|
||||
void Gfx_GetApiInfo(cc_string* info) {
|
||||
static void GetGLApiInfo(cc_string* info) {
|
||||
GLint depthBits = 0;
|
||||
int pointerSize = sizeof(void*) * 8;
|
||||
|
||||
_glGetIntegerv(GL_DEPTH_BITS, &depthBits);
|
||||
#if CC_GFX_BACKEND == CC_GFX_BACKEND_GL2
|
||||
String_Format1(info, "-- Using OpenGL Modern (%i bit) --\n", &pointerSize);
|
||||
#else
|
||||
String_Format1(info, "-- Using OpenGL (%i bit) --\n", &pointerSize);
|
||||
#endif
|
||||
|
||||
String_Format1(info, "Vendor: %c\n", _glGetString(GL_VENDOR));
|
||||
String_Format1(info, "Renderer: %c\n", _glGetString(GL_RENDERER));
|
||||
String_Format1(info, "GL version: %c\n", _glGetString(GL_VERSION));
|
||||
|
Loading…
x
Reference in New Issue
Block a user