-/* $Id: xm_api.c,v 1.38 2002/06/16 01:11:10 brianp Exp $ */
+/* $Id: xm_api.c,v 1.39 2002/06/17 23:38:14 brianp Exp $ */
/*
* Mesa 3-D graphics library
get_drawable_size( v->display, window, &w, &h );
b->width = w;
b->height = h;
- b->mesa_buffer.Width = w;
- b->mesa_buffer.Height = h;
b->frontbuffer = window;
-/* $Id: context.c,v 1.170 2002/06/17 23:36:31 brianp Exp $ */
+/* $Id: context.c,v 1.171 2002/06/17 23:38:14 brianp Exp $ */
/*
* Mesa 3-D graphics library
newCtx->DrawBuffer = drawBuffer;
newCtx->ReadBuffer = readBuffer;
newCtx->NewState |= _NEW_BUFFERS;
- /* _mesa_update_state( newCtx ); */
+
+ if (drawBuffer->Width == 0 && drawBuffer->Height == 0) {
+ /* get initial window size */
+ GLuint bufWidth, bufHeight;
+
+ /* ask device driver for size of output buffer */
+ (*newCtx->Driver.GetBufferSize)( drawBuffer, &bufWidth, &bufHeight );
+
+ if (drawBuffer->Width == bufWidth && drawBuffer->Height == bufHeight)
+ return; /* size is as expected */
+
+ drawBuffer->Width = bufWidth;
+ drawBuffer->Height = bufHeight;
+
+ newCtx->Driver.ResizeBuffers( drawBuffer );
+ }
+
+ if (readBuffer != drawBuffer &&
+ readBuffer->Width == 0 && readBuffer->Height == 0) {
+ /* get initial window size */
+ GLuint bufWidth, bufHeight;
+
+ /* ask device driver for size of output buffer */
+ (*newCtx->Driver.GetBufferSize)( readBuffer, &bufWidth, &bufHeight );
+
+ if (readBuffer->Width == bufWidth && readBuffer->Height == bufHeight)
+ return; /* size is as expected */
+
+ readBuffer->Width = bufWidth;
+ readBuffer->Height = bufHeight;
+
+ newCtx->Driver.ResizeBuffers( readBuffer );
+ }
}
/* This is only for T&L - a bit out of place, or misnamed (BP) */