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:
Philippe Houdoin 2010-09-08 10:01:37 +00:00
parent 35c8505a33
commit fafc6e4b77
2 changed files with 52 additions and 54 deletions

View File

@ -39,37 +39,38 @@ public:
ulong resizingMode, ulong mode,
ulong options);
virtual ~BGLView();
void LockGL();
void UnlockGL();
void SwapBuffers();
void SwapBuffers(bool vSync);
BView* EmbeddedView(); // deprecated, returns NULL
void* GetGLProcAddress(const char* procName);
status_t CopyPixelsOut(BPoint source, BBitmap *dest);
status_t CopyPixelsIn(BBitmap *source, BPoint dest);
// Mesa's GLenum is uint where Be's ones was ulong!
virtual void ErrorCallback(unsigned long errorCode);
virtual void Draw(BRect updateRect);
virtual void AttachedToWindow();
virtual void AllAttached();
virtual void DetachedFromWindow();
virtual void AllDetached();
virtual void FrameResized(float newWidth, float newHeight);
virtual status_t Perform(perform_code d, void *arg);
virtual status_t Archive(BMessage *data, bool deep = true) const;
virtual void MessageReceived(BMessage *message);
virtual void SetResizingMode(uint32 mode);
virtual void Show();
virtual void Hide();
virtual BHandler* ResolveSpecifier(BMessage *msg, int32 index,
BMessage *specifier, int32 form,
const char *property);
@ -79,20 +80,21 @@ virtual status_t GetSupportedSuites(BMessage *data);
void EnableDirectMode(bool enabled);
void* getGC() { return fGc; } // ???
virtual void GetPreferredSize(float* width, float* height);
private:
virtual void _ReservedGLView1();
virtual void _ReservedGLView2();
virtual void _ReservedGLView3();
virtual void _ReservedGLView4();
virtual void _ReservedGLView5();
virtual void _ReservedGLView6();
virtual void _ReservedGLView7();
virtual void _ReservedGLView8();
virtual void _ReservedGLView2();
virtual void _ReservedGLView3();
virtual void _ReservedGLView4();
virtual void _ReservedGLView5();
virtual void _ReservedGLView6();
virtual void _ReservedGLView7();
virtual void _ReservedGLView8();
BGLView(const BGLView &);
BGLView &operator=(const BGLView &);
@ -100,14 +102,14 @@ private:
bool _ConfirmDither();
void _Draw(BRect rect);
void _CallDirectConnected();
void * fGc;
uint32 fOptions;
uint32 fDitherCount;
BLocker fDrawLock;
BLocker fDisplayLock;
glview_direct_info * fClipInfo;
BGLRenderer *fRenderer;
GLRendererRoster *fRoster;
@ -115,10 +117,10 @@ private:
BRect fBounds;
int16 * fErrorBuffer[2];
uint64 _reserved[8];
void _LockDraw();
void _UnlockDraw();
// BeOS compatibility
private:
BGLView(BRect rect, char* name,
@ -139,14 +141,14 @@ public:
void SwapBuffers();
// Mesa's GLenum is uint where Be's ones was ulong!
virtual void ErrorCallback(unsigned long errorCode);
virtual void ScreenConnected(bool connected);
virtual void FrameResized(float width, float height);
virtual status_t Perform(perform_code code, void *arg);
virtual status_t Archive(BMessage *data, bool deep = true) const;
virtual void MessageReceived(BMessage *message);
virtual void Show();
virtual void Hide();
@ -166,7 +168,7 @@ private:
virtual void _ReservedGLScreen5();
virtual void _ReservedGLScreen6();
virtual void _ReservedGLScreen7();
virtual void _ReservedGLScreen8();
virtual void _ReservedGLScreen8();
BGLScreen(const BGLScreen &);
BGLScreen &operator=(const BGLScreen &);
@ -174,13 +176,13 @@ private:
void * fGc;
long fOptions;
BLocker fDrawLock;
int32 fColorSpace;
uint32 fScreenMode;
uint64 _reserved[7];
};
#endif // __cplusplus
#endif // BGLVIEW_H

View File

@ -8,30 +8,6 @@
* Stefano Ceccherini, burton666@libero.it
*/
/*
* 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>
@ -43,6 +19,7 @@
#include <GLRenderer.h>
#include "DirectWindowPrivate.h"
#include "GLDispatcher.h"
#include "GLRendererRoster.h"
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
BGLView::CopyPixelsOut(BPoint source, BBitmap *dest)
{
@ -207,8 +199,11 @@ BGLView::AttachedToWindow()
#else
SetViewColor(0, 0, 0);
#endif
// Set default OpenGL viewport:
LockGL();
glViewport(0, 0, Bounds().IntegerWidth(), Bounds().IntegerHeight());
UnlockGL();
fRenderer->FrameResized(Bounds().IntegerWidth(),
Bounds().IntegerHeight());
@ -461,7 +456,8 @@ void BGLView::_ReservedGLView8() {}
// #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,
ulong options)
: