#include <vrj/Draw/OGL/GlContextData.h>
Inheritance diagram for vrj::GlContextData< ContextDataType >:


Public Member Functions | |
| GlContextData () | |
| ContextDataType & | operator * () |
| Returns reference to user data for the current context. | |
| ContextDataType * | operator-> () |
| Returns reference to user data for the current context. | |
| std::vector< ContextDataType * > * | getDataVector () |
| This function gives exclusive access to ALL copies of the context-specific data for contexts controlled by the current thread. | |
Protected Member Functions | |
| ContextDataType * | getPtrToCur () |
| Returns a pointer to the correct data element in the current context. | |
Classes | |
| struct | ThreadContextData |
| Container for the thread-specific context-specific data. More... | |
This class allows the user to specify a data type that contains data that needs to have a context-specific copy. This means that there is a unique copy of the data structure for each OpenGL context in the current environment. Juggler will take care of the data copies transparently for the user so the user never has to know about the current configuration.
An example use would be a struct full of display list id's. The user passes their user-defined data structure as the template parameter. The resulting object will be a "smart" pointer to the context-specific data to use.
Definition at line 103 of file GlContextData.h.
| vrj::GlContextData< ContextDataType >::GlContextData | ( | ) | [inline] |
| ContextDataType& vrj::GlContextData< ContextDataType >::operator * | ( | ) | [inline] |
Returns reference to user data for the current context.
Definition at line 116 of file GlContextData.h.
00117 { 00118 return (*getPtrToCur()); 00119 }
| ContextDataType* vrj::GlContextData< ContextDataType >::operator-> | ( | ) | [inline] |
Returns reference to user data for the current context.
Definition at line 128 of file GlContextData.h.
00129 { 00130 return getPtrToCur(); 00131 }
| std::vector<ContextDataType*>* vrj::GlContextData< ContextDataType >::getDataVector | ( | ) | [inline] |
This function gives exclusive access to ALL copies of the context-specific data for contexts controlled by the current thread.
Definition at line 140 of file GlContextData.h.
| ContextDataType* vrj::GlContextData< ContextDataType >::getPtrToCur | ( | ) | [inline, protected] |
Returns a pointer to the correct data element in the current context.
Definition at line 178 of file GlContextData.h.
Referenced by vrj::GlContextData< vrj::OpenSGApp::context_data >::operator *(), and vrj::GlContextData< vrj::OpenSGApp::context_data >::operator->().
00179 { 00180 // Get current context 00181 int context_id = getCurContext(); 00182 00183 // Cache ref for better performance 00184 ThreadContextData<ContextDataType>* thread_specific_context_data = 00185 &(*mThreadSpecificContextData); 00186 00187 thread_specific_context_data->checkSize(context_id+1); // Make sure we are large enough (+1 since we have index) 00188 00189 return thread_specific_context_data->mContextDataVector[context_id]; 00190 }
1.5.1