Added a GetGLProcAddress() method to BGLView.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38578 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+31
-29
@@ -39,37 +39,38 @@ public:
|
|||||||
ulong resizingMode, ulong mode,
|
ulong resizingMode, ulong mode,
|
||||||
ulong options);
|
ulong options);
|
||||||
virtual ~BGLView();
|
virtual ~BGLView();
|
||||||
|
|
||||||
void LockGL();
|
void LockGL();
|
||||||
void UnlockGL();
|
void UnlockGL();
|
||||||
void SwapBuffers();
|
void SwapBuffers();
|
||||||
void SwapBuffers(bool vSync);
|
void SwapBuffers(bool vSync);
|
||||||
|
|
||||||
BView* EmbeddedView(); // deprecated, returns NULL
|
BView* EmbeddedView(); // deprecated, returns NULL
|
||||||
|
void* GetGLProcAddress(const char* procName);
|
||||||
|
|
||||||
status_t CopyPixelsOut(BPoint source, BBitmap *dest);
|
status_t CopyPixelsOut(BPoint source, BBitmap *dest);
|
||||||
status_t CopyPixelsIn(BBitmap *source, BPoint dest);
|
status_t CopyPixelsIn(BBitmap *source, BPoint dest);
|
||||||
|
|
||||||
// Mesa's GLenum is uint where Be's ones was ulong!
|
// Mesa's GLenum is uint where Be's ones was ulong!
|
||||||
virtual void ErrorCallback(unsigned long errorCode);
|
virtual void ErrorCallback(unsigned long errorCode);
|
||||||
|
|
||||||
virtual void Draw(BRect updateRect);
|
virtual void Draw(BRect updateRect);
|
||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
virtual void AllAttached();
|
virtual void AllAttached();
|
||||||
virtual void DetachedFromWindow();
|
virtual void DetachedFromWindow();
|
||||||
virtual void AllDetached();
|
virtual void AllDetached();
|
||||||
|
|
||||||
virtual void FrameResized(float newWidth, float newHeight);
|
virtual void FrameResized(float newWidth, float newHeight);
|
||||||
virtual status_t Perform(perform_code d, void *arg);
|
virtual status_t Perform(perform_code d, void *arg);
|
||||||
|
|
||||||
virtual status_t Archive(BMessage *data, bool deep = true) const;
|
virtual status_t Archive(BMessage *data, bool deep = true) const;
|
||||||
|
|
||||||
virtual void MessageReceived(BMessage *message);
|
virtual void MessageReceived(BMessage *message);
|
||||||
virtual void SetResizingMode(uint32 mode);
|
virtual void SetResizingMode(uint32 mode);
|
||||||
|
|
||||||
virtual void Show();
|
virtual void Show();
|
||||||
virtual void Hide();
|
virtual void Hide();
|
||||||
|
|
||||||
virtual BHandler* ResolveSpecifier(BMessage *msg, int32 index,
|
virtual BHandler* ResolveSpecifier(BMessage *msg, int32 index,
|
||||||
BMessage *specifier, int32 form,
|
BMessage *specifier, int32 form,
|
||||||
const char *property);
|
const char *property);
|
||||||
@@ -79,20 +80,21 @@ virtual status_t GetSupportedSuites(BMessage *data);
|
|||||||
void EnableDirectMode(bool enabled);
|
void EnableDirectMode(bool enabled);
|
||||||
|
|
||||||
void* getGC() { return fGc; } // ???
|
void* getGC() { return fGc; } // ???
|
||||||
|
|
||||||
virtual void GetPreferredSize(float* width, float* height);
|
virtual void GetPreferredSize(float* width, float* height);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
virtual void _ReservedGLView1();
|
virtual void _ReservedGLView1();
|
||||||
virtual void _ReservedGLView2();
|
virtual void _ReservedGLView2();
|
||||||
virtual void _ReservedGLView3();
|
virtual void _ReservedGLView3();
|
||||||
virtual void _ReservedGLView4();
|
virtual void _ReservedGLView4();
|
||||||
virtual void _ReservedGLView5();
|
virtual void _ReservedGLView5();
|
||||||
virtual void _ReservedGLView6();
|
virtual void _ReservedGLView6();
|
||||||
virtual void _ReservedGLView7();
|
virtual void _ReservedGLView7();
|
||||||
virtual void _ReservedGLView8();
|
virtual void _ReservedGLView8();
|
||||||
|
|
||||||
BGLView(const BGLView &);
|
BGLView(const BGLView &);
|
||||||
BGLView &operator=(const BGLView &);
|
BGLView &operator=(const BGLView &);
|
||||||
|
|
||||||
@@ -100,14 +102,14 @@ private:
|
|||||||
bool _ConfirmDither();
|
bool _ConfirmDither();
|
||||||
void _Draw(BRect rect);
|
void _Draw(BRect rect);
|
||||||
void _CallDirectConnected();
|
void _CallDirectConnected();
|
||||||
|
|
||||||
void * fGc;
|
void * fGc;
|
||||||
uint32 fOptions;
|
uint32 fOptions;
|
||||||
uint32 fDitherCount;
|
uint32 fDitherCount;
|
||||||
BLocker fDrawLock;
|
BLocker fDrawLock;
|
||||||
BLocker fDisplayLock;
|
BLocker fDisplayLock;
|
||||||
glview_direct_info * fClipInfo;
|
glview_direct_info * fClipInfo;
|
||||||
|
|
||||||
BGLRenderer *fRenderer;
|
BGLRenderer *fRenderer;
|
||||||
GLRendererRoster *fRoster;
|
GLRendererRoster *fRoster;
|
||||||
|
|
||||||
@@ -115,10 +117,10 @@ private:
|
|||||||
BRect fBounds;
|
BRect fBounds;
|
||||||
int16 * fErrorBuffer[2];
|
int16 * fErrorBuffer[2];
|
||||||
uint64 _reserved[8];
|
uint64 _reserved[8];
|
||||||
|
|
||||||
void _LockDraw();
|
void _LockDraw();
|
||||||
void _UnlockDraw();
|
void _UnlockDraw();
|
||||||
|
|
||||||
// BeOS compatibility
|
// BeOS compatibility
|
||||||
private:
|
private:
|
||||||
BGLView(BRect rect, char* name,
|
BGLView(BRect rect, char* name,
|
||||||
@@ -139,14 +141,14 @@ public:
|
|||||||
void SwapBuffers();
|
void SwapBuffers();
|
||||||
// Mesa's GLenum is uint where Be's ones was ulong!
|
// Mesa's GLenum is uint where Be's ones was ulong!
|
||||||
virtual void ErrorCallback(unsigned long errorCode);
|
virtual void ErrorCallback(unsigned long errorCode);
|
||||||
|
|
||||||
virtual void ScreenConnected(bool connected);
|
virtual void ScreenConnected(bool connected);
|
||||||
virtual void FrameResized(float width, float height);
|
virtual void FrameResized(float width, float height);
|
||||||
virtual status_t Perform(perform_code code, void *arg);
|
virtual status_t Perform(perform_code code, void *arg);
|
||||||
|
|
||||||
virtual status_t Archive(BMessage *data, bool deep = true) const;
|
virtual status_t Archive(BMessage *data, bool deep = true) const;
|
||||||
virtual void MessageReceived(BMessage *message);
|
virtual void MessageReceived(BMessage *message);
|
||||||
|
|
||||||
virtual void Show();
|
virtual void Show();
|
||||||
virtual void Hide();
|
virtual void Hide();
|
||||||
|
|
||||||
@@ -166,7 +168,7 @@ private:
|
|||||||
virtual void _ReservedGLScreen5();
|
virtual void _ReservedGLScreen5();
|
||||||
virtual void _ReservedGLScreen6();
|
virtual void _ReservedGLScreen6();
|
||||||
virtual void _ReservedGLScreen7();
|
virtual void _ReservedGLScreen7();
|
||||||
virtual void _ReservedGLScreen8();
|
virtual void _ReservedGLScreen8();
|
||||||
|
|
||||||
BGLScreen(const BGLScreen &);
|
BGLScreen(const BGLScreen &);
|
||||||
BGLScreen &operator=(const BGLScreen &);
|
BGLScreen &operator=(const BGLScreen &);
|
||||||
@@ -174,13 +176,13 @@ private:
|
|||||||
void * fGc;
|
void * fGc;
|
||||||
long fOptions;
|
long fOptions;
|
||||||
BLocker fDrawLock;
|
BLocker fDrawLock;
|
||||||
|
|
||||||
int32 fColorSpace;
|
int32 fColorSpace;
|
||||||
uint32 fScreenMode;
|
uint32 fScreenMode;
|
||||||
|
|
||||||
uint64 _reserved[7];
|
uint64 _reserved[7];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
#endif // BGLVIEW_H
|
#endif // BGLVIEW_H
|
||||||
|
|||||||
+21
-25
@@ -8,30 +8,6 @@
|
|||||||
* Stefano Ceccherini, [email protected]
|
* Stefano Ceccherini, [email protected]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* Mesa 3-D graphics library
|
|
||||||
* Version: 6.1
|
|
||||||
*
|
|
||||||
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included
|
|
||||||
* in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
||||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
||||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include <GLView.h>
|
#include <GLView.h>
|
||||||
|
|
||||||
@@ -43,6 +19,7 @@
|
|||||||
#include <GLRenderer.h>
|
#include <GLRenderer.h>
|
||||||
|
|
||||||
#include "DirectWindowPrivate.h"
|
#include "DirectWindowPrivate.h"
|
||||||
|
#include "GLDispatcher.h"
|
||||||
#include "GLRendererRoster.h"
|
#include "GLRendererRoster.h"
|
||||||
|
|
||||||
struct glview_direct_info {
|
struct glview_direct_info {
|
||||||
@@ -129,6 +106,21 @@ BGLView::EmbeddedView()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void*
|
||||||
|
BGLView::GetGLProcAddress(const char* procName)
|
||||||
|
{
|
||||||
|
BGLDispatcher* glDispatcher = NULL;
|
||||||
|
|
||||||
|
if (fRenderer)
|
||||||
|
glDispatcher = fRenderer->GLDispatcher();
|
||||||
|
|
||||||
|
if (glDispatcher)
|
||||||
|
return (void*)glDispatcher->AddressOf(procName);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BGLView::CopyPixelsOut(BPoint source, BBitmap *dest)
|
BGLView::CopyPixelsOut(BPoint source, BBitmap *dest)
|
||||||
{
|
{
|
||||||
@@ -207,8 +199,11 @@ BGLView::AttachedToWindow()
|
|||||||
#else
|
#else
|
||||||
SetViewColor(0, 0, 0);
|
SetViewColor(0, 0, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Set default OpenGL viewport:
|
// Set default OpenGL viewport:
|
||||||
|
LockGL();
|
||||||
glViewport(0, 0, Bounds().IntegerWidth(), Bounds().IntegerHeight());
|
glViewport(0, 0, Bounds().IntegerWidth(), Bounds().IntegerHeight());
|
||||||
|
UnlockGL();
|
||||||
fRenderer->FrameResized(Bounds().IntegerWidth(),
|
fRenderer->FrameResized(Bounds().IntegerWidth(),
|
||||||
Bounds().IntegerHeight());
|
Bounds().IntegerHeight());
|
||||||
|
|
||||||
@@ -461,7 +456,8 @@ void BGLView::_ReservedGLView8() {}
|
|||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
// BeOS compatibility
|
// BeOS compatibility: contrary to others BView's contructors,
|
||||||
|
// BGLView one wants a non-const name argument.
|
||||||
BGLView::BGLView(BRect rect, char* name, ulong resizingMode, ulong mode,
|
BGLView::BGLView(BRect rect, char* name, ulong resizingMode, ulong mode,
|
||||||
ulong options)
|
ulong options)
|
||||||
:
|
:
|
||||||
|
|||||||
Reference in New Issue
Block a user