tweaks to allow different read formats/types
This commit is contained in:
parent
047fdf06cc
commit
d3d72804b0
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: readpix.c,v 1.2 2000/03/23 19:47:25 brianp Exp $ */
|
/* $Id: readpix.c,v 1.3 2000/03/31 01:01:31 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* glReadPixels and glCopyPixels test
|
* glReadPixels and glCopyPixels test
|
||||||
|
@ -8,6 +8,9 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: readpix.c,v $
|
* $Log: readpix.c,v $
|
||||||
|
* Revision 1.3 2000/03/31 01:01:31 brianp
|
||||||
|
* tweaks to allow different read formats/types
|
||||||
|
*
|
||||||
* Revision 1.2 2000/03/23 19:47:25 brianp
|
* Revision 1.2 2000/03/23 19:47:25 brianp
|
||||||
* added benchmarking
|
* added benchmarking
|
||||||
*
|
*
|
||||||
|
@ -40,6 +43,19 @@ static GLboolean ScaleAndBias = GL_FALSE;
|
||||||
static GLboolean Benchmark = GL_FALSE;
|
static GLboolean Benchmark = GL_FALSE;
|
||||||
static GLubyte *TempImage = NULL;
|
static GLubyte *TempImage = NULL;
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
#define ReadFormat ImgFormat
|
||||||
|
#define ReadType GL_UNSIGNED_BYTE
|
||||||
|
#endif
|
||||||
|
#if 0
|
||||||
|
static GLenum ReadFormat = GL_RGBA;
|
||||||
|
static GLenum ReadType = GL_UNSIGNED_BYTE;
|
||||||
|
#endif
|
||||||
|
#if 0
|
||||||
|
static GLenum ReadFormat = GL_RGB;
|
||||||
|
static GLenum ReadType = GL_UNSIGNED_SHORT_5_6_5;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Reset( void )
|
Reset( void )
|
||||||
|
@ -110,7 +126,7 @@ Display( void )
|
||||||
printf("Benchmarking...\n");
|
printf("Benchmarking...\n");
|
||||||
do {
|
do {
|
||||||
glReadPixels(APosX, APosY, ImgWidth, ImgHeight,
|
glReadPixels(APosX, APosY, ImgWidth, ImgHeight,
|
||||||
ImgFormat, GL_UNSIGNED_BYTE, TempImage);
|
ReadFormat, ReadType, TempImage);
|
||||||
reads++;
|
reads++;
|
||||||
endTime = glutGet(GLUT_ELAPSED_TIME);
|
endTime = glutGet(GLUT_ELAPSED_TIME);
|
||||||
} while (endTime - startTime < 4000); /* 4 seconds */
|
} while (endTime - startTime < 4000); /* 4 seconds */
|
||||||
|
@ -122,12 +138,12 @@ Display( void )
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
glReadPixels(APosX, APosY, ImgWidth, ImgHeight,
|
glReadPixels(APosX, APosY, ImgWidth, ImgHeight,
|
||||||
ImgFormat, GL_UNSIGNED_BYTE, TempImage);
|
ReadFormat, ReadType, TempImage);
|
||||||
}
|
}
|
||||||
glRasterPos2i(BPosX, BPosY);
|
glRasterPos2i(BPosX, BPosY);
|
||||||
glDisable(GL_DITHER);
|
glDisable(GL_DITHER);
|
||||||
SetupPixelTransfer(GL_FALSE);
|
SetupPixelTransfer(GL_FALSE);
|
||||||
glDrawPixels(ImgWidth, ImgHeight, ImgFormat, GL_UNSIGNED_BYTE, TempImage);
|
glDrawPixels(ImgWidth, ImgHeight, ReadFormat, ReadType, TempImage);
|
||||||
|
|
||||||
/* do copypixels */
|
/* do copypixels */
|
||||||
glRasterPos2i(CPosX, 5);
|
glRasterPos2i(CPosX, 5);
|
||||||
|
|
Loading…
Reference in New Issue