Files
UnrealEngineUWP/Engine/Source/Developer/StandaloneRenderer/Private/Linux/OpenGL/SlateOpenGLViewport.cpp
ryan durand 471d972e62 Updating copyright for Engine Developer.
#rnx
#rb none


#ROBOMERGE-SOURCE: CL 10869240 via CL 10869516 via CL 10869902
#ROBOMERGE-BOT: (v613-10869866)

[CL 10870584 by ryan durand in Main branch]
2019-12-26 15:32:37 -05:00

54 lines
1.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "CoreMinimal.h"
#include "GenericPlatform/GenericWindow.h"
#include "Widgets/SWindow.h"
#include "OpenGL/SlateOpenGLRenderer.h"
FSlateOpenGLViewport::FSlateOpenGLViewport()
: bFullscreen(false)
{
}
void FSlateOpenGLViewport::Initialize( TSharedRef<SWindow> InWindow, const FSlateOpenGLContext& SharedContext )
{
TSharedRef<FGenericWindow> NativeWindow = InWindow->GetNativeWindow().ToSharedRef();
RenderingContext.Initialize(NativeWindow->GetOSWindowHandle(), &SharedContext);
// Create an OpenGL viewport
const int32 Width = FMath::TruncToInt(InWindow->GetSizeInScreen().X);
const int32 Height = FMath::TruncToInt(InWindow->GetSizeInScreen().Y);
ProjectionMatrix = CreateProjectionMatrix( Width, Height );
ViewportRect.Right = Width;
ViewportRect.Bottom = Height;
ViewportRect.Top = 0;
ViewportRect.Left = 0;
}
void FSlateOpenGLViewport::Destroy()
{
RenderingContext.Destroy();
}
void FSlateOpenGLViewport::MakeCurrent()
{
RenderingContext.MakeCurrent();
}
void FSlateOpenGLViewport::SwapBuffers()
{
SDL_GL_SwapWindow( RenderingContext.WindowHandle );
}
void FSlateOpenGLViewport::Resize( int32 Width, int32 Height, bool bInFullscreen )
{
ViewportRect.Right = Width;
ViewportRect.Bottom = Height;
bFullscreen = bInFullscreen;
// Need to create a new projection matrix each time the window is resized
ProjectionMatrix = CreateProjectionMatrix( Width, Height );
}