vgClearの中でエラーになる。
vgClearの中で死んでいたので、vgClearの中に問題があると思った。
OpenVgの初期化を呼んでいなかった。
vgClearの前にassertを入れたらvgClearの前で止まった。
assert(vgGetError() == VG_NO_ERROR); <=ここで止まった。 vgClear(0, 0, nopvgi.screenWidth, nopvgi.screenHeight); assert(vgGetError() == VG_NO_ERROR);
vgClear(0, 0, nopvgi.screenWidth, nopvgi.screenHeight);
void RI_APIENTRY vgClear(VGint x, VGint y, VGint width, VGint height) { RI_GET_CONTEXT(RI_NO_RETVAL); (略) ※OpenVGのRIより
#define RI_GET_CONTEXT(RETVAL) OSAcquireMutex(); <= OK VGContext* context = (VGContext*)eglvgGetCurrentVGContext(); if(!context) { OSReleaseMutex(); return RETVAL; } ※OpenVGのRIより
void* eglvgGetCurrentVGContext(void) { EGL* egl = getEGL(); if(egl) { RIEGLThread* thread = egl->getCurrentThread(); if(thread) { RI_ASSERT(thread->getCurrentContext() && thread->getCurrentSurface()); return thread->getCurrentContext()->getVGContext(); } } return NULL; //not initialized or made current } ※OpenVGのRIより
m_currentThreads.size()が0なんだ。
RIEGLThread* EGL::getCurrentThread() const { void* currentThreadID = OSGetCurrentThreadID(); for(int i=0;i<m_currentThreads.size();i++) <=ここで抜けちゃう { if(currentThreadID == m_currentThreads[i]->getThreadID()) return m_currentThreads[i]; } return NULL; //thread is not current } ※OpenVGのRIより
Win32APIのGetCurrentThreadId()を呼んでいる。
GetCurrentThreadId 関数
スレッドのIDを返すだけか。
void* OSGetCurrentThreadID(void) { return (void*)GetCurrentThreadId(); //TODO this is not safe }