Fixed snapshot floater failing to render overlay texture when full-screen preview is enabled

Enabled bulk glReadPixels for snapshots if target-resolution matches render-resolution
Snapshot thumbnail generated from downscaled render image, instead of requring an extra pass.
This commit is contained in:
Shyotl
2011-02-16 18:19:22 -06:00
parent 257a971fcd
commit 456bec3e83
3 changed files with 17 additions and 5 deletions

View File

@@ -428,7 +428,8 @@ void LLPostProcess::doEffects(void)
/// Clear the frame buffer.
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
LLGLDisable(GL_DEPTH_TEST);
/// Change to an orthogonal view
viewOrthogonal(screenW, screenH);

View File

@@ -243,6 +243,7 @@ LLSnapshotLivePreview::LLSnapshotLivePreview (const LLRect& rect) :
mKeepAspectRatio = gSavedSettings.getBOOL("KeepAspectForSnapshot") ;
mThumbnailUpdateLock = FALSE ;
mThumbnailUpToDate = FALSE ;
updateSnapshot(TRUE,TRUE); //To initialize mImageRect to correct values
}
LLSnapshotLivePreview::~LLSnapshotLivePreview()
@@ -880,7 +881,17 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview )
curr_preview_image->setAddressMode(LLTexUnit::TAM_CLAMP);
previewp->mSnapshotUpToDate = TRUE;
previewp->generateThumbnailImage(TRUE) ;
//Resize to thumbnail.
{
previewp->mThumbnailUpToDate = TRUE ;
previewp->mThumbnailUpdateLock = TRUE ;
S32 w = get_lower_power_two(scaled->getWidth(), 512) * 2 ;
S32 h = get_lower_power_two(scaled->getHeight(), 512) * 2 ;
scaled->scale(w,h);
previewp->mThumbnailImage = new LLImageGL(scaled, FALSE);
previewp->mThumbnailUpdateLock = FALSE ;
previewp->setThumbnailImageSize();
}
previewp->mPosTakenGlobal = gAgent.getCameraPositionGlobal();
previewp->mShineCountdown = 4; // wait a few frames to avoid animation glitch due to readback this frame
@@ -1236,7 +1247,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)
{
std::string fee = gHippoGridManager->getConnectedGrid()->getUploadFee();
floater->childSetLabelArg("upload_btn", "[UPLOADFEE]", fee);
LLRadioGroup* snapshot_type_radio = floater->getChild<LLRadioGroup>("snapshot_type_radio");
snapshot_type_radio->setSelectedIndex(gSavedSettings.getS32("LastSnapshotType"));
LLSnapshotLivePreview::ESnapshotType shot_type = getTypeIndex(floater);

View File

@@ -4422,8 +4422,8 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
render_ui(scale_factor, subfield);
}
#if SHY_MOD // screenshot improvement
if(scale_factor <= 1.f) //faster. bulk copy opposed to line per line
#if 1//SHY_MOD // screenshot improvement
if(scale_factor <= 1.f && image_width == image_buffer_x && image_height == image_buffer_y) //faster. bulk copy opposed to line per line
{
if (type == SNAPSHOT_TYPE_OBJECT_ID || type == SNAPSHOT_TYPE_COLOR)
{