From 462b3184e2ee64387cea03743c9e1b12e7b342be Mon Sep 17 00:00:00 2001 From: Sonicadvance1 Date: Mon, 8 Sep 2008 04:03:42 +0000 Subject: [PATCH] Added some Fog functions to the GL plugin, doesn't effect games at all. Quick change to GLInit.cpp that doesn't do much as well git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@477 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Plugins/Plugin_VideoOGL/Src/BPStructs.cpp | 29 ++++++++++++++++++- Source/Plugins/Plugin_VideoOGL/Src/GLInit.cpp | 2 +- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/BPStructs.cpp b/Source/Plugins/Plugin_VideoOGL/Src/BPStructs.cpp index b2c445f5d5..36611074ea 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/BPStructs.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/BPStructs.cpp @@ -270,6 +270,31 @@ void BPWritten(int addr, int changes, int newval) if (changes) { VertexManager::Flush(); ((u32*)&bpmem)[addr] = newval; + //printf("%f %f magnitude: %x\n", bpmem.fog.a.GetA(),bpmem.fog.c_proj_fsel.GetC(), bpmem.fog.b_magnitude); + switch(bpmem.fog.c_proj_fsel.fsel) + { + case 0: // Off + glDisable(GL_FOG); // Should be what we do + break; + case 2: // Linear + glFogi(GL_FOG_MODE, GL_LINEAR); + glEnable(GL_FOG); + break; + case 4: // exp + glFogi(GL_FOG_MODE, GL_EXP); + glEnable(GL_FOG); + break; + case 5: // exp2 + glFogi(GL_FOG_MODE, GL_EXP2); + glEnable(GL_FOG); + break; + case 6: // Backward exp + case 7: // Backward exp2 + // TODO: Figure out how to do these in GL + default: + printf("Non-Emulated Fog selection %d\n", bpmem.fog.c_proj_fsel.fsel); + break; + } } break; @@ -278,7 +303,9 @@ void BPWritten(int addr, int changes, int newval) { VertexManager::Flush(); ((u32*)&bpmem)[addr] = newval; - // float fogcolor[4] = { ((bpmem.fog.color>>16)&0xff)/255.0f, ((bpmem.fog.color>>8)&0xff)/255.0f, (bpmem.fog.color&0xff)/255.0f, (bpmem.fog.color>>24)/255.0f }; + float fogcolor[4] = { ((bpmem.fog.color>>16)&0xff)/255.0f, ((bpmem.fog.color>>8)&0xff)/255.0f, (bpmem.fog.color&0xff)/255.0f, (bpmem.fog.color>>24)/255.0f }; + //printf("r: %f g: %f b: %f a: %f %x %x %x %f\n",fogcolor[0],fogcolor[1], fogcolor[2], fogcolor[3], bpmem.fogRangeAdj, bpmem.unknown15[0],bpmem.unknown15[1],bpmem.unknown15[2]); + glFogfv(GL_FOG_COLOR, fogcolor); } break; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLInit.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GLInit.cpp index 7f7bd3f931..910e6f486c 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GLInit.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLInit.cpp @@ -436,7 +436,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight // create a window in window mode GLWin.attr.event_mask = ExposureMask | KeyPressMask | ButtonPressMask | - StructureNotifyMask; + StructureNotifyMask | ResizeRedirectMask; GLWin.win = XCreateWindow(GLWin.dpy, RootWindow(GLWin.dpy, vi->screen), 0, 0, _twidth, _theight, 0, vi->depth, InputOutput, vi->visual, CWBorderPixel | CWColormap | CWEventMask, &GLWin.attr);