diff options
Diffstat (limited to 'source/gameengine')
4 files changed, 84 insertions, 23 deletions
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index 80db437bcd9..4ae5ab67270 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -176,9 +176,13 @@ extern "C" void StartKetsjiShell(struct ScrArea *area, bool lock_arrays = (displaylists && useVertexArrays); - if(displaylists && !useVertexArrays) - rasterizer = new RAS_ListRasterizer(canvas); - else if (useVertexArrays && bgl::QueryVersion(1, 1)) + if(displaylists){ + if (useVertexArrays) { + rasterizer = new RAS_ListRasterizer(canvas, true, lock_arrays); + } else { + rasterizer = new RAS_ListRasterizer(canvas); + } + } else if (useVertexArrays && bgl::QueryVersion(1, 1)) rasterizer = new RAS_VAOpenGLRasterizer(canvas, lock_arrays); else rasterizer = new RAS_OpenGLRasterizer(canvas); @@ -663,4 +667,4 @@ extern "C" void StartKetsjiShellSimulation(struct ScrArea *area, } while (exitrequested == KX_EXIT_REQUEST_RESTART_GAME || exitrequested == KX_EXIT_REQUEST_START_OTHER_GAME); if (bfd) BLO_blendfiledata_free(bfd); -}
\ No newline at end of file +} diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index 0d2aa774394..daded7a1d25 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -533,7 +533,11 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode) goto initFailed; if(useLists) - m_rasterizer = new RAS_ListRasterizer(m_canvas); + if (useVertexArrays) { + m_rasterizer = new RAS_ListRasterizer(m_canvas, true); + } else { + m_rasterizer = new RAS_ListRasterizer(m_canvas); + } else if (useVertexArrays && bgl::QueryVersion(1, 1)) m_rasterizer = new RAS_VAOpenGLRasterizer(m_canvas); else diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp index ed4cfb2ae42..7baa6c49656 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp @@ -96,8 +96,9 @@ bool RAS_ListSlot::End() -RAS_ListRasterizer::RAS_ListRasterizer(RAS_ICanvas* canvas) -: RAS_OpenGLRasterizer(canvas) +RAS_ListRasterizer::RAS_ListRasterizer(RAS_ICanvas* canvas, bool useVertexArrays, bool lock) +: RAS_VAOpenGLRasterizer(canvas, lock), + mUseVertexArrays(useVertexArrays) { // -- } @@ -159,13 +160,22 @@ void RAS_ListRasterizer::IndexPrimitives( if(localSlot->End()) return; } - - RAS_OpenGLRasterizer::IndexPrimitives( - vertexarrays, indexarrays, - mode, polymat, - rendertools, useObjectColor, - rgbacolor,slot - ); + + if (mUseVertexArrays) { + RAS_VAOpenGLRasterizer::IndexPrimitives( + vertexarrays, indexarrays, + mode, polymat, + rendertools, useObjectColor, + rgbacolor,slot + ); + } else { + RAS_OpenGLRasterizer::IndexPrimitives( + vertexarrays, indexarrays, + mode, polymat, + rendertools, useObjectColor, + rgbacolor,slot + ); + } if(!useObjectColor) { localSlot->EndList(); @@ -195,16 +205,53 @@ void RAS_ListRasterizer::IndexPrimitivesMulti( return; } - RAS_OpenGLRasterizer::IndexPrimitivesMulti( - vertexarrays, indexarrays, - mode, polymat, - rendertools, useObjectColor, - rgbacolor,slot - ); + if (mUseVertexArrays) { + RAS_VAOpenGLRasterizer::IndexPrimitivesMulti( + vertexarrays, indexarrays, + mode, polymat, + rendertools, useObjectColor, + rgbacolor,slot + ); + } else { + RAS_OpenGLRasterizer::IndexPrimitivesMulti( + vertexarrays, indexarrays, + mode, polymat, + rendertools, useObjectColor, + rgbacolor,slot + ); + } + if(!useObjectColor) { localSlot->EndList(); *slot = localSlot; } } +bool RAS_ListRasterizer::Init(void) +{ + if (mUseVertexArrays) { + return RAS_VAOpenGLRasterizer::Init(); + } else { + return RAS_OpenGLRasterizer::Init(); + } +} + +void RAS_ListRasterizer::SetDrawingMode(int drawingmode) +{ + if (mUseVertexArrays) { + RAS_VAOpenGLRasterizer::SetDrawingMode(drawingmode); + } else { + RAS_OpenGLRasterizer::SetDrawingMode(drawingmode); + } +} + +void RAS_ListRasterizer::Exit() +{ + if (mUseVertexArrays) { + RAS_VAOpenGLRasterizer::Exit(); + } else { + RAS_OpenGLRasterizer::Exit(); + } +} + // eof diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h index 82840cd1399..f25f621f70c 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h @@ -2,7 +2,7 @@ #define __RAS_LISTRASTERIZER_H__ #include "RAS_MaterialBucket.h" -#include "RAS_OpenGLRasterizer.h" +#include "RAS_VAOpenGLRasterizer.h" #include <vector> class RAS_ListSlot : public KX_ListSlot @@ -33,15 +33,16 @@ enum RAS_ListSlotFlags { typedef std::map<const vecVertexArray, RAS_ListSlot*> RAS_Lists; -class RAS_ListRasterizer : public RAS_OpenGLRasterizer +class RAS_ListRasterizer : public RAS_VAOpenGLRasterizer { + bool mUseVertexArrays; RAS_Lists mLists; RAS_ListSlot* FindOrAdd(const vecVertexArray& vertexarrays, KX_ListSlot** slot); void ReleaseAlloc(); public: - RAS_ListRasterizer(RAS_ICanvas* canvas); + RAS_ListRasterizer(RAS_ICanvas* canvas, bool useVertexArrays=false, bool lock=false); virtual ~RAS_ListRasterizer(); virtual void IndexPrimitives( @@ -66,6 +67,11 @@ public: class KX_ListSlot** slot ); + virtual bool Init(); + virtual void Exit(); + + virtual void SetDrawingMode(int drawingmode); + virtual bool QueryLists(){return true;} }; |