![]() |
NAVTOR SDK
v.3.0
Software Development Kit for fast and efficient development of ECDIS, ECS and generic marine applications
|
Generic GL2D thread to perform OpenGL calls (GL2D tasks) DO NOT call ANY of GL2D object methods from given thread - this will cause deadlock due of: External user thread can call for create/draw method of Canvas - lock can be acquired by this thread. During create/draw operation some tasks can be added to GL thread and external thread can wait for tasks will be performed. In case given thread will call for any GL2D object method which will acquire same lock - given GL thread will hang until lock will not be released - means this GL thread is not able more to perform any of GL tasks added so far to tasks query -> external user thread will hang forever as well as GL thread due of deadlock. More...
#include <gl2d_thread_interface.h>
Inherits ISDKProperties.
Public Member Functions | |
| virtual bool SDK_CALLTYPE | AddTask (const IGL2DTaskSP &task)=0 throw () |
| Adds new task to perform in given thread Thread should call for IGL2DTask::PerformTask of given task at appropriate moment to perform task ANY GL2D task SHOULD be performed only in same ORDER as it was added to thread! THIS CALL CAN BE PERFORMED FROM ANY THREAD. | |
| virtual void SDK_CALLTYPE | OnDrawingCycleFinished ()=0 throw () |
| Notifies given thread that current drawing cycle is finished. Called by IGL2DCanvas::FinishDraw method only THIS CALL CAN BE PERFORMED FROM ANY THREAD. | |
| virtual void SDK_CALLTYPE | WaitAllTasksFinished ()=0 throw () |
| Waits till all of tasks, added to given thread so far will not be finished THIS CALL CAN BE PERFORMED FROM ANY THREAD. | |
Generic GL2D thread to perform OpenGL calls (GL2D tasks) DO NOT call ANY of GL2D object methods from given thread - this will cause deadlock due of: External user thread can call for create/draw method of Canvas - lock can be acquired by this thread. During create/draw operation some tasks can be added to GL thread and external thread can wait for tasks will be performed. In case given thread will call for any GL2D object method which will acquire same lock - given GL thread will hang until lock will not be released - means this GL thread is not able more to perform any of GL tasks added so far to tasks query -> external user thread will hang forever as well as GL thread due of deadlock.
Normal scheme to use for externally managed OpenGL context with own GL thread: 1) Given GL thread ONLY performs added so far GL tasks. No calls to GL2D object methods should be performed. In case FBO should be displayed, given thread should call for appropriate xxxSwapBuffers method and start to process GL tasks again. 2) Several threads can create appropriate GL2D objects, like textures/sprites/lines/etc. After object is created, object can be drawn by canvas 3) Separate thread manages canvas drawing process, like starts/finishes draw process, draws any of required objects, etc. After draw is finished appropriate IGL2DThread::OnDrawingCycleFinished method will be called, means canvas FBO can be displayed by OpenGL thread.
In case canvas managed OpenGL contexts are in use - no any of limitations exist - both resource and drawing threads as well as two GL contexts will be managed internally by canvas itself, call to appropriate GL2D object method can be performed from any of user threads.