本文整理汇总了Python中OpenGL.GLUT.glutInit方法的典型用法代码示例。如果您正苦于以下问题:Python GLUT.glutInit方法的具体用法?Python GLUT.glutInit怎么用?Python GLUT.glutInit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenGL.GLUT
的用法示例。
在下文中一共展示了GLUT.glutInit方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initgl
# 需要导入模块: from OpenGL import GLUT [as 别名]
# 或者: from OpenGL.GLUT import glutInit [as 别名]
def initgl(self):
'''App-specific initialization for after GLUT has been initialized.'''
import OpenGL.GL as gl
self.gllist_id = gl.glGenLists(9)
gl.glEnableClientState(gl.GL_VERTEX_ARRAY)
gl.glEnableClientState(gl.GL_COLOR_ARRAY)
gl.glDisable(gl.GL_LIGHTING)
gl.glDisable(gl.GL_TEXTURE_2D)
gl.glDisable(gl.GL_FOG)
gl.glDisable(gl.GL_COLOR_MATERIAL)
gl.glEnable(gl.GL_DEPTH_TEST)
gl.glShadeModel(gl.GL_FLAT)
self.set_data(self.data, classes=self.classes, features=self.features)
try:
import OpenGL.GLUT as glut
glut.glutInit()
self._have_glut = True
except:
pass
示例2: init_glut
# 需要导入模块: from OpenGL import GLUT [as 别名]
# 或者: from OpenGL.GLUT import glutInit [as 别名]
def init_glut(self,window_size = (800,600)):
self.glutwindow = GLUTWindow(self.world, "FWMAV")
GLUT.glutInit(())
GLUT.glutInitDisplayMode(GLUT.GLUT_RGBA |
GLUT.GLUT_DOUBLE |
GLUT.GLUT_MULTISAMPLE |
GLUT.GLUT_ALPHA |
GLUT.GLUT_DEPTH)
GLUT.glutInitWindowSize(*window_size)
GLUT.glutInitWindowPosition(0, 0)
self.glutwindow.window = GLUT.glutCreateWindow(self.glutwindow.title)
self.glutwindow.initGL(*window_size)
self.camera_theta = 75
self.camera_phi = 135
self.camera_horizontal = 0.0
self.camera_vertical = -0.25
self.camera_depth = -1.25
self.camera_angle_increment = 5
self.camera_position_increment = 0.05
self.update_camera()
#self.glutwindow.scene.add_camera(Trackball(theta = self.camera_theta, phi = self.camera_phi, trans=[self.camera_horizontal, self.camera_vertical, self.camera_depth]),"Camera Z up close")
#self.glutwindow.scene.set_camera(2)
self.glutwindow.scene.resize(*window_size)
self.glutwindow.drawGL()
示例3: init_glut
# 需要导入模块: from OpenGL import GLUT [as 别名]
# 或者: from OpenGL.GLUT import glutInit [as 别名]
def init_glut(self,window_size = (800,600)):
self.glutwindow = GLUTWindow(self.world, "FWMAV")
GLUT.glutInit(())
GLUT.glutInitDisplayMode(GLUT.GLUT_RGBA |
GLUT.GLUT_DOUBLE |
GLUT.GLUT_MULTISAMPLE |
GLUT.GLUT_ALPHA |
GLUT.GLUT_DEPTH)
GLUT.glutInitWindowSize(*window_size)
GLUT.glutInitWindowPosition(0, 0)
self.glutwindow.window = GLUT.glutCreateWindow(self.glutwindow.title)
self.glutwindow.initGL(*window_size)
self.camera_theta = 75
self.camera_phi = 90
self.camera_horizontal = 0.0
self.camera_vertical = -0.25
self.camera_depth = -1.5
self.camera_angle_increment = 5
self.camera_position_increment = 0.05
self.update_camera()
#self.glutwindow.scene.add_camera(Trackball(theta = self.camera_theta, phi = self.camera_phi, trans=[self.camera_horizontal, self.camera_vertical, self.camera_depth]),"Camera Z up close")
#self.glutwindow.scene.set_camera(2)
self.glutwindow.scene.resize(*window_size)
self.glutwindow.drawGL()
示例4: __init__
# 需要导入模块: from OpenGL import GLUT [as 别名]
# 或者: from OpenGL.GLUT import glutInit [as 别名]
def __init__(self):
super(HEADMODEL_UI, self).__init__()
try:
GLUT.glutInit()
except OpenGL.error.NullFunctionError:
pass
self.referencePoints = [None]*5
mainLayout = QtWidgets.QVBoxLayout()
#Radio buttons for surfaces
self.radio_buttons_box = QtWidgets.QGroupBox('')
radio_buttons_layout = QtWidgets.QHBoxLayout()
self.view_scalp = QtWidgets.QRadioButton("Scalp")
self.view_scalp.toggle()
self.view_scalp.toggled.connect(self.changeSurface)
radio_buttons_layout.addWidget(self.view_scalp)
self.view_gm = QtWidgets.QRadioButton("Gray Matter")
radio_buttons_layout.addWidget(self.view_gm)
self.radio_buttons_box.setLayout(radio_buttons_layout)
self.glHeadModel = GLHeadModel()
self.glHeadModel.windowClicked.connect(self.writePosition)
self.text_label = QtWidgets.QLabel("Current Position:")
self.pos_label = QtWidgets.QLabel("")
self.setProgressBar()
#self.eeg_grop_box = self.eegPosStuf()
mainLayout.addWidget(self.radio_buttons_box)
mainLayout.addWidget(self.glHeadModel)
mainLayout.addWidget(self.text_label)
mainLayout.addWidget(self.pos_label)
mainLayout.addWidget(self.progressBar)
#mainLayout.addWidget(self.eeg_grop_box)
self.setLayout(mainLayout)
示例5: enable_glut
# 需要导入模块: from OpenGL import GLUT [as 别名]
# 或者: from OpenGL.GLUT import glutInit [as 别名]
def enable_glut(self, app=None):
""" Enable event loop integration with GLUT.
Parameters
----------
app : ignored
Ignored, it's only a placeholder to keep the call signature of all
gui activation methods consistent, which simplifies the logic of
supporting magics.
Notes
-----
This methods sets the PyOS_InputHook for GLUT, which allows the GLUT to
integrate with terminal based applications like IPython. Due to GLUT
limitations, it is currently not possible to start the event loop
without first creating a window. You should thus not create another
window but use instead the created one. See 'gui-glut.py' in the
docs/examples/lib directory.
The default screen mode is set to:
glut.GLUT_DOUBLE | glut.GLUT_RGBA | glut.GLUT_DEPTH
"""
import OpenGL.GLUT as glut
from IPython.lib.inputhookglut import glut_display_mode, \
glut_close, glut_display, \
glut_idle, inputhook_glut
if GUI_GLUT not in self._apps:
glut.glutInit( sys.argv )
glut.glutInitDisplayMode( glut_display_mode )
# This is specific to freeglut
if bool(glut.glutSetOption):
glut.glutSetOption( glut.GLUT_ACTION_ON_WINDOW_CLOSE,
glut.GLUT_ACTION_GLUTMAINLOOP_RETURNS )
glut.glutCreateWindow( sys.argv[0] )
glut.glutReshapeWindow( 1, 1 )
glut.glutHideWindow( )
glut.glutWMCloseFunc( glut_close )
glut.glutDisplayFunc( glut_display )
glut.glutIdleFunc( glut_idle )
else:
glut.glutWMCloseFunc( glut_close )
glut.glutDisplayFunc( glut_display )
glut.glutIdleFunc( glut_idle)
self.set_inputhook( inputhook_glut )
self._current_gui = GUI_GLUT
self._apps[GUI_GLUT] = True