Show flip.cpp syntax highlighted
/***************************************************************************
flip.cpp - Flip buffers
-------------------
begin : Tue Apr 1 2003
copyright : (C) 2003 by Reality Rift Studios
email : mattias@realityrift.com
***************************************************************************
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is the NeoEngine, NeoDevOpenGL, flip.cpp
The Initial Developer of the Original Code is Mattias Jansson.
Portions created by Mattias Jansson are Copyright (C) 2003
Reality Rift Studios. All Rights Reserved.
***************************************************************************/
#define NEEDGDI
#include "device.h"
#include "rendertarget.h"
#include "framebuffertarget.h"
#include "textureunit.h"
#include <neoengine/logstream.h>
using namespace std;
using namespace NeoEngine;
namespace NeoOGL
{
void Device::Flip()
{
//Flip current target
m_pkCurTarget->Flip();
//Set flag to reset statistics on next begin
if( m_pkCurTarget->GetID() == FRAMEBUFFER )
m_bResetStats = true;
}
void RenderTarget::Flip()
{
for( unsigned int uiLayer = 0; uiLayer < m_pkDevice->m_uiNumTMUs; ++uiLayer )
if( !m_pkDevice->m_ppkTMU[ uiLayer ]->Disable() )
break;
}
void FrameBufferRenderTarget::Flip()
{
RenderTarget::Flip();
#ifdef WIN32
if( m_hDC )
SwapBuffers( m_hDC );
#elif __APPLE__
if( m_cglContext )
CGLFlushDrawable( m_cglContext );
else if( m_aglContext )
aglSwapBuffers( m_aglContext );
#elif POSIX
if( m_pkDevice->m_kWindow.m_pDisplay )
glXSwapBuffers( (Display*)m_pkDevice->m_kWindow.m_pDisplay, (Window)m_pkDevice->m_kWindow.m_Window );
else
neolog << LogLevel( WARNING ) << "[Device::Flip] no display" << endl;
#else
# error "Platform not implemented"
#endif
}
}; // namespace NeoOGL
See more files for this project here