* Moved locking the looper from the GLRenderer class into the GLView class:
when the view is detached, fRenderer has already been released, and wouldn't unlock the looper anymore in GLTeapot. This fixes bug #1626. * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23691 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,18 +1,20 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2006, Philippe Houdoin. All rights reserved.
|
* Copyright 2006-2008, Philippe Houdoin. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "GLDispatcher.h"
|
#include "GLDispatcher.h"
|
||||||
#include "GLRenderer.h"
|
#include "GLRenderer.h"
|
||||||
|
|
||||||
BGLRenderer::BGLRenderer(BGLView *view, ulong bgl_options, BGLDispatcher *dispatcher)
|
|
||||||
|
BGLRenderer::BGLRenderer(BGLView *view, ulong glOptions,
|
||||||
|
BGLDispatcher *dispatcher)
|
||||||
: fRefCount(1),
|
: fRefCount(1),
|
||||||
fView(view),
|
fView(view),
|
||||||
fOptions(bgl_options),
|
fOptions(glOptions),
|
||||||
fDispatcher(dispatcher)
|
fDispatcher(dispatcher)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -40,15 +42,12 @@ BGLRenderer::Release()
|
|||||||
void
|
void
|
||||||
BGLRenderer::LockGL()
|
BGLRenderer::LockGL()
|
||||||
{
|
{
|
||||||
fView->LockLooper();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BGLRenderer::UnlockGL()
|
BGLRenderer::UnlockGL()
|
||||||
{
|
{
|
||||||
if (fView->Looper()->IsLocked())
|
|
||||||
fView->UnlockLooper();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+25
-16
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2006-2007, Haiku. All rights reserved.
|
* Copyright 2006-2008, Haiku. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
* Philippe Houdoin, [email protected]
|
* Philippe Houdoin, [email protected]
|
||||||
* Stefano Ceccherini, [email protected]
|
* Stefano Ceccherini, [email protected]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
* Version: 6.1
|
* Version: 6.1
|
||||||
@@ -32,11 +33,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <GLView.h>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <DirectWindow.h>
|
#include <DirectWindow.h>
|
||||||
#include <GLView.h>
|
|
||||||
#include <GLRenderer.h>
|
#include <GLRenderer.h>
|
||||||
|
|
||||||
#include "GLRendererRoster.h"
|
#include "GLRendererRoster.h"
|
||||||
@@ -51,7 +53,8 @@ struct glview_direct_info {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
BGLView::BGLView(BRect rect, char *name, ulong resizingMode, ulong mode, ulong options)
|
BGLView::BGLView(BRect rect, char *name, ulong resizingMode, ulong mode,
|
||||||
|
ulong options)
|
||||||
: BView(rect, name, B_FOLLOW_ALL_SIDES, mode | B_WILL_DRAW | B_FRAME_EVENTS), // | B_FULL_UPDATE_ON_RESIZE)
|
: BView(rect, name, B_FOLLOW_ALL_SIDES, mode | B_WILL_DRAW | B_FRAME_EVENTS), // | B_FULL_UPDATE_ON_RESIZE)
|
||||||
m_clip_info(NULL),
|
m_clip_info(NULL),
|
||||||
fRenderer(NULL)
|
fRenderer(NULL)
|
||||||
@@ -73,6 +76,7 @@ BGLView::LockGL()
|
|||||||
{
|
{
|
||||||
// TODO: acquire the OpenGL API lock it on this glview
|
// TODO: acquire the OpenGL API lock it on this glview
|
||||||
|
|
||||||
|
LockLooper();
|
||||||
if (fRenderer)
|
if (fRenderer)
|
||||||
fRenderer->LockGL();
|
fRenderer->LockGL();
|
||||||
}
|
}
|
||||||
@@ -83,6 +87,7 @@ BGLView::UnlockGL()
|
|||||||
{
|
{
|
||||||
if (fRenderer)
|
if (fRenderer)
|
||||||
fRenderer->UnlockGL();
|
fRenderer->UnlockGL();
|
||||||
|
UnlockLooper();
|
||||||
|
|
||||||
// TODO: release the GL API lock to others glviews
|
// TODO: release the GL API lock to others glviews
|
||||||
}
|
}
|
||||||
@@ -139,10 +144,10 @@ BGLView::CopyPixelsIn(BBitmap *source, BPoint dest)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Mesa's GLenum is not ulong but uint, so we can't use GLenum
|
/*! Mesa's GLenum is not ulong but uint, so we can't use GLenum
|
||||||
without breaking this method signature.
|
without breaking this method signature.
|
||||||
Instead, we have to use the effective BeOS's SGI OpenGL GLenum type:
|
Instead, we have to use the effective BeOS's SGI OpenGL GLenum type:
|
||||||
unsigned long.
|
unsigned long.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
BGLView::ErrorCallback(unsigned long errorCode)
|
BGLView::ErrorCallback(unsigned long errorCode)
|
||||||
@@ -175,14 +180,15 @@ BGLView::AttachedToWindow()
|
|||||||
BView::AttachedToWindow();
|
BView::AttachedToWindow();
|
||||||
|
|
||||||
m_bounds = Bounds();
|
m_bounds = Bounds();
|
||||||
for (BView *v = this; v; v = v->Parent())
|
for (BView *view = this; view != NULL; view = view->Parent())
|
||||||
v->ConvertToParent(&m_bounds);
|
view->ConvertToParent(&m_bounds);
|
||||||
|
|
||||||
fRenderer = fRoster->GetRenderer();
|
fRenderer = fRoster->GetRenderer();
|
||||||
if (fRenderer) {
|
if (fRenderer != NULL) {
|
||||||
// Jackburton: The following code was commented because it doesn't look good in "direct" mode:
|
// Jackburton: The following code was commented because it doesn't look
|
||||||
// when the window is moved, the app_server doesn't paint the view's background, and
|
// good in "direct" mode:
|
||||||
// the stuff behind the window itself shows up.
|
// when the window is moved, the app_server doesn't paint the view's
|
||||||
|
// background, and the stuff behind the window itself shows up.
|
||||||
// Setting the view color to black, instead, looks a bit more elegant.
|
// Setting the view color to black, instead, looks a bit more elegant.
|
||||||
#if 0
|
#if 0
|
||||||
// Don't paint white window background when resized
|
// Don't paint white window background when resized
|
||||||
@@ -194,8 +200,10 @@ BGLView::AttachedToWindow()
|
|||||||
glViewport(0, 0, Bounds().IntegerWidth(), Bounds().IntegerHeight());
|
glViewport(0, 0, Bounds().IntegerWidth(), Bounds().IntegerHeight());
|
||||||
|
|
||||||
if (m_clip_info) {
|
if (m_clip_info) {
|
||||||
fRenderer->DirectConnected(((glview_direct_info *)m_clip_info)->direct_info);
|
fRenderer->DirectConnected(
|
||||||
fRenderer->EnableDirectMode(((glview_direct_info *)m_clip_info)->enable_direct_mode);
|
((glview_direct_info *)m_clip_info)->direct_info);
|
||||||
|
fRenderer->EnableDirectMode(
|
||||||
|
((glview_direct_info *)m_clip_info)->enable_direct_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -203,7 +211,8 @@ BGLView::AttachedToWindow()
|
|||||||
|
|
||||||
fprintf(stderr, "no renderer found! \n");
|
fprintf(stderr, "no renderer found! \n");
|
||||||
|
|
||||||
// No Renderer, no rendering. Setup a minimal "No Renderer" string drawing context
|
// No Renderer, no rendering. Setup a minimal "No Renderer" string drawing
|
||||||
|
// context
|
||||||
SetFont(be_bold_font);
|
SetFont(be_bold_font);
|
||||||
// SetFontSize(16);
|
// SetFontSize(16);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user