Added BeginFrame/EndFrame to IGraphicsApi.

This commit is contained in:
UnknownShadow200 2015-06-05 17:52:45 +10:00
parent bdd41a8f24
commit e395eae957
4 changed files with 22 additions and 1 deletions

View File

@ -179,6 +179,7 @@ namespace ClassicalSharp {
double ticksAccumulator = 0, imageCheckAccumulator = 0;
protected override void OnRenderFrame( FrameEventArgs e ) {
Graphics.BeginFrame( this );
accumulator += e.Time;
imageCheckAccumulator += e.Time;
ticksAccumulator += e.Time;
@ -253,7 +254,7 @@ namespace ClassicalSharp {
Graphics.TakeScreenshot( path, ClientSize );
screenshotRequested = false;
}
SwapBuffers();
Graphics.EndFrame( this );
}
void RenderPlayers( double deltaTime, float t ) {

View File

@ -386,6 +386,15 @@ namespace ClassicalSharp.GraphicsAPI {
#endregion
public override void BeginFrame( Game game ) {
device.BeginScene();
}
public override void EndFrame( Game game ) {
device.EndScene();
device.Present();
}
public override void OnWindowResize( int newWidth, int newHeight ) {
throw new NotSupportedException();
}

View File

@ -191,6 +191,10 @@ namespace ClassicalSharp.GraphicsAPI {
public virtual void PrintApiSpecificInfo() {
}
public abstract void BeginFrame( Game game );
public abstract void EndFrame( Game game );
public abstract void OnWindowResize( int newWidth, int newHeight );
protected void InitDynamicBuffers() {

View File

@ -432,6 +432,13 @@ namespace ClassicalSharp.GraphicsAPI {
}
#endif
public override void BeginFrame( Game game ) {
}
public override void EndFrame( Game game ) {
game.SwapBuffers();
}
public override void PrintApiSpecificInfo() {
Console.WriteLine( "OpenGL vendor: " + GL.GetString( StringName.Vendor ) );
Console.WriteLine( "OpenGL renderer: " + GL.GetString( StringName.Renderer ) );