mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2025-04-15 07:47:37 +02:00
Wine + Enscripten fixes for OpenGL_Hook.cpp.
This commit is contained in:
parent
2164ff292c
commit
77d2a84af8
1 changed files with 7 additions and 8 deletions
|
@ -163,12 +163,7 @@ std::weak_ptr<uint64_t> OpenGL_Hook::CreateImageResource(const void* image_data,
|
|||
{
|
||||
GLuint* texture = new GLuint(0);
|
||||
glGenTextures(1, texture);
|
||||
if (glGetError() != GL_NO_ERROR)
|
||||
{
|
||||
delete texture;
|
||||
return std::shared_ptr<uint64_t>(nullptr);
|
||||
}
|
||||
|
||||
|
||||
// Save old texture id
|
||||
GLint oldTex;
|
||||
glGetIntegerv(GL_TEXTURE_BINDING_2D, &oldTex);
|
||||
|
@ -177,13 +172,17 @@ std::weak_ptr<uint64_t> OpenGL_Hook::CreateImageResource(const void* image_data,
|
|||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
|
||||
// Upload pixels into texture
|
||||
#if defined(GL_UNPACK_ROW_LENGTH) && !defined(__EMSCRIPTEN__)
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
#endif
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, image_data);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, oldTex);
|
||||
|
||||
glFlush();
|
||||
auto ptr = std::shared_ptr<uint64_t>((uint64_t*)texture, [](uint64_t* handle)
|
||||
{
|
||||
if (handle != nullptr)
|
||||
|
|
Loading…
Reference in a new issue