BGE:
authorMitchell Stokes <mogurijin@gmail.com>
Sun, 15 May 2011 08:48:43 +0000 (08:48 +0000)
committerMitchell Stokes <mogurijin@gmail.com>
Sun, 15 May 2011 08:48:43 +0000 (08:48 +0000)
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

index 571cc9087b3b461c36dc56d80d51942738b3312a..4789155dcedf915ba1a5dc96931bb3b2c5a66d45 100644 (file)
@@ -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();