OpenGL + POSIX thread = Segmentation fault

When I try to draw some objects in pthread function programm breaks (segmentation fault)…

Same example:

void *compile_events(void *aSuper) {
class MainGL super;
super = (class MainGL
) aSuper;
while(1) {
super->drawSomething();
}
}

MainGL is a simple class which has a display, reshape & other same openGL functions (friend functions of class).

Please, help me if you understand my problem.

It seems to me that either the maingl window class isn’t initialized yet - invalid pointer - or the OpenGL display hasn’t been setup correctly. Make sure the thread is created after all necessary setup has been done.

Regards,
-stone.


http://www.steinsoft.net

Perhaps it’s worth mentioning that OpenGL is not thead safe…

Although “super = (class MainGL*) aSuper;” could be a problem if “void *aSuper” refuses to be a MainGL object. I don’t understand why you are using a void pointer for your data in C++, as the language has usefull features to avoid such things.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.