Re: Impossible call 'patch' inside onkeydown handler?
Status: Alpha
Brought to you by:
cwalther
From: Andrea V. <and...@gm...> - 2008-01-31 10:25:07
|
Christian Walther <cwalther <at> gmx.ch> writes: > You can't create patches at run time. What would you need that for? > Would it be very inconvenient to have to reload the node for it? Ok, I understand you, I should find a workaround to this. Well, I'm working on a lua library fot drawing simple 3d object, as explain you before, the big problem is put the patches in the correct geometrical order, So, for the moment I have operate in this manner: I calculate all the parameters to drawing patches of my 3d object (nx,ny,...angley...image...) and put inside a table. During this phase I eliminate backfaces to reduce total number of patches. I reorder the table of the patches from farest to nearest I cycle along the table and draw the patch, To do this, I use another table to store patch id, I reuse patches stored in this table that are always ordered from back to front. If I found a patch in this table, I use it, otherwise I create a new one and I append it to the table for future use. Because the backface removal, the number of patches that I see can vary depending on the angle of view. So if I want to schedulate the rotation of my object, it's possible which, for some angle of view, I need extra patches... Now I have to predetermine the maximum number of patches and allocate all patches before runtime. If I eliminate backfaces removal, the problem never occur, because the number of the faces is always the same. I have tryed (just for test) to enable depth buffer on SDL (before calling SDL_SetVideoMode( width, height, bpp, flags ) using: SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 ); but it's not sufficient, because the behaviour isn't changed..... Bye Andrea |