|
From: Robert M. <rob...@gm...> - 2008-10-02 13:21:29
|
Hi List,
My modification of Rendertexture.cpp screwed up the grayscale mode. To
be able to deal with Grayscale, RGB and single channel, I had to add
this fix to Rendertexture.cpp. (Around line 700):
if(_colorType == GREYSCALE_TYPE)
{
// glCopyTexSubImage2D(_iTextureTarget, 0, 0, 0, 0, 0, _iWidth,
_iHeight);
glCopyTexImage2D(_iTextureTarget, 0, GL_LUMINANCE, 0, 0, _iWidth,
_iHeight, 0);
// // save image in Buffer, for giving back the Pixel-values
pixelBuffer = pBuf;
glGetTexImage(_iTextureTarget, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE,
pBuf);
nrChan = 1;
}
else
{
// glCopyTexSubImage2D(_iTextureTarget, 0, 0, 0, 0, 0, _iWidth,
_iHeight);
glCopyTexImage2D(_iTextureTarget, 0, GL_RGB, 0, 0, _iWidth,
_iHeight, 0);
// save image in Buffer, for giving back the Pixel-values
pixelBuffer = pBuf;
glGetTexImage(_iTextureTarget, 0, GL_RGB, GL_UNSIGNED_BYTE, pBuf);
nrChan = 3; // RGB, RED, BLUE and GREEN modes all use three channels
internally
}
_texels.resize(_bufferSize);
int k=0;
int n=0;
int padding = 0;
if (!((_iWidth*nrChan)%4 == 0))
{
padding = 4 - (_iWidth*nrChan)%4; // #Bytes used to pad each image
row.
}
//cout << endl << endl << "---------------------- iWidth:" << (int)
_iWidth << ". nrChan: " << (int)nrChan << ". Padding: " <<
(int)padding << endl;
for(int rows=0; rows<_iHeight; rows++)
{
for(int cols=0; cols<(_iWidth*nrChan)+padding; cols++)
{
if (cols < _iWidth*nrChan)
{
_texels[k] = (double)pBuf[n];
//cout << " TAKEN, written to " << k+1;
k++;
}
//cout << ". Row: " << (int)rows;
//cout << ". Column Entry: " << (int)cols;
//cout << ". Value: " << (double)pBuf[n] << endl;
n++;
}
}
IN ADDITION you have to reduce the step legth in directedcamera.cpp,
line 175:
for(int i = 0; i< this->_allValues.size(); i++)
Best
Robert
- - - - - - - - - - - - -
Robert Märtin
University of Osnabrück,
Institute of Cognitive Science,
Neurobiopsychology
Room 31/247
Albrechtstr. 28
49069 Osnabrück
Germany
Work: 0541 969 3403
Mobile: 0176 51550153
www.cogsci.uni-osnabrueck.de/~NBP
|