-/* $Id: GLView.cpp,v 1.3 2000/09/26 20:54:09 brianp Exp $ */
+/* $Id: GLView.cpp,v 1.4 2000/11/14 17:51:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
/*
* $Log: GLView.cpp,v $
+ * Revision 1.4 2000/11/14 17:51:15 brianp
+ * more Driver.Color, Driver.Index updates
+ *
* Revision 1.3 2000/09/26 20:54:09 brianp
* First batch of OpenGL SI related changes:
* Renamed struct gl_context to struct __GLcontextRec.
BGLView *mBGLView;
BBitmap *mBitmap;
- GLubyte mColor[4]; // current color
- GLuint mIndex; // current color index
GLubyte mClearColor[4]; // buffer clear color
GLuint mClearIndex; // buffer clear color index
GLint mBottom; // used for flipping Y coords
CONST GLubyte rgba[][3],
const GLubyte mask[]);
static void WriteMonoRGBASpanFront(const GLcontext *ctx, GLuint n,
- GLint x, GLint y, const GLubyte mask[]);
+ GLint x, GLint y,
+ const GLchan color[4],
+ const GLubyte mask[]);
static void WriteRGBAPixelsFront(const GLcontext *ctx, GLuint n,
const GLint x[], const GLint y[],
CONST GLubyte rgba[][4],
const GLubyte mask[]);
static void WriteMonoRGBAPixelsFront(const GLcontext *ctx, GLuint n,
const GLint x[], const GLint y[],
+ const GLchan color[4],
const GLubyte mask[]);
static void WriteCI32SpanFront(const GLcontext *ctx, GLuint n,
GLint x, GLint y,
GLint x, GLint y,
const GLubyte index[], const GLubyte mask[]);
static void WriteMonoCISpanFront(const GLcontext *ctx, GLuint n,
- GLint x, GLint y, const GLubyte mask[]);
+ GLint x, GLint y,
+ GLuint colorIndex, const GLubyte mask[]);
static void WriteCI32PixelsFront(const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
const GLuint index[], const GLubyte mask[]);
static void WriteMonoCIPixelsFront(const GLcontext *ctx, GLuint n,
const GLint x[], const GLint y[],
- const GLubyte mask[]);
+ GLuint colorIndex, const GLubyte mask[]);
static void ReadCI32SpanFront(const GLcontext *ctx,
GLuint n, GLint x, GLint y, GLuint index[]);
static void ReadRGBASpanFront(const GLcontext *ctx, GLuint n,
CONST GLubyte rgba[][3],
const GLubyte mask[]);
static void WriteMonoRGBASpanBack(const GLcontext *ctx, GLuint n,
- GLint x, GLint y, const GLubyte mask[]);
+ GLint x, GLint y,
+ const GLchan color[4],
+ const GLubyte mask[]);
static void WriteRGBAPixelsBack(const GLcontext *ctx, GLuint n,
- const GLint x[], const GLint y[],
- CONST GLubyte rgba[][4],
- const GLubyte mask[]);
+ const GLint x[], const GLint y[],
+ CONST GLubyte rgba[][4],
+ const GLubyte mask[]);
static void WriteMonoRGBAPixelsBack(const GLcontext *ctx, GLuint n,
- const GLint x[], const GLint y[],
- const GLubyte mask[]);
+ const GLint x[], const GLint y[],
+ const GLchan color[4],
+ const GLubyte mask[]);
static void WriteCI32SpanBack(const GLcontext *ctx, GLuint n,
GLint x, GLint y,
const GLuint index[], const GLubyte mask[]);
static void WriteCI8SpanBack(const GLcontext *ctx, GLuint n, GLint x, GLint y,
const GLubyte index[], const GLubyte mask[]);
static void WriteMonoCISpanBack(const GLcontext *ctx, GLuint n,
- GLint x, GLint y,
+ GLint x, GLint y, GLuint colorIndex,
const GLubyte mask[]);
static void WriteCI32PixelsBack(const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
const GLuint index[], const GLubyte mask[]);
static void WriteMonoCIPixelsBack(const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
- const GLubyte mask[]);
+ GLuint colorIndex, const GLubyte mask[]);
static void ReadCI32SpanBack(const GLcontext *ctx,
GLuint n, GLint x, GLint y, GLuint index[]);
static void ReadRGBASpanBack(const GLcontext *ctx, GLuint n,
mClearColor[BE_BCOMP] = 0;
mClearColor[BE_ACOMP] = 0;
mClearIndex = 0;
- mColor[BE_RCOMP] = 255;
- mColor[BE_GCOMP] = 255;
- mColor[BE_BCOMP] = 255;
- mColor[BE_ACOMP] = 255;
- mIndex = 1;
}
ctx->Driver.UpdateState = AuxInfo::UpdateState;
ctx->Driver.SetDrawBuffer = AuxInfo::SetDrawBuffer;
ctx->Driver.SetReadBuffer = AuxInfo::SetReadBuffer;
- ctx->Driver.Color = AuxInfo::Color;
- ctx->Driver.Index = AuxInfo::Index;
ctx->Driver.ClearIndex = AuxInfo::ClearIndex;
ctx->Driver.ClearColor = AuxInfo::ClearColor;
ctx->Driver.GetBufferSize = AuxInfo::GetBufferSize;
}
// restore drawing color
+#if 0
bglview->SetHighColor(aux->mColor[BE_RCOMP],
aux->mColor[BE_GCOMP],
aux->mColor[BE_BCOMP],
aux->mColor[BE_GCOMP],
aux->mColor[BE_BCOMP],
aux->mColor[BE_ACOMP]);
+#endif
}
}
-void AuxInfo::Index(GLcontext *ctx, GLuint index)
-{
- AuxInfo *aux = (AuxInfo *) ctx->DriverCtx;
- BGLView *bglview = aux->mBGLView;
- assert(bglview);
- aux->mIndex = index;
-}
-
-
-void AuxInfo::Color(GLcontext *ctx, GLubyte r, GLubyte g,
- GLubyte b, GLubyte a)
-{
- AuxInfo *aux = (AuxInfo *) ctx->DriverCtx;
- BGLView *bglview = aux->mBGLView;
- assert(bglview);
- aux->mColor[BE_RCOMP] = r;
- aux->mColor[BE_GCOMP] = g;
- aux->mColor[BE_BCOMP] = b;
- aux->mColor[BE_ACOMP] = a;
- bglview->SetHighColor(r, g, b, a);
- bglview->SetLowColor(r, g, b, a);
-}
-
GLboolean AuxInfo::SetDrawBuffer(GLcontext *ctx, GLenum buffer)
{
if (buffer == GL_FRONT_LEFT)
}
void AuxInfo::WriteMonoRGBASpanFront(const GLcontext *ctx, GLuint n,
- GLint x, GLint y, const GLubyte mask[])
+ GLint x, GLint y,
+ const GLchan color[4],
+ const GLubyte mask[])
{
AuxInfo *aux = (AuxInfo *) ctx->DriverCtx;
BGLView *bglview = aux->mBGLView;
assert(bglview);
int flippedY = aux->mBottom - y;
+ bglview->SetHighColor(color[RCOMP], color[GCOMP], color[BCOMP]);
if (mask) {
for (GLuint i = 0; i < n; i++) {
if (mask[i]) {
void AuxInfo::WriteMonoRGBAPixelsFront(const GLcontext *ctx, GLuint n,
const GLint x[], const GLint y[],
+ const GLchan color[4],
const GLubyte mask[])
{
AuxInfo *aux = (AuxInfo *) ctx->DriverCtx;
BGLView *bglview = aux->mBGLView;
assert(bglview);
// plot points using current color
+ bglview->SetHighColor(color[RCOMP], color[GCOMP], color[BCOMP]);
if (mask) {
for (GLuint i = 0; i < n; i++) {
if (mask[i]) {
}
void AuxInfo::WriteMonoCISpanFront( const GLcontext *ctx, GLuint n,
- GLint x, GLint y, const GLubyte mask[] )
+ GLint x, GLint y,
+ GLuint colorIndex, const GLubyte mask[] )
{
// XXX to do
}
void AuxInfo::WriteMonoCIPixelsFront( const GLcontext *ctx, GLuint n,
const GLint x[], const GLint y[],
- const GLubyte mask[] )
+ GLuint colorIndex, const GLubyte mask[] )
{
// XXX to do
}
void AuxInfo::WriteMonoRGBASpanBack(const GLcontext *ctx, GLuint n,
- GLint x, GLint y, const GLubyte mask[])
+ GLint x, GLint y,
+ const GLchan color[4], const GLubyte mask[])
{
AuxInfo *aux = (AuxInfo *) ctx->DriverCtx;
BBitmap *bitmap = aux->mBitmap;
assert(bitmap);
int row = aux->mBottom - y;
GLuint *pixelPtr = (GLuint *) bitmap->Bits() + row * aux->mWidth + x;
- const GLuint pixel = *((GLuint *) aux->mColor);
+ GLuint pixel;
+ GLubyte *mColor= (GLubyte *) &pixel;
+ mColor[BE_RCOMP] = color[RCOMP];
+ mColor[BE_GCOMP] = color[GCOMP];
+ mColor[BE_BCOMP] = color[BCOMP];
+ mColor[BE_ACOMP] = color[ACOMP];
if (mask) {
for (GLuint i = 0; i < n; i++) {
if (mask[i])
void AuxInfo::WriteMonoRGBAPixelsBack(const GLcontext *ctx, GLuint n,
- const GLint x[], const GLint y[],
- const GLubyte mask[])
+ const GLint x[], const GLint y[],
+ const GLchan color[4],
+ const GLubyte mask[])
{
AuxInfo *aux = (AuxInfo *) ctx->DriverCtx;
BBitmap *bitmap = aux->mBitmap;
+ GLuint pixel;
+ GLubyte *mColor= (GLubyte *) &pixel;
+ mColor[BE_RCOMP] = color[RCOMP];
+ mColor[BE_GCOMP] = color[GCOMP];
+ mColor[BE_BCOMP] = color[BCOMP];
+ mColor[BE_ACOMP] = color[ACOMP];
assert(bitmap);
- const GLuint pixel = *((GLuint *) aux->mColor);
if (mask) {
for (GLuint i = 0; i < n; i++) {
if (mask[i]) {
}
void AuxInfo::WriteMonoCISpanBack( const GLcontext *ctx, GLuint n,
- GLint x, GLint y, const GLubyte mask[] )
+ GLint x, GLint y,
+ GLuint colorIndex, const GLubyte mask[] )
{
// XXX to do
}
void AuxInfo::WriteMonoCIPixelsBack( const GLcontext *ctx, GLuint n,
const GLint x[], const GLint y[],
- const GLubyte mask[] )
+ GLuint colorIndex, const GLubyte mask[] )
{
// XXX to do
}