Fixed a critical bug, the pixel pack alignment wasn't assigned and produced crashes with non pow of 2 textures.

Fixed TakeScreenshot, now ensures the rendering from the global batch renderer before capturing the front buffer.
This commit is contained in:
spartanj
2011-02-26 19:02:11 -03:00
parent 66ae0fef0f
commit 252bb4eca6
3 changed files with 16 additions and 8 deletions

View File

@@ -222,10 +222,13 @@ void cTextureLoader::LoadFromPixels() {
glBindTexture(GL_TEXTURE_2D, PreviousTexture);
if ( tTexId ) {
if ( mIsDDS && mIsDDSCompressed && mSize > 128 )
if ( mIsDDS && mIsDDSCompressed && mSize > 128 ) {
mSize -= 128; // Remove the header size
else
mSize = mWidth * mHeight * mChannels;
} else {
mWidth = width;
mHeight = height;
mSize = mWidth * mHeight * mChannels;
}
mTexId = cTextureFactory::instance()->PushTexture( mFilepath, tTexId, mImgWidth, mImgHeight, width, height, mMipmap, mChannels, mClampMode, mCompressTexture || mIsDDSCompressed, mLocalCopy, mSize );

View File

@@ -1026,11 +1026,11 @@ void cEETest::LoadTextures() {
Cursor[1] = TF->LoadFromPack( &PAK, "cursor.tga" );
CursorP[1] = TF->GetTexture( Cursor[1] );
//cCursorManager * CurMan = mWindow->GetCursorManager();
//CurMan->Visible( false );
//CurMan->Visible( true );
cCursorManager * CurMan = mWindow->GetCursorManager();
CurMan->Visible( false );
//CurMan->Visible( true );
//CurMan->Set( Window::Cursor::SYS_CURSOR_DEFAULT );
//CurMan->Set( CurMan->Add( CurMan->Create( MyPath + "data/cursor.tga", eeVector2i( 2, 2 ), "cursor_special" ) ) );
//CurMan->Set( CurMan->Add( CurMan->Create( CursorP[1], eeVector2i( 2, 2 ), "cursor_special" ) ) );
CL1.AddFrame(TN[2]);
CL1.Position( 500, 400 );
@@ -1666,7 +1666,7 @@ void cEETest::Process() {
else
mFontLoader.Update();
if ( KM->IsKeyUp(KEY_F12) ) mWindow->TakeScreenshot( MyPath + "data/screenshots/" ); //After render and before Display
if ( KM->IsKeyUp(KEY_F12) ) mWindow->TakeScreenshot( MyPath + "data/screenshots/" ); //After render and before Display
mWindow->Display();
} while( mWindow->Running() );

View File

@@ -88,6 +88,9 @@ void cWindow::CreateView() {
}
void cWindow::Setup2D( const bool& KeepView ) {
glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
glPixelStorei( GL_PACK_ALIGNMENT, 1 );
BackColor( mWindow.BackgroundColor );
GLi->LineSmooth();
@@ -127,6 +130,8 @@ const eeColor& cWindow::BackColor() const {
}
bool cWindow::TakeScreenshot( std::string filepath, const EE_SAVE_TYPE& Format ) {
cGlobalBatchRenderer::instance()->Draw();
bool CreateNewFile = false;
std::string File, Ext;