OGLNewCtrl
int OGLNewCtrl (int panelHandle, const char *label, int top, int left);
Purpose
Creates a new OGL control.
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. |
label | const char * | The label to be displayed for this control. |
top | int | The vertical coordinate at which the upper left corner of the control (not including labels) is placed. The coordinate must be an integer value from -32768 to 32767. The origin (0,0) is at the upper-left corner of the panel (directly below the title bar) before the panel is scrolled. |
left | int | The horizontal coordinate at which the upper left corner of the control (not including labels) is placed. The coordinate must be an integer value from -32768 to 32767. The origin (0,0) is at the upper-left corner of the panel (directly below the title bar) before the panel is scrolled. |
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