diff options
author | Kester Maddock <Christopher.Maddock.1@uni.massey.ac.nz> | 2004-04-24 10:40:15 +0400 |
---|---|---|
committer | Kester Maddock <Christopher.Maddock.1@uni.massey.ac.nz> | 2004-04-24 10:40:15 +0400 |
commit | 63048b6cf4358dc9231e0704e03e0f8d5729a174 (patch) | |
tree | 33a1047d2d9007021a78ab2c2fbb8fc5d06727c5 /source/gameengine/GamePlayer | |
parent | a46f456e92b14d986022b301757a7bad3c4c76b5 (diff) |
Synchronise game engine with Tuhopuu2 tree.
Diffstat (limited to 'source/gameengine/GamePlayer')
-rw-r--r-- | source/gameengine/GamePlayer/common/GPC_PolygonMaterial.cpp | 6 | ||||
-rw-r--r-- | source/gameengine/GamePlayer/ghost/GPG_Application.cpp | 168 |
2 files changed, 101 insertions, 73 deletions
diff --git a/source/gameengine/GamePlayer/common/GPC_PolygonMaterial.cpp b/source/gameengine/GamePlayer/common/GPC_PolygonMaterial.cpp index 75286c4fbad..76a61da6b62 100644 --- a/source/gameengine/GamePlayer/common/GPC_PolygonMaterial.cpp +++ b/source/gameengine/GamePlayer/common/GPC_PolygonMaterial.cpp @@ -37,6 +37,7 @@ #include "GPC_PolygonMaterial.h" #include "MT_Vector3.h" #include "RAS_IRasterizer.h" +#include "RAS_GLExtensionManager.h" /* This list includes only data type definitions */ #include "DNA_object_types.h" @@ -83,6 +84,7 @@ static int fDoMipMap = 1; static int fLinearMipMap=1; static int fAlphamode= -1; +using namespace bgl; /* (n&(n-1)) zeros the least significant bit of n */ static int is_pow2(int num) { return ((num)&(num-1))==0; @@ -111,7 +113,7 @@ static void my_make_repbind(Image *ima) } -int my_set_tpage(TFace *tface) +static int my_set_tpage(TFace *tface) { static TFace *lasttface= 0; Image *ima; @@ -402,7 +404,7 @@ void GPC_PolygonMaterial::Activate(RAS_IRasterizer* rasty, TCachingInfo& caching else { - rasty->SetCullFace(true);;//glEnable(GL_CULL_FACE); + rasty->SetCullFace(true);//glEnable(GL_CULL_FACE); //else glDisable(GL_CULL_FACE); } } diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index 68ff43f73c8..c33114c423a 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -69,6 +69,8 @@ extern "C" #include "SCA_IActuator.h" #include "RAS_MeshObject.h" #include "RAS_OpenGLRasterizer.h" +#include "RAS_VAOpenGLRasterizer.h" +#include "RAS_GLExtensionManager.h" #include "KX_PythonInit.h" #include "KX_PyConstraintBinding.h" @@ -313,78 +315,102 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode) { if (!m_engineInitialized) { + bgl::InitExtensions(1); + // get and set the preferences SYS_SystemHandle syshandle = SYS_GetSystem(); - if (syshandle) - { - // SYS_WriteCommandLineInt(syshandle, "fixedtime", 0); - SYS_WriteCommandLineInt(syshandle, "vertexarrays",1); - //bool properties = (SYS_GetCommandLineInt(syshandle, "show_properties", 0) != 0); - //bool profile = (SYS_GetCommandLineInt(syshandle, "show_profile", 0) != 0); - //bool frameRate = (SYS_GetCommandLineInt(syshandle, "show_framerate", 0) != 0); + if (!syshandle) + return false; + + // SYS_WriteCommandLineInt(syshandle, "fixedtime", 0); + SYS_WriteCommandLineInt(syshandle, "vertexarrays",1); + //bool properties = (SYS_GetCommandLineInt(syshandle, "show_properties", 0) != 0); + //bool profile = (SYS_GetCommandLineInt(syshandle, "show_profile", 0) != 0); + bool frameRate = (SYS_GetCommandLineInt(syshandle, "show_framerate", 0) != 0); + bool useVertexArrays = SYS_GetCommandLineInt(syshandle,"vertexarrays",1) != 0; + // create the canvas, rasterizer and rendertools + m_canvas = new GPG_Canvas(window); + if (!m_canvas) + return false; + + m_canvas->Init(); + m_rendertools = new GPC_RenderTools(); + if (!m_rendertools) + goto initFailed; + + if (useVertexArrays && bgl::QueryVersion(1, 1)) + m_rasterizer = new RAS_VAOpenGLRasterizer(m_canvas); + else + m_rasterizer = new RAS_OpenGLRasterizer(m_canvas); + m_rasterizer->SetStereoMode(stereoMode); + if (!m_rasterizer) + goto initFailed; + + // create the inputdevices + m_keyboard = new GPG_KeyboardDevice(); + if (!m_keyboard) + goto initFailed; - // create the canvas, rasterizer and rendertools - m_canvas = new GPG_Canvas(window); - if (m_canvas) - { - m_canvas->Init(); - m_rendertools = new GPC_RenderTools(); - if (m_rendertools) - { - m_rasterizer = new RAS_OpenGLRasterizer(m_canvas); - m_rasterizer->SetStereoMode(stereoMode); - if (m_rasterizer) - { - // create the inputdevices - m_keyboard = new GPG_KeyboardDevice(); - if (m_keyboard) - { - m_mouse = new GPC_MouseDevice(); - if (m_mouse) - { - // create a networkdevice - m_networkdevice = new NG_LoopBackNetworkDeviceInterface(); - if (m_networkdevice) - { - // get an audiodevice - SND_DeviceManager::Subscribe(); - m_audiodevice = SND_DeviceManager::Instance(); - if (m_audiodevice) - { - m_audiodevice->UseCD(); - // create a ketsjisystem (only needed for timing and stuff) - m_kxsystem = new GPG_System (m_system); - if (m_kxsystem) - { - // create the ketsjiengine - m_ketsjiengine = new KX_KetsjiEngine(m_kxsystem); - - // set the devices - m_ketsjiengine->SetKeyboardDevice(m_keyboard); - m_ketsjiengine->SetMouseDevice(m_mouse); - m_ketsjiengine->SetNetworkDevice(m_networkdevice); - m_ketsjiengine->SetCanvas(m_canvas); - m_ketsjiengine->SetRenderTools(m_rendertools); - m_ketsjiengine->SetRasterizer(m_rasterizer); - m_ketsjiengine->SetNetworkDevice(m_networkdevice); - m_ketsjiengine->SetAudioDevice(m_audiodevice); - - m_ketsjiengine->SetUseFixedTime(false); - //m_ketsjiengine->SetTimingDisplay(frameRate, profile, properties); - - m_engineInitialized = true; - } - } - } - } - } - } - } - } - } + m_mouse = new GPC_MouseDevice(); + if (!m_mouse) + goto initFailed; + + // create a networkdevice + m_networkdevice = new NG_LoopBackNetworkDeviceInterface(); + if (!m_networkdevice) + goto initFailed; + + // get an audiodevice + SND_DeviceManager::Subscribe(); + m_audiodevice = SND_DeviceManager::Instance(); + if (!m_audiodevice) + goto initFailed; + m_audiodevice->UseCD(); + + // create a ketsjisystem (only needed for timing and stuff) + m_kxsystem = new GPG_System (m_system); + if (!m_kxsystem) + goto initFailed; + + // create the ketsjiengine + m_ketsjiengine = new KX_KetsjiEngine(m_kxsystem); + + // set the devices + m_ketsjiengine->SetKeyboardDevice(m_keyboard); + m_ketsjiengine->SetMouseDevice(m_mouse); + m_ketsjiengine->SetNetworkDevice(m_networkdevice); + m_ketsjiengine->SetCanvas(m_canvas); + m_ketsjiengine->SetRenderTools(m_rendertools); + m_ketsjiengine->SetRasterizer(m_rasterizer); + m_ketsjiengine->SetNetworkDevice(m_networkdevice); + m_ketsjiengine->SetAudioDevice(m_audiodevice); + m_ketsjiengine->SetTimingDisplay(frameRate, false, false); + + m_ketsjiengine->SetUseFixedTime(false); + //m_ketsjiengine->SetTimingDisplay(frameRate, profile, properties); + + m_engineInitialized = true; } return m_engineInitialized; +initFailed: + delete m_kxsystem; + delete m_audiodevice; + delete m_networkdevice; + delete m_mouse; + delete m_keyboard; + delete m_rasterizer; + delete m_rendertools; + delete m_canvas; + m_canvas = NULL; + m_rendertools = NULL; + m_rasterizer = NULL; + m_keyboard = NULL; + m_mouse = NULL; + m_networkdevice = NULL; + m_audiodevice = NULL; + m_kxsystem = NULL; + return false; } @@ -396,14 +422,14 @@ bool GPG_Application::startEngine(void) } // Temporary hack to disable banner display for NaN approved content. - + /* m_canvas->SetBannerDisplayEnabled(true); -/* Camera* cam; + Camera* cam; cam = (Camera*)G.scene->camera->data; if (cam) { - if (((cam->flag) & 48)==48) { - m_canvas->SetBannerDisplayEnabled(false); - } + if (((cam->flag) & 48)==48) { + m_canvas->SetBannerDisplayEnabled(false); + } } else { showError(CString("Camera data invalid.")); |