mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator
synced 2025-05-23 21:57:40 +08:00
Wine + Enscripten fixes for OpenGL_Hook.cpp.
This commit is contained in:
parent
2164ff292c
commit
77d2a84af8
@ -163,11 +163,6 @@ std::weak_ptr<uint64_t> OpenGL_Hook::CreateImageResource(const void* image_data,
|
|||||||
{
|
{
|
||||||
GLuint* texture = new GLuint(0);
|
GLuint* texture = new GLuint(0);
|
||||||
glGenTextures(1, texture);
|
glGenTextures(1, texture);
|
||||||
if (glGetError() != GL_NO_ERROR)
|
|
||||||
{
|
|
||||||
delete texture;
|
|
||||||
return std::shared_ptr<uint64_t>(nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save old texture id
|
// Save old texture id
|
||||||
GLint oldTex;
|
GLint 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_MIN_FILTER, GL_LINEAR);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_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
|
// Upload pixels into texture
|
||||||
|
#if defined(GL_UNPACK_ROW_LENGTH) && !defined(__EMSCRIPTEN__)
|
||||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, image_data);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, image_data);
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, oldTex);
|
glBindTexture(GL_TEXTURE_2D, oldTex);
|
||||||
|
glFlush();
|
||||||
auto ptr = std::shared_ptr<uint64_t>((uint64_t*)texture, [](uint64_t* handle)
|
auto ptr = std::shared_ptr<uint64_t>((uint64_t*)texture, [](uint64_t* handle)
|
||||||
{
|
{
|
||||||
if (handle != nullptr)
|
if (handle != nullptr)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user