From d05b26c6354a0a77f7f128d0726d85b95f3511ff Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Sun, 15 May 2011 08:48:43 +0000 Subject: BGE: This fixes frame colors not showing up right when using letterbox in the embedded player. Frames are drawn by clearing the whole canvas and then changing the viewport to be within the frames. The problem is that the embedded player's canvas is setup to be within the frames. This means that the extra that would normally be cleared and filled with the frame color is instead the gray color of Blender's region since nothing is actually drawn there by the BGE. To solve this, I just handle the frames in BL_KetsjiEmbedStart. --- source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp') diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index 571cc9087b3..4789155dced 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -427,6 +427,13 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c { // first check if we want to exit exitrequested = ketsjiengine->GetExitCode(); + + // Clear screen to border color + // We do this here since we set the canvas to be within the frames. This means the engine + // itself is unaware of the extra space, so we clear the whole region for it. + glClearColor(scene->gm.framing.col[0], scene->gm.framing.col[1], scene->gm.framing.col[2], 1.0f); + glViewport(ar->winrct.xmin, ar->winrct.ymin, ar->winrct.xmax, ar->winrct.ymax); + glClear(GL_COLOR_BUFFER_BIT); // kick the engine bool render = ketsjiengine->NextFrame(); -- cgit v1.2.3 From 984d2e42e4a81c1f92dc405ce1b265842bc94b9a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 20 May 2011 04:14:29 +0000 Subject: make api functions for converting rv3d->camzoom, so the odd logic for this isn't inlined all over. --- source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp') diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index 4789155dced..59c5888ff35 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -81,6 +81,8 @@ extern "C" { #include "DNA_windowmanager_types.h" #include "BKE_global.h" #include "BKE_report.h" +/* #include "BKE_screen.h" */ /* cant include this because of 'new' function name */ +extern float BKE_screen_view3d_zoom_to_fac(float camzoom); //XXX #include "BIF_screen.h" @@ -254,9 +256,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c camzoom = 1.0f; } else { - camzoom = (1.41421 + (rv3d->camzoom / 50.0)); - camzoom *= camzoom; - camzoom = 4.0 / camzoom; + camzoom = BKE_screen_view3d_zoom_to_fac(rv3d->camzoom); } } else { -- cgit v1.2.3 From 18ff3d5200842ac87d783442580d42e00b0ab8f6 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 27 May 2011 16:20:49 +0000 Subject: Attempted fix for #27482: game engine running slow due to revision 36698 which fixed frame colors for letterbox drawing (happens when in camera view). Cause is unclear, seems some sort of strange graphics driver thing on 32 bit. Changes are a fix for the incorrect usage of glViewport, and avoiding the extra clear if it's not needed. --- .../gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp') diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index 59c5888ff35..d9017c6a4ca 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -250,10 +250,12 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c // some blender stuff float camzoom; + int draw_letterbox = 0; if(rv3d->persp==RV3D_CAMOB) { if(startscene->gm.framing.type == SCE_GAMEFRAMING_BARS) { /* Letterbox */ camzoom = 1.0f; + draw_letterbox = 1; } else { camzoom = BKE_screen_view3d_zoom_to_fac(rv3d->camzoom); @@ -428,12 +430,15 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c // first check if we want to exit exitrequested = ketsjiengine->GetExitCode(); - // Clear screen to border color - // We do this here since we set the canvas to be within the frames. This means the engine - // itself is unaware of the extra space, so we clear the whole region for it. - glClearColor(scene->gm.framing.col[0], scene->gm.framing.col[1], scene->gm.framing.col[2], 1.0f); - glViewport(ar->winrct.xmin, ar->winrct.ymin, ar->winrct.xmax, ar->winrct.ymax); - glClear(GL_COLOR_BUFFER_BIT); + if(draw_letterbox) { + // Clear screen to border color + // We do this here since we set the canvas to be within the frames. This means the engine + // itself is unaware of the extra space, so we clear the whole region for it. + glClearColor(scene->gm.framing.col[0], scene->gm.framing.col[1], scene->gm.framing.col[2], 1.0f); + glViewport(ar->winrct.xmin, ar->winrct.ymin, + ar->winrct.xmax - ar->winrct.xmin, ar->winrct.ymax - ar->winrct.ymin); + glClear(GL_COLOR_BUFFER_BIT); + } // kick the engine bool render = ketsjiengine->NextFrame(); -- cgit v1.2.3 From d580ae10873ad149ca73902b69f389aad8976419 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Sat, 28 May 2011 01:29:56 +0000 Subject: fix for embeded BGE viewport broken when not using letterboxing this was broken after rev.36787 (api rewritten) own reported bug, nowhere in the track (just to mess up with the bug fixing statistics) --- source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp') diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index d9017c6a4ca..13f0551d01b 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -258,7 +258,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c draw_letterbox = 1; } else { - camzoom = BKE_screen_view3d_zoom_to_fac(rv3d->camzoom); + camzoom = BKE_screen_view3d_zoom_to_fac(rv3d->camzoom)*4.0f; } } else { -- cgit v1.2.3 From 221472f7b50914801845ec78cae05d1618bd3c0a Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Sun, 29 May 2011 18:09:38 +0000 Subject: =?UTF-8?q?Moving=20the=20letterbox=20clear=20for=20the=20embedded?= =?UTF-8?q?=20player=20so=20it=20only=20clears=20when=20it=20needs=20to.?= =?UTF-8?q?=20Thanks=20to=20Juha=20M=C3=A4ki-Kanto=20for=20the=20tip.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BlenderRoutines/BL_KetsjiEmbedStart.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp') diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index 13f0551d01b..cac801c80ef 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -429,22 +429,22 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c { // first check if we want to exit exitrequested = ketsjiengine->GetExitCode(); - - if(draw_letterbox) { - // Clear screen to border color - // We do this here since we set the canvas to be within the frames. This means the engine - // itself is unaware of the extra space, so we clear the whole region for it. - glClearColor(scene->gm.framing.col[0], scene->gm.framing.col[1], scene->gm.framing.col[2], 1.0f); - glViewport(ar->winrct.xmin, ar->winrct.ymin, - ar->winrct.xmax - ar->winrct.xmin, ar->winrct.ymax - ar->winrct.ymin); - glClear(GL_COLOR_BUFFER_BIT); - } // kick the engine bool render = ketsjiengine->NextFrame(); if (render) { + if(draw_letterbox) { + // Clear screen to border color + // We do this here since we set the canvas to be within the frames. This means the engine + // itself is unaware of the extra space, so we clear the whole region for it. + glClearColor(scene->gm.framing.col[0], scene->gm.framing.col[1], scene->gm.framing.col[2], 1.0f); + glViewport(ar->winrct.xmin, ar->winrct.ymin, + ar->winrct.xmax - ar->winrct.xmin, ar->winrct.ymax - ar->winrct.ymin); + glClear(GL_COLOR_BUFFER_BIT); + } + // render the frame ketsjiengine->Render(); } -- cgit v1.2.3 From 40c171a69f3ae47368c277748537f1a1a9b451d6 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Wed, 8 Jun 2011 09:01:41 +0000 Subject: fix of fix :| [real fix for #36787 -- it was wrongly fixed on #36964] I guess I tested the fix outside the camera view (which always worked). duhhh Working now. --- source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp') diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index cac801c80ef..1eeb7c0f94b 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -258,7 +258,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c draw_letterbox = 1; } else { - camzoom = BKE_screen_view3d_zoom_to_fac(rv3d->camzoom)*4.0f; + camzoom = 1.0 / BKE_screen_view3d_zoom_to_fac(rv3d->camzoom); } } else { -- cgit v1.2.3 From 2023db70a88c9c5ae7b38eccfee54b6f35780b5f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 23 Jun 2011 09:27:56 +0000 Subject: cmake option to build without an audio library. --- source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp') diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index 1eeb7c0f94b..a3ea85b605c 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -95,7 +95,9 @@ extern float BKE_screen_view3d_zoom_to_fac(float camzoom); #include "BKE_ipo.h" /***/ -#include "AUD_C-API.h" +#ifdef WITH_AUDASPACE +# include "AUD_C-API.h" +#endif //XXX #include "BSE_headerbuttons.h" #include "BKE_context.h" -- cgit v1.2.3