OpenGL on Intel Bug - 10.4.7 2006-07-03 - By Alexei Svitkine
Back Hi,
There appears to be a bug on the Mac OS X 10.4.7 Intel OpenGL implementation as of the 10.4.7 update (10.4.6 didn't have it), and it is also unrelated to the Combo vs Delta missing OpenGL files bug that's affected WoW.
Our code goes thus (snipped for clarity):
pixmap = malloc( BITMAP_TEXTURE_SQUARE * BITMAP_TEXTURE_SQUARE * (1 << bitmap->pixel_upshift) ) ; if( !pixmap ) { error_message(_error_out_of_memory, __FILE__, __LINE__, "couldn't allocate memory for pixmap"); goto _draw_bitmap_opengl_eom; }
for (j = 0;j < rectangle2d_height(bounds); j += BITMAP_TEXTURE_SQUARE) for (i = 0; i < rectangle2d_width(bounds); i += BITMAP_TEXTURE_SQUARE) { // read part of the bitmap into the buffer copy_bitmap_into_buffer( pixmap, i, j, BITMAP_TEXTURE_SQUARE, BITMAP_TEXTURE_SQUARE, bitmap ) ;
glTexImage2D( GL_TEXTURE_2D, 0, internalformat, BITMAP_TEXTURE_SQUARE, BITMAP_TEXTURE_SQUARE, 0, format, type, pixmap ) ; // 2. draw a textured rectangle at bound glBegin( GL_TRIANGLE_FAN ) ; glTexCoord2f( 0, 0 ) ; glVertex2f( bounds->left + (i), bounds->top + (j) ) ; glTexCoord2f( 0, 1 ) ; glVertex2f( bounds->left + (i), bounds->top + (j + BITMAP_TEXTURE_SQUARE) ) ; glTexCoord2f( 1, 1 ) ; glVertex2f( bounds->left + (i + BITMAP_TEXTURE_SQUARE), bounds- >top + (j + BITMAP_TEXTURE_SQUARE) ) ; glTexCoord2f( 1, 0 ) ; glVertex2f( bounds->left + (i + BITMAP_TEXTURE_SQUARE), bounds- >top + (j) ) ; glEnd() ; }
What it's doing is, it allocates one single buffer for pixels, and draw a large bitmap by drawing BITMAP_TEXTURE_SQUARE x BITMAP_TEXTURE_SQUARE squares of it. It's reusing the buffer. On all previous Mac OS X updates, and on 10.4.7 on PPC Macs, this works perfectly.
However, as of 10.4.7 on Intel-processor Macs, it repeats the first square that was copied into the buffer, and doesn't update it once new data is copied into it and glTexImage2D is called again. Again, this behaviour differs from everything but Intel Macs with 10.4.7 (works fine on PPC macs and on Windows).
This is most frustrating - as a simple work around we can allocate a new buffer for each square with malloc and then free it after, but this is super inefficient. :(
-Alexei Svitkine Project Magma http://projectmagma.net
__ ____ ____ ____ ____ ____ ____ ____ ____ ____ Do not post admin requests to the list. They will be ignored. Mac-games-dev mailing list (Mac-games-dev@(protected)) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/mac-games-dev/junlu%405341.com
This email sent to junlu@(protected)
|
|