summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2005-01-29 13:36:15 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2005-01-29 13:36:15 +0000
commit58f4d67703381003c23fecbd3fe114ef9d1730c3 (patch)
tree55235f89c4cf75d37d0607df8a7336d717d85c3e /src/mesa
parentc84cde7b0b4d7a216aa60e0d322ae407107c98f8 (diff)
fix initial viewport size bug
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/osmesa/osmesa.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c
index b95e446590..7aa5673256 100644
--- a/src/mesa/drivers/osmesa/osmesa.c
+++ b/src/mesa/drivers/osmesa/osmesa.c
@@ -2,7 +2,7 @@
* Mesa 3-D graphics library
* Version: 6.3
*
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2005 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"),
@@ -1107,12 +1107,18 @@ OSMesaMakeCurrent( OSMesaContext ctx, void *buffer, GLenum type,
return GL_FALSE;
}
- osmesa_update_state( &ctx->mesa, 0 );
- _mesa_make_current( &ctx->mesa, ctx->gl_buffer );
-
+ /* Need to set these before calling _mesa_make_current() since the first
+ * time the context is bound, _mesa_make_current() will call our
+ * get_buffer_size() function to initialize the viewport. These are the
+ * values returned by get_buffer_size():
+ */
ctx->buffer = buffer;
ctx->width = width;
ctx->height = height;
+
+ osmesa_update_state( &ctx->mesa, 0 );
+ _mesa_make_current( &ctx->mesa, ctx->gl_buffer );
+
if (ctx->userRowLength)
ctx->rowlength = ctx->userRowLength;
else
@@ -1120,17 +1126,8 @@ OSMesaMakeCurrent( OSMesaContext ctx, void *buffer, GLenum type,
compute_row_addresses( ctx );
- /* init viewport */
- if (ctx->mesa.Viewport.Width == 0) {
- /* initialize viewport and scissor box to buffer size */
- _mesa_Viewport( 0, 0, width, height );
- ctx->mesa.Scissor.Width = width;
- ctx->mesa.Scissor.Height = height;
- }
- else {
- /* this will make ensure we recognize the new buffer size */
- _mesa_ResizeBuffersMESA();
- }
+ /* this will make ensure we recognize the new buffer size */
+ _mesa_ResizeBuffersMESA();
/* Added by Gerk Huisma: */
_tnl_MakeCurrent( &ctx->mesa, ctx->mesa.DrawBuffer,