|
Hello everyone, I’ve recently updated my system to OSG 1.1 and I
encountered a new problem with textures. I’m trying to include a simple 3DS
model in the scene with a JPG texture image on the surface. On runtime, the
application crashes in the function Texture::applyTexImage2D_load() in the file
Texture.cpp. More precisely, the access violation occurs in this part of the
code while calling glTexImage2D() : if( _min_filter == LINEAR || _min_filter == NEAREST ||
useHardwareMipMapGeneration) { bool
hardwareMipMapOn = false; if (_min_filter
!= LINEAR && _min_filter != NEAREST) {
if (useHardwareMipMapGeneration) glTexParameteri(GL_TEXTURE_2D,
GL_GENERATE_MIPMAP_SGIS,GL_TRUE);
hardwareMipMapOn = true; } if (
!compressed_image) {
numMipmapLevels = 1;
glTexImage2D( target, 0, _internalFormat, ß
MEMORY ACCESS VIOLATION OCCURS HERE
inwidth, inheight, _borderWidth,
(GLenum)image->getPixelFormat(),
(GLenum)image->getDataType(),
data -dataMinusOffset+dataPlusOffset); } else if
(extensions->isCompressedTexImage2DSupported()) {
numMipmapLevels = 1;
GLint blockSize, size;
getCompressedSize(_internalFormat, inwidth, inheight, 1, blockSize,size);
extensions->glCompressedTexImage2D(target, 0, _internalFormat,
inwidth, inheight,0,
size,
data-dataMinusOffset+dataPlusOffset);
} if
(hardwareMipMapOn) glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS,GL_FALSE); } ,,, The image and data pointers seem to be ok (they’re
pointing to something and _pixelFormat and _dataType contain values 6407 and
5121 respectively in image pointer)… However, I suspect a problem with
dataMinusOffset and dataPlusOffset. Both of them are NULL because they are
never set. The image pointer has no PixelBufferObject and both dataMinusOffset
and dataPlusOffset remains unset in this part of the code : unsigned char* dataMinusOffset = 0; unsigned char* dataPlusOffset = 0; const PixelBufferObject* pbo =
image->getPixelBufferObject(); if (pbo &&
pbo->isBufferObjectSupported(contextID) && !needImageRescale) {
pbo->compileBuffer(state);
pbo->bindBuffer(contextID); dataMinusOffset =
data; dataPlusOffset =
reinterpret_cast<unsigned char*>(pbo->offset()); #ifdef DO_TIMING osg::notify(osg::NOTICE)<<"after
PBO
"<<osg::Timer::instance()->delta_m(start_tick,osg::Timer::instance()->tick())<<"ms"<<std::endl; #endif } else { pbo = 0; } Maybe there is something more to do with the new version
when loading a 3DS model with JPG texture but I don’t have a clue… I
didn’t try with another image format but I think it will do the same thing.
Anybody can help me ? Is that a bug ? Thanks ! Frédéric Drolet |
_______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
