fixed errors in feedback for glDraw/CopyPixels and glBitmap

This commit is contained in:
Brian Paul 2001-12-13 19:12:42 +00:00
parent 59235bd5da
commit d9331ae71e
1 changed files with 23 additions and 38 deletions

View File

@ -1,8 +1,8 @@
/* $Id: drawpix.c,v 1.56 2001/06/26 21:15:35 brianp Exp $ */ /* $Id: drawpix.c,v 1.57 2001/12/13 19:12:42 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.5 * Version: 4.1
* *
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
* *
@ -72,20 +72,13 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
} }
else if (ctx->RenderMode==GL_FEEDBACK) { else if (ctx->RenderMode==GL_FEEDBACK) {
if (ctx->Current.RasterPosValid) { if (ctx->Current.RasterPosValid) {
GLfloat texcoord[4], invq;
FLUSH_CURRENT(ctx, 0); FLUSH_CURRENT(ctx, 0);
invq = 1.0F / ctx->Current.Texcoord[0][3];
texcoord[0] = ctx->Current.Texcoord[0][0] * invq;
texcoord[1] = ctx->Current.Texcoord[0][1] * invq;
texcoord[2] = ctx->Current.Texcoord[0][2] * invq;
texcoord[3] = ctx->Current.Texcoord[0][3];
FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN ); FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN );
_mesa_feedback_vertex( ctx, _mesa_feedback_vertex( ctx,
ctx->Current.RasterPos, ctx->Current.RasterPos,
ctx->Current.Color, ctx->Current.RasterColor,
ctx->Current.Index, ctx->Current.RasterIndex,
texcoord ); ctx->Current.RasterTexCoord );
} }
} }
else if (ctx->RenderMode==GL_SELECT) { else if (ctx->RenderMode==GL_SELECT) {
@ -152,13 +145,15 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
type ); type );
} }
else if (ctx->RenderMode == GL_FEEDBACK) { else if (ctx->RenderMode == GL_FEEDBACK) {
FLUSH_CURRENT( ctx, 0 ); if (ctx->Current.RasterPosValid) {
FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_COPY_PIXEL_TOKEN ); FLUSH_CURRENT(ctx, 0);
_mesa_feedback_vertex( ctx, FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_COPY_PIXEL_TOKEN );
ctx->Current.RasterPos, _mesa_feedback_vertex( ctx,
ctx->Current.Color, ctx->Current.RasterPos,
ctx->Current.Index, ctx->Current.RasterColor,
ctx->Current.Texcoord[0] ); ctx->Current.RasterIndex,
ctx->Current.RasterTexCoord );
}
} }
else if (ctx->RenderMode == GL_SELECT) { else if (ctx->RenderMode == GL_SELECT) {
_mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] ); _mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] );
@ -175,7 +170,6 @@ _mesa_Bitmap( GLsizei width, GLsizei height,
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
/* Error checking */ /* Error checking */
if (width < 0 || height < 0) { if (width < 0 || height < 0) {
_mesa_error( ctx, GL_INVALID_VALUE, "glBitmap" ); _mesa_error( ctx, GL_INVALID_VALUE, "glBitmap" );
@ -201,24 +195,15 @@ _mesa_Bitmap( GLsizei width, GLsizei height,
} }
} }
else if (ctx->RenderMode==GL_FEEDBACK) { else if (ctx->RenderMode==GL_FEEDBACK) {
GLfloat color[4], texcoord[4], invq; if (ctx->Current.RasterPosValid) {
FLUSH_CURRENT(ctx, 0);
color[0] = ctx->Current.RasterColor[0]; FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_BITMAP_TOKEN );
color[1] = ctx->Current.RasterColor[1]; _mesa_feedback_vertex( ctx,
color[2] = ctx->Current.RasterColor[2]; ctx->Current.RasterPos,
color[3] = ctx->Current.RasterColor[3]; ctx->Current.RasterColor,
if (ctx->Current.Texcoord[0][3] == 0.0) ctx->Current.RasterIndex,
invq = 1.0F; ctx->Current.RasterTexCoord );
else }
invq = 1.0F / ctx->Current.RasterTexCoord[3];
texcoord[0] = ctx->Current.RasterTexCoord[0] * invq;
texcoord[1] = ctx->Current.RasterTexCoord[1] * invq;
texcoord[2] = ctx->Current.RasterTexCoord[2] * invq;
texcoord[3] = ctx->Current.RasterTexCoord[3];
FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_BITMAP_TOKEN );
_mesa_feedback_vertex( ctx,
ctx->Current.RasterPos,
color, ctx->Current.RasterIndex, texcoord );
} }
else if (ctx->RenderMode==GL_SELECT) { else if (ctx->RenderMode==GL_SELECT) {
/* Bitmaps don't generate selection hits. See appendix B of 1.1 spec. */ /* Bitmaps don't generate selection hits. See appendix B of 1.1 spec. */