mirror of
https://github.com/glest/glest-source.git
synced 2025-08-20 07:01:21 +02:00
- more debug info for color picking issue
This commit is contained in:
@@ -1806,6 +1806,7 @@ Pixmap2D *PixelBufferWrapper::getPixelBufferFor(int x,int y,int w,int h, int col
|
|||||||
Pixmap2D *pixmapScreenShot = NULL;
|
Pixmap2D *pixmapScreenShot = NULL;
|
||||||
if(PixelBufferWrapper::isPBOEnabled == true) {
|
if(PixelBufferWrapper::isPBOEnabled == true) {
|
||||||
string codeSection = "A";
|
string codeSection = "A";
|
||||||
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] ",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
try {
|
try {
|
||||||
// increment current index first then get the next index
|
// increment current index first then get the next index
|
||||||
// "index" is used to read pixels from a framebuffer to a PBO
|
// "index" is used to read pixels from a framebuffer to a PBO
|
||||||
@@ -1813,6 +1814,7 @@ Pixmap2D *PixelBufferWrapper::getPixelBufferFor(int x,int y,int w,int h, int col
|
|||||||
index = (index + 1) % 2;
|
index = (index + 1) % 2;
|
||||||
|
|
||||||
codeSection = "B";
|
codeSection = "B";
|
||||||
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] ",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
// Check for out of range
|
// Check for out of range
|
||||||
if(index >= (int)pboIds.size()) {
|
if(index >= (int)pboIds.size()) {
|
||||||
char szBuf[8096]="";
|
char szBuf[8096]="";
|
||||||
@@ -1821,12 +1823,14 @@ Pixmap2D *PixelBufferWrapper::getPixelBufferFor(int x,int y,int w,int h, int col
|
|||||||
SystemFlags::OutputDebug(SystemFlags::debugError,"%s",szBuf);
|
SystemFlags::OutputDebug(SystemFlags::debugError,"%s",szBuf);
|
||||||
|
|
||||||
codeSection = "C";
|
codeSection = "C";
|
||||||
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] ",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
addBuffersToPixelBuf((index - pboIds.size()) + 1);
|
addBuffersToPixelBuf((index - pboIds.size()) + 1);
|
||||||
}
|
}
|
||||||
// pbo index used for next frame
|
// pbo index used for next frame
|
||||||
//int nextIndex = (index + 1) % 2;
|
//int nextIndex = (index + 1) % 2;
|
||||||
|
|
||||||
codeSection = "D";
|
codeSection = "D";
|
||||||
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] ",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
// read framebuffer ///////////////////////////////
|
// read framebuffer ///////////////////////////////
|
||||||
// copy pixels from framebuffer to PBO
|
// copy pixels from framebuffer to PBO
|
||||||
// Use offset instead of pointer.
|
// Use offset instead of pointer.
|
||||||
@@ -1835,6 +1839,7 @@ Pixmap2D *PixelBufferWrapper::getPixelBufferFor(int x,int y,int w,int h, int col
|
|||||||
//glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pboIds[nextIndex]);
|
//glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pboIds[nextIndex]);
|
||||||
|
|
||||||
codeSection = "E";
|
codeSection = "E";
|
||||||
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] ",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
//glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
//glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||||
glReadPixels(x, y, w, h, GL_RGBA, GL_UNSIGNED_BYTE, 0);
|
glReadPixels(x, y, w, h, GL_RGBA, GL_UNSIGNED_BYTE, 0);
|
||||||
//glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
//glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
@@ -1847,24 +1852,30 @@ Pixmap2D *PixelBufferWrapper::getPixelBufferFor(int x,int y,int w,int h, int col
|
|||||||
//t1.start();
|
//t1.start();
|
||||||
|
|
||||||
codeSection = "F";
|
codeSection = "F";
|
||||||
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] ",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
// map the PBO that contain framebuffer pixels before processing it
|
// map the PBO that contain framebuffer pixels before processing it
|
||||||
//glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pboIds[nextIndex]);
|
//glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pboIds[nextIndex]);
|
||||||
glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pboIds[index]);
|
glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pboIds[index]);
|
||||||
|
|
||||||
codeSection = "G";
|
codeSection = "G";
|
||||||
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] ",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
GLubyte* src = (GLubyte*)glMapBufferARB(GL_PIXEL_PACK_BUFFER_ARB, GL_READ_ONLY_ARB);
|
GLubyte* src = (GLubyte*)glMapBufferARB(GL_PIXEL_PACK_BUFFER_ARB, GL_READ_ONLY_ARB);
|
||||||
if(src) {
|
if(src) {
|
||||||
codeSection = "H";
|
codeSection = "H";
|
||||||
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] ",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
pixmapScreenShot = new Pixmap2D(w, h, colorComponents);
|
pixmapScreenShot = new Pixmap2D(w, h, colorComponents);
|
||||||
|
|
||||||
codeSection = "I";
|
codeSection = "I";
|
||||||
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] ",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
memcpy(pixmapScreenShot->getPixels(),src,pixmapScreenShot->getPixelByteCount());
|
memcpy(pixmapScreenShot->getPixels(),src,pixmapScreenShot->getPixelByteCount());
|
||||||
|
|
||||||
codeSection = "J";
|
codeSection = "J";
|
||||||
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] ",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
glUnmapBufferARB(GL_PIXEL_PACK_BUFFER_ARB); // release pointer to the mapped buffer
|
glUnmapBufferARB(GL_PIXEL_PACK_BUFFER_ARB); // release pointer to the mapped buffer
|
||||||
//pixmapScreenShot->save("debugPBO.png");
|
//pixmapScreenShot->save("debugPBO.png");
|
||||||
}
|
}
|
||||||
codeSection = "K";
|
codeSection = "K";
|
||||||
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] ",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
// measure the time reading framebuffer
|
// measure the time reading framebuffer
|
||||||
//t1.stop();
|
//t1.stop();
|
||||||
//processTime = t1.getElapsedTimeInMilliSec();
|
//processTime = t1.getElapsedTimeInMilliSec();
|
||||||
|
Reference in New Issue
Block a user