Return-Path: owner-tiff@olympiakos.com
Return-Path: <owner-tiff@olympiakos.com>
Received: from localhost (localhost [127.0.0.1])
	by at1895.spb.edu (8.12.1/8.12.1/Debian -1) with ESMTP id fAKBHD92001262
	for <dron@localhost>; Tue, 20 Nov 2001 14:17:51 +0300
Received: from eudoramail.com [209.185.123.45]
	by localhost with POP3 (fetchmail-5.9.0)
	for dron@localhost (single-drop); Tue, 20 Nov 2001 14:17:51 +0300 (MSK)
Received: from gate7.olympiakos.com ([207.176.88.85]) by shared1-mail.whowhere.com; Tue Nov 20 02:08:58 2001
Received: from localhost (daemon@localhost)
	by gate7.olympiakos.com (8.9.3/8.9.3) with SMTP id EAA14278;
	Tue, 20 Nov 2001 04:52:22 -0500
Received: by gate7.olympiakos.com (bulk_mailer v1.9); Tue, 20 Nov 2001 04:48:20 -0500
Received: (from majordom@localhost)
	by gate7.olympiakos.com (8.9.3/8.9.3) id EAA14233
	for tiff-outgoing; Tue, 20 Nov 2001 04:48:11 -0500
X-Authentication-Warning: gate7.olympiakos.com: majordom set sender to owner-tiff@olympiakos.com using -f
Received: from penthouse.geoinform.fh-mainz.de ([143.93.105.31])
	by gate7.olympiakos.com (8.9.3/8.9.3) with ESMTP id EAA14230
	for <tiff@olympiakos.com>; Tue, 20 Nov 2001 04:48:08 -0500
Received: from geoinform.fh-mainz.de (localhost [127.0.0.1])
	by penthouse.geoinform.fh-mainz.de (8.10.0/8.10.0) with ESMTP id fAK9m7504756
	for <tiff@olympiakos.com>; Tue, 20 Nov 2001 10:48:07 +0100 (MET)
Message-ID: <3BFA26D7.147B5D07@geoinform.fh-mainz.de>
Date: Tue, 20 Nov 2001 10:48:07 +0100
From: Ben Fischer <fischer@geoinform.fh-mainz.de>
X-Mailer: Mozilla 4.76 [en] (X11; U; SunOS 5.6 sun4u)
X-Accept-Language: de, en
MIME-Version: 1.0
To: tiff@olympiakos.com
Subject: How to display *tiled* RGB TIFFs?
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sender: owner-tiff@olympiakos.com
Precedence: bulk
Status: RO
Content-Length: 1726
Lines: 59

I have a problem with displaying RGB(A) images that are tiled. 
First of all: Is the TIFFReadTile command correctly able to read 
tiled RGB images?

8 bit Grayscale images are no problem, but the tiles get 
messed up when I try to display RGB images.

I use this to read the tiles:

tdata_t buffer = _TIFFmalloc( TIFFTileSize( mpData->mpTiffFile ) );
if ( NULL == buffer )
        return false;

uint32 pixels_tile = mpData->mTileWidth * mpData->mTileHeight;
uint32 x = j * mpData->mTileWidth;
uint32 y = i * mpData->mTileHeight;
TIFFReadTile( mpData->mpTiffFile, buffer, x, y, 0, 0 );

unsigned char* ptr = new unsigned char [pixels_tile];
if ( 0 == ptr )
        return false;
unsigned char* ptr_begin = ptr;
unsigned char* raster = ( unsigned char* ) buffer;
uint32 k;
for ( k = 0; k < pixels_tile; ++k )
       *ptr++ = *raster++;
delete mpData->mpTileTable[i][j];
mpData->mpTileTable[i][j] = ptr_begin;
_TIFFfree( buffer );


And then I use this to display them:

for ( int row = mTileOffsetY; row < max_index_y; ++row )
{
 for ( int column = mTileOffsetX; column < max_index_x; ++column )
 {            
  glDrawPixels( ( GLsizei ) pImage->GetTileWidth(),
                ( GLsizei ) pImage->GetTileHeight(),
                  GL_RGB,
                  GL_UNSIGNED_BYTE,
                ( GLvoid* ) pImage->GetTile( row, column ));  

  glBitmap( 0, 0, 0.0f, 0.0f, move_x, 
            0.0f, NULL );
 }
 glBitmap( 0, 0, 0.0f, 0.0f, 
                  -mTilesX *  move_x, 
                  -move_y, NULL );
}

Any ideas what I am doing wrong?

Thanks,

Ben Fischer

To subscribe or unsubscribe email tiff-request@olympiakos.com with subscribe
or unsubscribe in the email body.  Libtiff home page: http://www.libtiff.org

