diff --git a/src/gl/scene/gl_drawinfo.cpp b/src/gl/scene/gl_drawinfo.cpp index 386dc6a4a..a444dbe62 100644 --- a/src/gl/scene/gl_drawinfo.cpp +++ b/src/gl/scene/gl_drawinfo.cpp @@ -991,10 +991,15 @@ static FDrawInfoList di_list; FDrawInfo::FDrawInfo() { next = NULL; + if (gl.lightmethod == LM_SOFTWARE) + { + dldrawlists = new GLDrawList[GLLDL_TYPES]; + } } FDrawInfo::~FDrawInfo() { + if (dldrawlists != NULL) delete[] dldrawlists; ClearBuffers(); } @@ -1018,13 +1023,17 @@ void FDrawInfo::StartScene() ss_renderflags.Resize(numsubsectors); no_renderflags.Resize(numsubsectors); - memset(§orrenderflags[0], 0, numsectors*sizeof(sectorrenderflags[0])); - memset(&ss_renderflags[0], 0, numsubsectors*sizeof(ss_renderflags[0])); - memset(&no_renderflags[0], 0, numnodes*sizeof(no_renderflags[0])); + memset(§orrenderflags[0], 0, numsectors * sizeof(sectorrenderflags[0])); + memset(&ss_renderflags[0], 0, numsubsectors * sizeof(ss_renderflags[0])); + memset(&no_renderflags[0], 0, numnodes * sizeof(no_renderflags[0])); - next=gl_drawinfo; - gl_drawinfo=this; - for(int i=0;idrawlists[i].Reset(); + if (di->dldrawlists != NULL) + { + for (int i = 0; i < GLLDL_TYPES; i++) di->dldrawlists[i].Reset(); + } gl_drawinfo=di->next; di_list.Release(di); } diff --git a/src/gl/scene/gl_drawinfo.h b/src/gl/scene/gl_drawinfo.h index 8cb6a412a..1eb4882ef 100644 --- a/src/gl/scene/gl_drawinfo.h +++ b/src/gl/scene/gl_drawinfo.h @@ -25,6 +25,28 @@ enum DrawListType GLDL_TYPES, }; +// more lists for handling of dynamic lights +enum DLDrawListType +{ + // These are organized so that the various multipass rendering modes have to be set as few times as possible + GLLDL_WALLS_PLAIN, // dynamic lights on normal walls + GLLDL_WALLS_BRIGHT, // dynamic lights on brightmapped walls + GLLDL_WALLS_MASKED, // dynamic lights on masked midtextures + + GLLDL_FLATS_PLAIN, // dynamic lights on normal flats + GLLDL_FLATS_BRIGHT, // dynamic lights on brightmapped flats + GLLDL_FLATS_MASKED, // dynamic lights on masked flats + + GLLDL_WALLS_FOG, // lights on fogged walls + GLLDL_WALLS_FOGMASKED, // lights on fogged masked midtextures + + GLLDL_FLATS_FOG, // lights on fogged walls + GLLDL_FLATS_FOGMASKED, // lights on fogged masked midtextures + + GLLDL_TYPES, +}; + + enum Drawpasses { GLPASS_ALL, // Main pass with dynamic lights @@ -32,6 +54,12 @@ enum Drawpasses GLPASS_PLAIN, // Main pass without dynamic lights GLPASS_DECALS, // Draws a decal GLPASS_TRANSLUCENT, // Draws translucent objects + + // these are only used with texture based dynamic lights + GLPASS_BASE, // untextured base for dynamic lights + GLPASS_LIGHTTEX, // lighttexture pass + GLPASS_TEXONLY // finishing texture pass + }; //========================================================================== @@ -199,6 +227,7 @@ struct FDrawInfo FDrawInfo * next; GLDrawList drawlists[GLDL_TYPES]; + GLDrawList *dldrawlists; // only gets allocated when needed. FDrawInfo(); ~FDrawInfo(); diff --git a/src/win32/win32gliface.cpp b/src/win32/win32gliface.cpp index 76099babb..625bda2a7 100644 --- a/src/win32/win32gliface.cpp +++ b/src/win32/win32gliface.cpp @@ -804,6 +804,8 @@ bool Win32GLVideo::InitHardware (HWND Window, int multisample) 0 }; + //Printf("Trying to create an OpenGL %d.%d %s profile context\n", versions[i] / 10, versions[i] % 10, prof == WGL_CONTEXT_CORE_PROFILE_BIT_ARB ? "Core" : "Compatibility"); + m_hRC = myWglCreateContextAttribsARB(m_hDC, 0, ctxAttribs); if (m_hRC != NULL) break; } @@ -832,7 +834,7 @@ bool Win32GLVideo::InitHardware (HWND Window, int multisample) } } // We get here if the driver doesn't support the modern context creation API which always means an old driver. - I_Error ("R_OPENGL: Unable to create an OpenGL render context.\n"); + I_Error ("R_OPENGL: Unable to create an OpenGL render context. Insufficient driver support for context creation\n"); return false; }