Changeset 10600 for OpenSceneGraph/trunk/src/osg/TextureRectangle.cpp
- Timestamp:
- 10/01/09 22:19:42 (4 years ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/src/osg/TextureRectangle.cpp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osg/TextureRectangle.cpp
r10596 r10600 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 2 2 * 3 3 * This library is open source and may be redistributed and/or modified under … … 291 291 } 292 292 293 unsigned char* dataMinusOffset = 0; 294 unsigned char* dataPlusOffset = 0; 295 296 const PixelBufferObject* pbo = image->getPixelBufferObject(); 297 if (pbo && pbo->isPBOSupported(contextID)) 293 const unsigned char* dataPtr = image->data(); 294 GLBufferObject* pbo = image->getOrCreateGLBufferObject(contextID); 295 if (pbo) 298 296 { 299 297 state.bindPixelBufferObject(pbo); 300 dataMinusOffset = image->data(); 301 dataPlusOffset = reinterpret_cast<unsigned char*>(pbo->offset()); 302 } 303 else 304 { 305 pbo = 0; 298 dataPtr = reinterpret_cast<unsigned char*>(pbo->getOffset(image->getBufferIndex())); 306 299 } 307 300 … … 311 304 image->s(), image->t(), 0, 312 305 image->getImageSizeInBytes(), 313 image->data() - dataMinusOffset + dataPlusOffset);306 dataPtr); 314 307 } 315 308 else … … 319 312 (GLenum)image->getPixelFormat(), 320 313 (GLenum)image->getDataType(), 321 image->data() - dataMinusOffset + dataPlusOffset);314 dataPtr ); 322 315 } 323 316 … … 366 359 #ifdef DO_TIMING 367 360 osg::Timer_t start_tick = osg::Timer::instance()->tick(); 368 osg::notify(osg::NOTICE)<<" glTexSubImage2DpixelFormat = "<<std::hex<<image->getPixelFormat()<<std::dec<<std::endl;361 osg::notify(osg::NOTICE)<<"TextureRectangle::apply pixelFormat = "<<std::hex<<image->getPixelFormat()<<std::dec<<std::endl; 369 362 #endif 370 unsigned char* dataMinusOffset = 0; 371 unsigned char* dataPlusOffset = 0; 372 373 const PixelBufferObject* pbo = image->getPixelBufferObject(); 374 if (pbo && pbo->isPBOSupported(contextID)) 363 const unsigned char* dataPtr = image->data(); 364 GLBufferObject* pbo = image->getOrCreateGLBufferObject(contextID); 365 if (pbo) 375 366 { 376 367 state.bindPixelBufferObject(pbo); 377 dataMinusOffset = image->data(); 378 dataPlusOffset = reinterpret_cast<unsigned char*>(pbo->offset()); // -dataMinusOffset+dataPlusOffset 379 368 dataPtr = reinterpret_cast<unsigned char*>(pbo->getOffset(image->getBufferIndex())); 380 369 #ifdef DO_TIMING 381 370 osg::notify(osg::NOTICE)<<"after PBO "<<osg::Timer::instance()->delta_m(start_tick,osg::Timer::instance()->tick())<<"ms"<<std::endl; 382 371 #endif 383 384 372 } 385 373 else 386 374 { 387 pbo = 0;375 osg::notify(osg::NOTICE)<<" no PixelBufferObject "<<image->getBufferObject()<<", "<<image->getPixelBufferObject()<<" pbo="<<pbo<<std::endl; 388 376 } 389 377 … … 396 384 (GLenum)image->getPixelFormat(), 397 385 (GLenum)image->getDataType(), 398 image->data() - dataMinusOffset + dataPlusOffset);386 dataPtr); 399 387 } 400 388 else … … 405 393 (GLenum)image->getPixelFormat(), 406 394 (GLenum)image->getDataType(), 407 image->data() - dataMinusOffset + dataPlusOffset);395 dataPtr); 408 396 } 409 397 … … 416 404 osg::notify(osg::NOTICE)<<"glTexSubImage2D "<<osg::Timer::instance()->delta_m(start_tick,osg::Timer::instance()->tick())<<"ms"<<std::endl; 417 405 #endif 418 419 406 } 420 407
