OGLConvertCtrl
int OGLConvertCtrl (int panelHandle, int pictureToConvert);
Purpose
Converts an existing picture control into a OGL control.
The function must be called from the same thread that the parent panel on which the thread resides is created in.
Although you can call OGLNewCtrl to create an OGL control from scratch, it may be more convenient to create and position a picture control in the User Interface Editor and then use this function to convert the picture control into an OGL control after the panel is loaded.
The OGL control has to be created from the same thread that the parent panel on which the thread resides is created in.
Event Type | When Received |
OGLEVENT_REFRESH | Whenever the control is refreshed and during pan/zoom/rotate |
EVENT_LEFT_CLICK | Left click on control |
EVENT_RIGHT_CLICK | Right click on control |
EVENT_LEFT_DOUBLE_CLICK | Left double click on control |
EVENT_RIGHT_DOUBLE_CLICK | Right double click on control |
![]() |
Note The CVIOGL control cannot be created on child panels. |
![]() |
Note When the OGLEVENT_REFRESH event is received, eventData1 specifies whether the view is being modified using the pan/zoom/rotate feature. eventData2 is not used. |
![]() |
Note The CVIOGL control cannot be used when the system pixel depth is below 8 bits (256 colors). |
![]() |
Note The CVIOGL control will not resize when a panel and its contents are resized. You must manually resize the CVIOGL control using the following code inside a panel callback. |
int CVICALLBACK PanelCallbackWithCVIOGLCtrl (int panel, int event, void *callbackData, int eventData1, int eventData2)
{
int width, height, top, left;
switch (event)
{
case EVENT_PANEL_SIZE:
GetCtrlAttribute(demoPanel, DEMOPANEL_PICTURE, ATTR_TOP, &top);
GetCtrlAttribute(demoPanel, DEMOPANEL_PICTURE, ATTR_LEFT, &left);
GetCtrlAttribute(demoPanel, DEMOPANEL_PICTURE, ATTR_WIDTH, &width);
GetCtrlAttribute(demoPanel, DEMOPANEL_PICTURE, ATTR_HEIGHT, &height);
OGLSetCtrlAttribute (demoPanel, demoControl, OGLATTR_TOP, top);
OGLSetCtrlAttribute (demoPanel, demoControl, OGLATTR_LEFT, left);
OGLSetCtrlAttribute (demoPanel, demoControl, OGLATTR_WIDTH, width);
OGLSetCtrlAttribute (demoPanel, demoControl, OGLATTR_HEIGHT, height);
OGLRefreshGraph(demoPanel,demoControl);
break;
}
return 0;
}
Parameters
Input | ||
Name | Type | Description |
panelHandle | int | The specifier for a particular panel that is currently in memory. This handle will have been returned by the LoadPanel, NewPanel, or DuplicatePanel function. The panel has to be a parent panel and should not be the child of any other panel. The panel cannot be scrollable or resizeable. |
pictureToConvert | int | Specifies the picture control on the panel to convert into an OGL control. Pass the defined constant (located in the UIR header file) that was assigned to the picture control in the User Interface Editor or the ID returned by the NewCtrl or DuplicateCtrl function. |
Return Value
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
OGLControlId | int | Returns the ID used to specify this control in subsequent function calls. Negative values indicate that an error occurred.Error Codes
|
Additional Information
Library: OpenGL 3D Plotting Control
Include file: custctrl\cviogl.h
LabWindows/CVI compatibility: LabWindows/CVI 5.0 and later
Examples
Refer to the following examples that use the OGLConvertCtrl function: