summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--o3d/plugin/mac/main_mac.mm22
1 files changed, 12 insertions, 10 deletions
diff --git a/o3d/plugin/mac/main_mac.mm b/o3d/plugin/mac/main_mac.mm
index 17f1039..c9dcec0 100644
--- a/o3d/plugin/mac/main_mac.mm
+++ b/o3d/plugin/mac/main_mac.mm
@@ -903,7 +903,7 @@ extern "C" {
if (obj->drawing_model_ == NPDrawingModelOpenGL) {
CGLSetCurrentContext(obj->mac_cgl_context_);
- } else if (obj->mac_agl_context_ == NULL) { // setup AGL context
+ } else if (!had_a_window && obj->mac_agl_context_ == NULL) { // setup AGL context
AGLPixelFormat myAGLPixelFormat = NULL;
// We need to spec out a few similar but different sets of renderer
@@ -1075,8 +1075,10 @@ extern "C" {
// Renderer is already initialized from a previous call to this function,
// just update size and position and return.
if (had_a_window) {
- obj->renderer()->SetClientOriginOffset(gl_x_origin, gl_y_origin);
- obj->Resize(window->width, window->height);
+ if (obj->renderer()) {
+ obj->renderer()->SetClientOriginOffset(gl_x_origin, gl_y_origin);
+ obj->Resize(window->width, window->height);
+ }
return NPERR_NO_ERROR;
}
@@ -1094,22 +1096,22 @@ extern "C" {
::aglDestroyContext(obj->mac_agl_context_);
obj->mac_agl_context_ = NULL;
}
- return NPERR_NO_ERROR;
}
obj->client()->Init();
obj->client()->SetRenderOnDemandCallback(
new RenderOnDemandCallbackHandler(obj));
- obj->renderer()->SetClientOriginOffset(gl_x_origin, gl_y_origin);
- obj->Resize(window->width, window->height);
-
+ if (obj->renderer()) {
+ obj->renderer()->SetClientOriginOffset(gl_x_origin, gl_y_origin);
+ obj->Resize(window->width, window->height);
#ifdef CFTIMER
- // now that the grahics context is setup, add this instance to the timer
- // list so it gets drawn repeatedly
- gRenderTimer.AddInstance(instance);
+ // now that the grahics context is setup, add this instance to the timer
+ // list so it gets drawn repeatedly
+ gRenderTimer.AddInstance(instance);
#endif // CFTIMER
+ }
return NPERR_NO_ERROR;
}