Skip to content

Commit f784f62

Browse files
committed
🐛 Fixed generate mips opengl
1 parent d650c92 commit f784f62

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

Plugin/PluginInteropUnityCUDA/src/Texture/texture_OpenGLCoreES.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Texture_OpenGLCoreES::~Texture_OpenGLCoreES()
1616
CUDA_CHECK(cudaGetLastError());
1717
};
1818

19-
2019
int Texture_OpenGLCoreES::registerTextureInCUDA()
2120
{
2221
// if depth is < 2 it's a texture2D, else it's a texture2DArray
@@ -40,19 +39,27 @@ int Texture_OpenGLCoreES::unregisterTextureInCUDA()
4039

4140
int Texture_OpenGLCoreES::copyUnityTextureToAPITexture()
4241
{
43-
Log::log().debugLogError("copyUnityTextureToAPITexture - Not implemented yet");
42+
Log::log().debugLogError(
43+
"copyUnityTextureToAPITexture - Not implemented yet");
4444
return -1;
4545
}
4646

4747
int Texture_OpenGLCoreES::copyAPITextureToUnityTexture()
4848
{
49-
Log::log().debugLogError("copyAPITextureToUnityTexture - Not implemented yet");
49+
Log::log().debugLogError(
50+
"copyAPITextureToUnityTexture - Not implemented yet");
5051
return -1;
5152
}
5253

5354
int Texture_OpenGLCoreES::generateMips()
5455
{
55-
glGenerateMipmap(_texUnityGL);
56+
// bind the texture
57+
glBindTexture(_texTarget, _texUnityGL);
58+
GL_CHECK();
59+
glGenerateMipmap(_texTarget);
60+
GL_CHECK();
61+
// unbind the texture
62+
glBindTexture(_texTarget, 0);
5663
GL_CHECK();
5764
return SUCCESS_INTEROP_CODE;
5865
}

Plugin/SampleBasic/src/action_sample_texture.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ int ActionSampleTexture::Update()
3030
_texture->getSurfaceObject(), GetTime(),
3131
_texture->getWidth(), _texture->getHeight());
3232
cudaDeviceSynchronize();
33-
// GRUMBLE(_texture->generateMips(),
34-
// "There has been an error during the mip map generation."
35-
// "Abord ActionSampleTexture !");
3633
GRUMBLE(CUDA_CHECK(cudaGetLastError()),
3734
"There has been an error during the update. "
3835
"Abort ActionSampleTexture !");

0 commit comments

Comments
 (0)