Changeset - r24921:81caabd813bc
[Not reviewed]
master
0 2 0
Michael Lutz - 3 years ago 2021-02-21 21:17:11
michi@icosahedron.de
Codechange: [OpenGL] Separate context state setup from general init.
2 files changed with 10 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/video/opengl.cpp
Show inline comments
 
@@ -621,14 +621,19 @@ const char *OpenGLBackend::Init()
 
	/* Create resources for sprite rendering. */
 
	if (!OpenGLSprite::Create()) return "Failed to create sprite rendering resources";
 

	
 
	this->PrepareContext();
 
	(void)glGetError(); // Clear errors.
 

	
 
	return nullptr;
 
}
 

	
 
void OpenGLBackend::PrepareContext()
 
{
 
	glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
 
	glDisable(GL_DEPTH_TEST);
 
	/* Enable alpha blending using the src alpha factor. */
 
	glEnable(GL_BLEND);
 
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 
	(void)glGetError(); // Clear errors.
 

	
 
	return nullptr;
 
}
 

	
 
/**
src/video/opengl.h
Show inline comments
 
@@ -73,6 +73,8 @@ public:
 
	static const char *Create(GetOGLProcAddressProc get_proc);
 
	static void Destroy();
 

	
 
	void PrepareContext();
 

	
 
	void UpdatePalette(const Colour *pal, uint first, uint length);
 
	bool Resize(int w, int h, bool force = false);
 
	void Paint();
0 comments (0 inline, 0 general)