works 100% on both graphics cards (I have stretchable) with this spec:
windows 7 Hp 64 bit
4gb ddr3 ram
ATI 4330HD and GMA 4500MHD
SU4100 @ 1.3ghz
loaded great, and wuite fast. Cpu tops out at around 7-8% with a few megs of ram.
works 100% on both graphics cards (I have stretchable) with this spec:
windows 7 Hp 64 bit
4gb ddr3 ram
ATI 4330HD and GMA 4500MHD
SU4100 @ 1.3ghz
loaded great, and wuite fast. Cpu tops out at around 7-8% with a few megs of ram.
I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.
I was able to make my ImageViewer work with separate thread properly.
Execute doesn't free on exit but it sets Finished variable true. Main application loop checks in its start if Finished is set and then do the Finish; to bind texture and fill the data in with glTexImage2D().
ps. missing pascal tags...Code:TLoadThread = class(TThread) private fn: string; texIndex: integer; finished: boolean; public constructor Create(_texIndex: integer; _fn: string); procedure Execute; override; procedure Finish; end; constructor TLoadThread.Create(_texIndex: integer; _fn: string); begin inherited Create(False); texIndex:=_texIndex; fn:=_fn; finished:=false; FreeOnTerminate:=True; end; procedure TLoadThread.Execute; begin tex.LoadTextureData(@tex.texture[texIndex],fn); if terminated then exit; finished:=true; end; procedure TLoadThread.Finish; begin tex.Restore(texIndex); form1.loader:=nil; form1.MakeDispList; Terminate; end;
Last edited by User137; 07-10-2010 at 09:57 PM.
Yeah, this is one of solution, but this is not so interesting as two independent threads And if I get a fail, I will use this method to load the resources(decoding in separate thread and uploading to videocard in main thread).Originally Posted by User137
Hey guys, sorry been very busy lately. I'm going to be releasing JUI within the next month or so. It has a fully working multi-threaded resource loader, which does have an option for loading data (images, vertex etc) directly into an OpenGL context. But while you can do this, you really shouldn't, it's basically a waste of time. Since the render thread can't switch to back the context until the data has been uploaded, it's a lot simpler and more elegant to load data into system memory first, then copy the data across to the card in the render thread when it's ready. My resource loader is tied in with a generic scene-graph allowing you to do things like a streaming world AKA the Grand Theft Auto Series. A much better area of focus for your multi-threaded musings would be path finding and steering algorithms. Since both of these require simultaneous access to data along with the render thread, it's a lot more challenging and fun to solve
When the moon hits your eye like a big pizza pie - that's an extinction level impact event.
phibermon
There is no fun if it simple, so... I will waste my time with fun firstOriginally Posted by phibermon
Last edited by WILL; 09-10-2010 at 10:05 PM. Reason: General housekeeping. Moved portion of dialog to other thread.
It's not just simpler, it's the only rational solution. You can't load data to the card and render at the same time with OpenGL, at least not with version < 3.2. On higher versions you can use fence sync objects (http://www.opengl.org/registry/doc/g...e.20100725.pdf - section 5.3). With your current method, you may be loading the data in seperate thread, but your main thread will be locking on GL calls until this load is complete and the context is switched back.
Your method will crash a PS3 and most older ATI cards too. Sorry I'm really not trying to be a killjoy but you're quite clearly a good developer and I feel your time would be better spent on learning about fence syncing, it was designed exactly for what you're trying to do.
EDIT : But I do agree, sometimes the best solution isn't the most fun
Last edited by phibermon; 09-10-2010 at 01:50 PM.
When the moon hits your eye like a big pizza pie - that's an extinction level impact event.
Bookmarks