本文整理匯總了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