Bugfixes
Started by: Anonymous (82.83.73.x)
On: 1226855982|%e %b %Y, %H:%M %Z|agohover
Number of posts: 2
rss icon RSS: New posts
Summary:
fixed some errors regarding textures
Bugfixes
Anonymous (82.83.73.x) 1226855982|%e %b %Y, %H:%M %Z|agohover

First thanks for providing this binding for openGL ;)

However I found it troublesome to use this lib due to weird crashes. I finally found the glitch which is located in get_array2f. The function is not balancing the lua VM stack. I fixed the loop that caused a stackoverflow that lead to a crash somewhat later (thus hard to track down the error).

for(i = 0; i < n; i++)
   {
      lua_rawgeti(L, index, i+1);

      if(!lua_istable(L, -1)) {
        lua_pop(L,1); // undo the change to the stack, normally not necessary
         return -1;
      }

      for(j = 0; j < *size; j++)
      {
         lua_rawgeti(L, -1, j + 1);

         (*array)[i*(*size) + j] = (GLfloat)lua_tonumber(L, -1);

         lua_pop(L, 1); // lua_remove(L,-1) equivalent
      }
      lua_pop(L,1); // pop the row off
   }

I also saw during examination that there is a memory leak in the texture function gl_tex_image.
The function returned without freeing the pixels array, i.e.

if((height = get_array2f(L, 4, &pixels, &width)) != -1)
   {
      glTexImage2D(GL_TEXTURE_2D, (GLint)lua_tonumber(L, 1),
                   iformat, width/iformat, height, 0, e, GL_FLOAT, pixels);
        free(pixels); // I added this line
      return 0;
   }

In other places existed the same glitch.

—zet

unfold Bugfixes by Anonymous (82.83.73.x), 1226855982|%e %b %Y, %H:%M %Z|agohover
Re: Bugfixes
George PetsagourakisGeorge Petsagourakis 1228683270|%e %b %Y, %H:%M %Z|agohover

Questions: which source branch? compiler/platform?

In the case that you are on Windows XP, can you sent me the binaries you produced?

unfold Re: Bugfixes by George PetsagourakisGeorge Petsagourakis, 1228683270|%e %b %Y, %H:%M %Z|agohover
New post
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.