You can't just create your own thread and load there resources, because tex_*functions uses OpenGL commands and this commands can be executed only in the main thread where OpenGL context was created. You can load your resources in timer(don't forget to call timer_Reset when resources will be loaded), or in SYS_DRAW(but if you use batch2d_Begin/batch2d_End, you must call batch2d_Flush before loading textures). And if you want to draw something - scr_Flush will help little bit, but don't expect that you will get smooth animation and so on. So, code in your timer can be something like this:
Code:
procedure Timer;
begin
if TimeToLoadResources Then
begin
while Progress < 100 do
begin
// Choose what to load for current Progress state and load it :) Increment Progress.
scr_Clear();
// Draw current percentage/etc.
scr_Flush();
end;
timer_Reset();
end;
end;
Background resource loading in separate threads will be available later. Some work for this was done in ZenGL(as you can remember this topic), but only as an experiment. I have fixed all founded problems, but didn't include the code because of architecture questions and some other things.
Bookmarks