mirror of
https://github.com/isledecomp/isle-portable.git
synced 2025-09-20 10:07:32 -04:00
Fix debug mode when OpenGL is set as graphics device (#615)
This commit is contained in:
parent
84bd0a1a87
commit
bf3820c054
@ -175,6 +175,7 @@ static Uint32 UploadTextureData(SDL_Surface* src, bool useNPOT, bool isUI, float
|
||||
|
||||
Uint32 OpenGL1Renderer::GetTextureId(IDirect3DRMTexture* iTexture, bool isUI, float scaleX, float scaleY)
|
||||
{
|
||||
SDL_GL_MakeCurrent(DDWindow, m_context);
|
||||
auto texture = static_cast<Direct3DRMTextureImpl*>(iTexture);
|
||||
auto surface = static_cast<DirectDrawSurfaceImpl*>(texture->m_surface);
|
||||
|
||||
@ -314,6 +315,7 @@ Uint32 OpenGL1Renderer::GetMeshId(IDirect3DRMMesh* mesh, const MeshGroup* meshGr
|
||||
|
||||
HRESULT OpenGL1Renderer::BeginFrame()
|
||||
{
|
||||
SDL_GL_MakeCurrent(DDWindow, m_context);
|
||||
GL11_BeginFrame((Matrix4x4*) &m_projection[0][0]);
|
||||
|
||||
int lightIdx = 0;
|
||||
@ -361,6 +363,7 @@ HRESULT OpenGL1Renderer::FinalizeFrame()
|
||||
|
||||
void OpenGL1Renderer::Resize(int width, int height, const ViewportTransform& viewportTransform)
|
||||
{
|
||||
SDL_GL_MakeCurrent(DDWindow, m_context);
|
||||
m_width = width;
|
||||
m_height = height;
|
||||
m_viewportTransform = viewportTransform;
|
||||
@ -371,12 +374,14 @@ void OpenGL1Renderer::Resize(int width, int height, const ViewportTransform& vie
|
||||
|
||||
void OpenGL1Renderer::Clear(float r, float g, float b)
|
||||
{
|
||||
SDL_GL_MakeCurrent(DDWindow, m_context);
|
||||
m_dirty = true;
|
||||
GL11_Clear(r, g, b);
|
||||
}
|
||||
|
||||
void OpenGL1Renderer::Flip()
|
||||
{
|
||||
SDL_GL_MakeCurrent(DDWindow, m_context);
|
||||
if (m_dirty) {
|
||||
SDL_GL_SwapWindow(DDWindow);
|
||||
m_dirty = false;
|
||||
@ -385,6 +390,7 @@ void OpenGL1Renderer::Flip()
|
||||
|
||||
void OpenGL1Renderer::Draw2DImage(Uint32 textureId, const SDL_Rect& srcRect, const SDL_Rect& dstRect, FColor color)
|
||||
{
|
||||
SDL_GL_MakeCurrent(DDWindow, m_context);
|
||||
m_dirty = true;
|
||||
|
||||
float left = -m_viewportTransform.offsetX / m_viewportTransform.scale;
|
||||
|
@ -390,6 +390,7 @@ void OpenGLES2Renderer::AddTextureDestroyCallback(Uint32 id, IDirect3DRMTexture*
|
||||
|
||||
Uint32 OpenGLES2Renderer::GetTextureId(IDirect3DRMTexture* iTexture, bool isUI, float scaleX, float scaleY)
|
||||
{
|
||||
SDL_GL_MakeCurrent(DDWindow, m_context);
|
||||
auto texture = static_cast<Direct3DRMTextureImpl*>(iTexture);
|
||||
auto surface = static_cast<DirectDrawSurfaceImpl*>(texture->m_surface);
|
||||
|
||||
@ -484,6 +485,7 @@ Uint32 OpenGLES2Renderer::GetMeshId(IDirect3DRMMesh* mesh, const MeshGroup* mesh
|
||||
|
||||
HRESULT OpenGLES2Renderer::BeginFrame()
|
||||
{
|
||||
SDL_GL_MakeCurrent(DDWindow, m_context);
|
||||
m_dirty = true;
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
|
||||
@ -599,6 +601,7 @@ HRESULT OpenGLES2Renderer::FinalizeFrame()
|
||||
|
||||
void OpenGLES2Renderer::Resize(int width, int height, const ViewportTransform& viewportTransform)
|
||||
{
|
||||
SDL_GL_MakeCurrent(DDWindow, m_context);
|
||||
m_width = width;
|
||||
m_height = height;
|
||||
m_viewportTransform = viewportTransform;
|
||||
@ -639,6 +642,7 @@ void OpenGLES2Renderer::Resize(int width, int height, const ViewportTransform& v
|
||||
|
||||
void OpenGLES2Renderer::Clear(float r, float g, float b)
|
||||
{
|
||||
SDL_GL_MakeCurrent(DDWindow, m_context);
|
||||
m_dirty = true;
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
|
||||
@ -651,6 +655,7 @@ void OpenGLES2Renderer::Clear(float r, float g, float b)
|
||||
|
||||
void OpenGLES2Renderer::Flip()
|
||||
{
|
||||
SDL_GL_MakeCurrent(DDWindow, m_context);
|
||||
if (!m_dirty) {
|
||||
return;
|
||||
}
|
||||
@ -714,6 +719,7 @@ void OpenGLES2Renderer::Flip()
|
||||
|
||||
void OpenGLES2Renderer::Draw2DImage(Uint32 textureId, const SDL_Rect& srcRect, const SDL_Rect& dstRect, FColor color)
|
||||
{
|
||||
SDL_GL_MakeCurrent(DDWindow, m_context);
|
||||
m_dirty = true;
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
|
||||
|
Loading…
x
Reference in New Issue
Block a user