little fixes

This commit is contained in:
aap 2020-08-10 13:35:50 +02:00
parent b1507e5099
commit e21cf250a2

View File

@ -68,7 +68,7 @@ rasterCreateTexture(Raster *raster)
raster->stride = raster->width*natras->bpp; raster->stride = raster->width*natras->bpp;
glGenTextures(1, &natras->texid); glGenTextures(1, &natras->texid);
glBindTexture(GL_TEXTURE_2D, natras->texid); uint32 prev = bindTexture(natras->texid);
glTexImage2D(GL_TEXTURE_2D, 0, natras->internalFormat, glTexImage2D(GL_TEXTURE_2D, 0, natras->internalFormat,
raster->width, raster->height, raster->width, raster->height,
0, natras->format, natras->type, nil); 0, natras->format, natras->type, nil);
@ -76,7 +76,7 @@ rasterCreateTexture(Raster *raster)
natras->addressU = 0; natras->addressU = 0;
natras->addressV = 0; natras->addressV = 0;
glBindTexture(GL_TEXTURE_2D, 0); bindTexture(prev);
return raster; return raster;
} }
@ -126,7 +126,7 @@ rasterCreateCameraTexture(Raster *raster)
raster->stride = raster->width*natras->bpp; raster->stride = raster->width*natras->bpp;
glGenTextures(1, &natras->texid); glGenTextures(1, &natras->texid);
glBindTexture(GL_TEXTURE_2D, natras->texid); uint32 prev = bindTexture(natras->texid);
glTexImage2D(GL_TEXTURE_2D, 0, natras->internalFormat, glTexImage2D(GL_TEXTURE_2D, 0, natras->internalFormat,
raster->width, raster->height, raster->width, raster->height,
0, natras->format, natras->type, nil); 0, natras->format, natras->type, nil);
@ -134,7 +134,7 @@ rasterCreateCameraTexture(Raster *raster)
natras->addressU = 0; natras->addressU = 0;
natras->addressV = 0; natras->addressV = 0;
glBindTexture(GL_TEXTURE_2D, 0); bindTexture(prev);
glGenFramebuffers(1, &natras->fbo); glGenFramebuffers(1, &natras->fbo);
@ -180,7 +180,7 @@ rasterCreateZbuffer(Raster *raster)
natras->type = GL_UNSIGNED_BYTE; natras->type = GL_UNSIGNED_BYTE;
glGenTextures(1, &natras->texid); glGenTextures(1, &natras->texid);
glBindTexture(GL_TEXTURE_2D, natras->texid); uint32 prev = bindTexture(natras->texid);
glTexImage2D(GL_TEXTURE_2D, 0, natras->internalFormat, glTexImage2D(GL_TEXTURE_2D, 0, natras->internalFormat,
raster->width, raster->height, raster->width, raster->height,
0, natras->format, natras->type, nil); 0, natras->format, natras->type, nil);
@ -188,7 +188,7 @@ rasterCreateZbuffer(Raster *raster)
natras->addressU = 0; natras->addressU = 0;
natras->addressV = 0; natras->addressV = 0;
glBindTexture(GL_TEXTURE_2D, 0); bindTexture(prev);
natras->fbo = 0; natras->fbo = 0;
natras->fboMate = nil; natras->fboMate = nil;