Browse Source

Another reset pixel storage settings after load texture.

shared-context
Doug Binks 11 years ago
parent
commit
5d8e63c81c
1 changed files with 13 additions and 0 deletions
  1. +13
    -0
      src/nanovg_gl3buf.h

+ 13
- 0
src/nanovg_gl3buf.h View File

@@ -447,6 +447,8 @@ static int glnvg__renderCreateTexture(void* uptr, int type, int w, int h, const
{
struct GLNVGcontext* gl = (struct GLNVGcontext*)uptr;
struct GLNVGtexture* tex = glnvg__allocTexture(gl);
int align,length,pixels,rows;

if (tex == NULL) return 0;
glGenTextures(1, &tex->tex);
tex->width = w;
@@ -454,6 +456,11 @@ static int glnvg__renderCreateTexture(void* uptr, int type, int w, int h, const
tex->type = type;
glBindTexture(GL_TEXTURE_2D, tex->tex);

glGetIntegerv(GL_UNPACK_ALIGNMENT,&align);
glGetIntegerv(GL_UNPACK_ROW_LENGTH,&length);
glGetIntegerv(GL_UNPACK_SKIP_PIXELS,&pixels);
glGetIntegerv(GL_UNPACK_SKIP_ROWS,&rows);

glPixelStorei(GL_UNPACK_ALIGNMENT,1);
glPixelStorei(GL_UNPACK_ROW_LENGTH, tex->width);
glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
@@ -471,12 +478,18 @@ static int glnvg__renderCreateTexture(void* uptr, int type, int w, int h, const
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

glPixelStorei(GL_UNPACK_ALIGNMENT,align);
glPixelStorei(GL_UNPACK_ROW_LENGTH,length);
glPixelStorei(GL_UNPACK_SKIP_PIXELS,pixels);
glPixelStorei(GL_UNPACK_SKIP_ROWS,rows);

if (glnvg__checkError("create tex"))
return 0;

return tex->id;
}


static int glnvg__renderDeleteTexture(void* uptr, int image)
{
struct GLNVGcontext* gl = (struct GLNVGcontext*)uptr;


Loading…
Cancel
Save