rombust
11-01-2010, 03:24 PM
I tried to create a new example (Commited to 2.2 and 2.3 SVN : Examples/Display/Thread)
See image:
http://esoteric.clanlib.org/~rombust/ReleaseImages/thread.png
The main thread should draw a rotating texture running at full frame rate (currently set at 60fps)
The worker thread should create the texture.
The textures are double buffered, so the texture (A) is read from and texture (B) is written to.
The texture is written to using a CL_FrameBufferObject via an OpenGL shader.
The shader renders a simple mandelbrot set.
That's the theory.
On Windows the example runs very slowly. It seems that the main thread is waiting for the worker thread to complete.
I am using the latest ATI graphics driver.
On Linux, the example runs at 60fps. I did not check the example running flatout (without flip(1), and using flip(0) )
Before the thread starts, I use:
CL_GraphicContext worker_gc = gc.create_worker_gc();
That is passed to the thread
The thread contains: CL_SharedGCData::add_ref(); .... CL_SharedGCData::release_ref();
Without the add_ref() the application crashes in CL_SharedGCData
Is add_ref() required?
On windows, the application crashes on exit with release_ref(). On linux, it works
Except once, where it crashed the entire ubuntu desktop (freezing the keyboard/display)
Can someone have a look please :)
See image:
http://esoteric.clanlib.org/~rombust/ReleaseImages/thread.png
The main thread should draw a rotating texture running at full frame rate (currently set at 60fps)
The worker thread should create the texture.
The textures are double buffered, so the texture (A) is read from and texture (B) is written to.
The texture is written to using a CL_FrameBufferObject via an OpenGL shader.
The shader renders a simple mandelbrot set.
That's the theory.
On Windows the example runs very slowly. It seems that the main thread is waiting for the worker thread to complete.
I am using the latest ATI graphics driver.
On Linux, the example runs at 60fps. I did not check the example running flatout (without flip(1), and using flip(0) )
Before the thread starts, I use:
CL_GraphicContext worker_gc = gc.create_worker_gc();
That is passed to the thread
The thread contains: CL_SharedGCData::add_ref(); .... CL_SharedGCData::release_ref();
Without the add_ref() the application crashes in CL_SharedGCData
Is add_ref() required?
On windows, the application crashes on exit with release_ref(). On linux, it works
Except once, where it crashed the entire ubuntu desktop (freezing the keyboard/display)
Can someone have a look please :)