![]() |
MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
|
OpenGL specific implementation of the abstract TSL3DDrawingSurface class using the GLX protocol for X11 platforms.
MapLink expects that the Open GL state is reset after any user drawing to the original settings. This can be achieved by calling glIsEnabled and reset the state after finishing drawing.
Point anti-aliasing is turned on by default.
Anti-aliasing may be turned on by the user for polygons and lines. By default these are turned off.
Only one OpenGL context per thread is allowed. Therefore there is a one to one relationship between the Drawing Surface and a thread.
The drawing surface internally uses Xlib in multiple threads. It is therefore necessary for the application to call XInitThreads to ensure that this access is protected. This must be the first Xlib call made by the application. Note that it is not necessary for the application to call XLock Display/XUnlockDisplay on the display connection used by the drawing surface at any time unless the client application also shares this display connection with other threads it has created.
Public Member Functions | |
TSL3DX11GLSurface (Display *display, Screen *screen, Drawable drawable, bool isPixmap, Visual *visual, bool swapBuffersManually=false) | |
TSL3DX11GLSurface (Display *display, GLXDrawable drawable, GLXContext context, bool swapBuffersManually=false, Visual *visual=NULL, Screen *screen=NULL) | |
GLXContext | openGLContext () const |
void | setOpenGLContext () |
virtual | ~TSL3DX11GLSurface () |
![]() | |
TSL3DCamera * | camera () |
const TSL3DCamera * | camera () const |
bool | drawDU (TSLDeviceUnits x1, TSLDeviceUnits y1, TSLDeviceUnits x2, TSLDeviceUnits y2, bool clear, bool offscreenSurface=false) |
bool | DUToLatLon (const TSLDeviceUnits x, const TSLDeviceUnits y, double &latitude, double &longitude) const |
void | exaggerateTerrain (double asl, double bsl) |
bool | frameRateIdle (bool onOff) |
bool | geocentricToGeodetic (double x, double y, double z, double &lat, double &lon, double &alt) const |
bool | geodeticToGeocentric (double lat, double lon, double alt, double &x, double &y, double &z) const |
bool | geocentricToWorld (double x, double y, double z, double &x1, double &y1, double &z1) const |
bool | geodeticToWorld (double lat, double lon, double alt, double &x, double &y, double &z) const |
bool | get3DOption (TSL3DOptionEnum option) const |
bool | getAnisotropicFilter () const |
float | getAnisotropicFilterLevel () const |
void | getDUExtent (TSLDeviceUnits *x1, TSLDeviceUnits *y1, TSLDeviceUnits *x2, TSLDeviceUnits *y2) const |
int | getFrameRate () const |
bool | getLightingOption (TSL3DLightingOptionEnum option) const |
void | getLODConfiguration (TSL3DLODConfiguration &lodConfiguration) const |
int | getMaxMapTextureCacheSize () const |
bool | getTerrainHeight (double latitude, double longitude, double &altitude) const |
bool | getTerrainRendering (int *wireframeColour, int *solidColour, const char **bitmapFile) const |
void | getTextureCacheSize (int &fontMaxSize, int &symbolMaxSize, int &app6aMaxSize) const |
bool | globalAmbientLight (double red, double green, double blue, double alpha) |
bool | globalAmbientLight (double *red, double *green, double *blue, double *alpha) const |
bool | isMapThreadStopped () const |
bool | queryModelIndices (int **indices, int *num) const |
void | set3DOption (TSL3DOptionEnum option, bool value) |
void | setAnisotropicFilter (bool state) |
void | setFrameRate (int frameRate) |
void | setLightingOption (TSL3DLightingOptionEnum option, bool value) |
void | setAnisotropicFilterLevel (float level) |
bool | setLODConfiguration (const TSL3DLODConfiguration &lodConfiguration) |
void | setMaxMapTextureCacheSize (int cacheInMB) |
virtual void | setOption (TSLOptionEnum option, bool value) |
bool | setRenderingCallback (TSL3DRenderingCallback callback, void *arg) |
bool | setTerrainRendering (int wireframeColour, int solidColour, const char *bitmapFile) |
void | setTextureCacheSize (const int fontMaxSize, const int symbolMaxSize, const int app6aMaxSize) |
void | stopMapThread () |
void | startMapThread () |
void | swapBuffers () |
bool | wndResize (TSLDeviceUnits x1, TSLDeviceUnits y1, TSLDeviceUnits x2, TSLDeviceUnits y2, bool auto_redraw=true) |
virtual | ~TSL3DDrawingSurface () |
virtual double | viewAspect () |
bool | setTerrainLoadedCallback (TSL3DRenderingCallback callback, void *arg) |
![]() | |
bool | addDataLayer (TSLDataLayer *data_layer_interface, const char *data_id) |
bool | addDynamicRenderer (TSLDynamicRenderer *renderer, TSLFeatureID featureID=-1, const char *layerName=0) |
bool | addFeatureRendering (const char *featureName, TSLFeatureID featureID) |
void | attach (TSLDeviceContext handle) |
void | attach (TSLWindowHandle handle) |
void | attach (TSLDrawableHandle handle) |
bool | bringInFrontof (const char *move_data_layer, const char *target_data_layer) |
bool | bringToFront (const char *move_data_layer) |
bool | clearAllDeclutterData (const char *layer_name=0) |
void | clearAllDynamicRenderers () |
bool | clearBackgroundColour () |
bool | clearDeclutterData (const char *feature_name, const char *layer_name=0) |
bool | clearDynamicRenderer (TSLFeatureID featureID=-1, const char *layerName=0) |
bool | clearFeatureRendering (const char *featureName, TSLFeatureID featureID) |
bool | clearFrame () |
bool | copyDeclutterData (const char *src_feature_name, const char *dest_feature_name, const char *src_layer_name=0, const char *dest_layer_name=0) |
void | detach () |
void | detachAllDynamicRenderers () |
bool | detachDynamicRenderer (TSLFeatureID featureID=-1, const char *layerName=0) |
const char * | featureClass (TSLFeatureID feature_id) |
bool | forceLayer (const char *data_id, const char *detail_layer_name) |
bool | getBackgroundColour (TSLStyleID *value) |
bool | getColourValue (int colour, unsigned char &r, unsigned char &g, unsigned char &b) |
TSLDataLayer * | getDataLayer (const char *data_id) |
bool | getDataLayerInfo (int N, TSLDataLayer **dataLayer, const char **layerName) const |
bool | getDataLayerProps (const char *data_id, TSLPropertyEnum property_id, TSLPropertyValue *old_value) |
bool | getDeclutterStatus (const char *feature_name, TSLDeclutterStatusResultEnum *value, const char *dataLayerName=0, const char *detailLayerName=0) |
bool | getDeclutterStatus (TSLFeatureID feature_id, TSLDeclutterStatusResultEnum *value, const char *dataLayerName, const char *detailLayerName=0) |
TSLDynamicRenderer * | getDynamicRenderer (TSLFeatureID featureID=-1, const char *layerName=0) |
bool | getFeatureRendering (const char *featureName, TSLFeatureID featureID, TSLRenderingAttributeInt attribute, int *result) const |
bool | getFeatureRendering (const char *featureName, TSLFeatureID featureID, TSLRenderingAttributeDouble attribute, double *result) const |
bool | getFeatureRendering (const char *featureName, TSLFeatureID featureID, TSLRenderingAttributeBool attribute, bool *result) const |
bool | getFeatureRendering (const char *featureName, TSLFeatureID featureID, TSLRenderingAttributes *result) const |
int | getNumDataLayers () const |
bool | getOption (TSLOptionEnum option) |
void | id (int id_) |
int | id () const |
bool | idleProcess () |
bool | loadDeclutter (const char *filename) |
bool | loadRendering (const char *filename) |
TSLPickResultSet * | pick (TSLDeviceUnits x, TSLDeviceUnits y, TSLDeviceUnits aperture, int depth, TSLPickSelector *selector=0) |
TSLPickResultSet * | pick (const char *data_id, TSLDeviceUnits x, TSLDeviceUnits y, TSLDeviceUnits aperture, int depth=-1, TSLPickSelector *selector=0) |
bool | queryActiveLayer (const char *data_id, char *detail_layer_name, int detail_layer_name_size) |
bool | removeDataLayer (const char *data_id) |
bool | saveDeclutter (const char *filename, TSLMapLinkVersion ver=TSL_CURRENT_MAPLINK_VERSION) |
bool | saveRendering (const char *filename, TSLMapLinkVersion ver=TSL_CURRENT_MAPLINK_VERSION) |
bool | sendToBack (const char *move_data_layer) |
bool | sendToBackOf (const char *move_data_layer, const char *target_data_layer) |
bool | setBackgroundColour (int value) |
bool | setCoordinateProvidingLayer (const char *layer_name) |
bool | setDataLayerProps (const char *data_id, TSLPropertyEnum property_id, TSLPropertyValue new_value) |
bool | setDeclutterStatus (const char *feature_name, TSLDeclutterStatusEnum value, const char *dataLayerName=0, const char *detailLayerName=0) |
bool | setDeclutterStatus (TSLFeatureID feature_id, TSLDeclutterStatusEnum value, const char *dataLayerName=0, const char *detailLayerName=0) |
bool | setDeclutterStatusOnAllFeatures (TSLDeclutterStatusEnum value, const char *dataLayerName=0, const char *detailLayerName=0) |
bool | setFeatureRendering (const char *featureName, TSLFeatureID featureID, TSLRenderingAttributeInt attribute, int value) |
bool | setFeatureRendering (const char *featureName, TSLFeatureID featureID, TSLRenderingAttributeDouble attribute, double value) |
bool | setFeatureRendering (const char *featureName, TSLFeatureID featureID, TSLRenderingAttributeBool attribute, bool value) |
bool | setFeatureRendering (const char *featureName, TSLFeatureID featureID, TSLRenderingAttributes *value) |
bool | setFrame (int style, int colour, int thickness) |
double | TMCperMU () |
TSLDrawingSurfaceTypeEnum | type () const |
void | userWord (void *ptr) const |
void * | userWord () const |
bool | cloneDynamicRenderersFrom (const TSLDrawingSurfaceBase *otherSurface) |
void | addDuplicateLayers (bool value) |
virtual | ~TSLDrawingSurfaceBase () |
Additional Inherited Members | |
![]() | |
static bool | loadStandardConfig (const char *path=0) |
static bool | setupModels (const char *filename) |
![]() | |
static bool | addLoader (TSLFileLoader *loader) |
static bool | addPathList (TSLPathList *path_list) |
static bool | findFile (const char *filename, TSLSimpleString &foundPath) |
static TSLFileLoader * | getLoader () |
![]() | |
TSL3DDrawingSurface () | |
![]() | |
TSLDrawingSurfaceBase () | |
![]() | |
void * | m_classID |
TSL3DX11GLSurface::TSL3DX11GLSurface | ( | Display * | display, |
Screen * | screen, | ||
Drawable | drawable, | ||
bool | isPixmap, | ||
Visual * | visual, | ||
bool | swapBuffersManually = false ) |
Constructs an OpenGL specific TSL3DDrawingSurface using the GLX protocol, creating a new OpenGL context in the process.
display | X11 display pointer |
screen | X11 screen |
drawable | Drawable to draw to |
isPixmap | Whether the given drawable is a Window or Pixmap. Note that when attaching the drawing surface to a Pixmap it is highly likely that no hardware acceleration will be available. |
visual | The visual to use to create the OpenGL context with the desired attributes. This can be retrieved using glXChooseVisual().The visual provided determines whether the drawing surface will be double buffered and whether a depth buffer will be available, so it is vital that a sensible visual is used. This can be retrieved using glXChooseVisual(). |
A | recommended set of attributes to use with glXChooseVisual is as follows int surfaceAttributes[] = { GLX_RGBA, True, GLX_DOUBLEBUFFER, True, GLX_RED_SIZE, 8, GLX_BLUE_SIZE, 8, GLX_GREEN_SIZE, 8, GLX_DEPTH_SIZE, 16, None }; XVisualInfo *matchingVisual = glxChooseVisual( display, screen, surfaceAttributes ); This list requests a 24-bit colour double-buffered visual with at least a 16-bit depth buffer. |
swapBuffersManually | If true the drawing surface will not initiate a buffer swap after drawing, allowing the user to perform additional drawing using the active OpenGL context. The user should perform the buffer swap by calling glXSwapBuffers(). |
TSL3DX11GLSurface::TSL3DX11GLSurface | ( | Display * | display, |
GLXDrawable | drawable, | ||
GLXContext | context, | ||
bool | swapBuffersManually = false, | ||
Visual * | visual = NULL, | ||
Screen * | screen = NULL ) |
Constructs an OpenGL specific TSL3DDrawingSurface using the GLX protocol using an existing OpenGL context.
display | X11 display pointer. |
drawable | The GLX drawable the existing context is attached to. |
context | The existing OpenGL context. The drawing surface does not take ownership of this context. |
swapBuffersManually | If true the drawing surface will not initiate a buffer swap after drawing, allowing the user to perform additional drawing using the active OpenGL context. The user should perform the buffer swap by calling glXSwapBuffers(). |
visual | On systems supporting GLX 1.3 or newer this parameter may normally be left as NULL. The necessary framebuffer configuration information will be extracted from the provided GLX context. For systems that do not support GLX 1.3 this parameter should be set to the Visual used to create the OpenGL context. On some systems it may be necessary to provide the visual eventhough GLX 1.3 is supported if the GLX implementation does not allow certain information to be queried from a context. This normally happens when attempting to use the drawing surface via remote X. |
screen | On systems supporting GLX 1.3 or newer this parameter may normally be left as NULL. The necessary screen information will be extracted from the provided GLX context. For systems that do not support GLX 1.3 this parameter should be set to the X11 Screen object representing the screen that the Open GL context was created on. On some systems it may be necessary to provide the screen even though GLX 1.3 is supported if the GLX implementation does not allow certain information to be queried from a context. This normally happens when attempting to use the drawing surface via remote X. |
|
virtual |
GLXContext TSL3DX11GLSurface::openGLContext | ( | ) | const |
Returns the OpenGL context used by the drawing surface.
void TSL3DX11GLSurface::setOpenGLContext | ( | ) |
Call to set the OpenGL context to the current thread.
This method should be called before a draw if multiple 3D drawing surfaces are being used in a single thread. Each Drawing Surface has its own OpenGL Context.
In multiple threads you need to call this method when the drawing surface is moved to a different thread.
If you are using multiple threads with MapLink you need to make sure that you minimise the sharing of layers between Drawing Surfaces in different threads and manage any editing of data very carefully.
Any layer which could contain a cache should not be shared between threads, for example, CADRG Data Layer, WMS Data Layer, or the Terrain Data Layer. For a list of data layers that are safe to share between drawing surfaces please refer to the Threading section of the MapLink Developer's Guide.
Any layer that contains dynamic data should not be shared between threads.
Any layer which is being edited should be made invisible in all drawing surfaces or removed from all drawing surfaces before being edited. Changing rendering attributes is normally ok, though the update will not occur until next redraw.
NOTE: We have experienced problems with some graphics cards and as such support for multiple 3d drawing surfaces is experimental.