added a call to _mesa_make_current

not yet working but a bit better : 
GLTeapot display is now white instead of black :)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18776 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2006-09-07 21:13:53 +00:00
parent fe86a04667
commit 1d08e70ac5
4 changed files with 47 additions and 2 deletions

View File

@ -27,8 +27,8 @@ public:
void Acquire();
void Release();
virtual void LockGL();
virtual void UnlockGL();
virtual void LockGL();
virtual void UnlockGL();
virtual void SwapBuffers(bool VSync = false);
virtual void Draw(BRect updateRect);

View File

@ -8,6 +8,8 @@
*
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*/
#define CALLED() printf("CALLED %s\n",__PRETTY_FUNCTION__)
#include "MesaSoftRenderer.h"
extern "C" {
@ -156,6 +158,24 @@ MesaSoftRenderer::~MesaSoftRenderer()
}
void
MesaSoftRenderer::LockGL()
{
BGLRenderer::LockGL();
UpdateState(fContext, 0);
_mesa_make_current(fContext, fFrameBuffer);
}
void
MesaSoftRenderer::UnlockGL()
{
BGLRenderer::UnlockGL();
}
void
MesaSoftRenderer::SwapBuffers(bool VSync = false)
{
@ -172,6 +192,7 @@ MesaSoftRenderer::SwapBuffers(bool VSync = false)
void
MesaSoftRenderer::Draw(BRect updateRect)
{
CALLED();
if (fBitmap)
GLView()->DrawBitmap(fBitmap, updateRect, updateRect);
}
@ -180,6 +201,7 @@ MesaSoftRenderer::Draw(BRect updateRect)
status_t
MesaSoftRenderer::CopyPixelsOut(BPoint location, BBitmap *bitmap)
{
CALLED();
color_space scs = fBitmap->ColorSpace();
color_space dcs = bitmap->ColorSpace();
@ -216,6 +238,7 @@ MesaSoftRenderer::CopyPixelsOut(BPoint location, BBitmap *bitmap)
status_t
MesaSoftRenderer::CopyPixelsIn(BBitmap *bitmap, BPoint location)
{
CALLED();
color_space scs = bitmap->ColorSpace();
color_space dcs = fBitmap->ColorSpace();
@ -252,6 +275,7 @@ MesaSoftRenderer::CopyPixelsIn(BBitmap *bitmap, BPoint location)
void
MesaSoftRenderer::Viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
{
CALLED();
/* poll for window size change and realloc software Z/stencil/etc if needed */
_mesa_ResizeBuffersMESA();
}
@ -282,6 +306,8 @@ MesaSoftRenderer::Error(GLcontext *ctx)
void
MesaSoftRenderer::ClearIndex(GLcontext *ctx, GLuint index)
{
CALLED();
MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx;
mr->fClearIndex = index;
}
@ -290,6 +316,8 @@ MesaSoftRenderer::ClearIndex(GLcontext *ctx, GLuint index)
void
MesaSoftRenderer::ClearColor(GLcontext *ctx, const GLfloat color[4])
{
CALLED();
MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx;
CLAMPED_FLOAT_TO_CHAN(mr->fClearColor[BE_RCOMP], color[0]);
CLAMPED_FLOAT_TO_CHAN(mr->fClearColor[BE_GCOMP], color[1]);
@ -322,6 +350,8 @@ MesaSoftRenderer::ClearFront(GLcontext *ctx,
GLboolean all, GLint x, GLint y,
GLint width, GLint height)
{
CALLED();
MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx;
BGLView *bglview = mr->GLView();
assert(bglview);
@ -367,6 +397,8 @@ MesaSoftRenderer::ClearBack(GLcontext *ctx,
GLboolean all, GLint x, GLint y,
GLint width, GLint height)
{
CALLED();
MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx;
BGLView *bglview = mr->GLView();
assert(bglview);
@ -507,6 +539,8 @@ MesaSoftRenderer::WriteRGBASpanFront(const GLcontext *ctx, GLuint n,
CONST GLubyte rgba[][4],
const GLubyte mask[])
{
CALLED();
MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx;
BGLView *bglview = mr->GLView();
assert(bglview);
@ -533,6 +567,8 @@ MesaSoftRenderer::WriteRGBSpanFront(const GLcontext *ctx, GLuint n,
CONST GLubyte rgba[][3],
const GLubyte mask[])
{
CALLED();
MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx;
BGLView *bglview = mr->GLView();
assert(bglview);
@ -559,6 +595,8 @@ MesaSoftRenderer::WriteMonoRGBASpanFront(const GLcontext *ctx, GLuint n,
const GLchan color[4],
const GLubyte mask[])
{
CALLED();
MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx;
BGLView *bglview = mr->GLView();
assert(bglview);

View File

@ -24,6 +24,9 @@ class MesaSoftRenderer : public BGLRenderer
public:
MesaSoftRenderer(BGLView *view, ulong bgl_options, BGLDispatcher *dispatcher);
virtual ~MesaSoftRenderer();
virtual void LockGL();
virtual void UnlockGL();
virtual void SwapBuffers(bool VSync = false);
virtual void Draw(BRect updateRect);

View File

@ -8,6 +8,7 @@
BGLRenderer::BGLRenderer(BGLView *view, ulong bgl_options, BGLDispatcher *dispatcher)
: fRefCount(1),
fView(view),
fOptions(bgl_options),
fDispatcher(dispatcher)
{
@ -39,12 +40,15 @@ BGLRenderer::Release()
void
BGLRenderer::LockGL()
{
fView->LockLooper();
}
void
BGLRenderer::UnlockGL()
{
if (fView->Looper()->IsLocked())
fView->UnlockLooper();
}