Python GLUT.glutInit方法代碼示例- 純淨天空
文章推薦指數: 80 %
本文整理匯總了Python中OpenGL.GLUT.glutInit方法的典型用法代碼示例。
如果您正苦於以下問題:Python GLUT.glutInit方法的具體用法?Python GLUT.glutInit怎麽用?
當前位置:首頁>>代碼示例>>Python>>正文
本文整理匯總了Python中OpenGL.GLUT.glutInit方法的典型用法代碼示例。
如果您正苦於以下問題:PythonGLUT.glutInit方法的具體用法?PythonGLUT.glutInit怎麽用?PythonGLUT.glutInit使用的例子?那麽恭喜您,這裏精選的方法代碼示例或許可以為您提供幫助。
您也可以進一步了解該方法所在類OpenGL.GLUT的用法示例。
在下文中一共展示了GLUT.glutInit方法的5個代碼示例,這些例子默認根據受歡迎程度排序。
您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Python代碼示例。
示例1:initgl
▲點讚6
▼
#需要導入模塊:fromOpenGLimportGLUT[as別名]
#或者:fromOpenGL.GLUTimportglutInit[as別名]
definitgl(self):
'''App-specificinitializationforafterGLUThasbeeninitialized.'''
importOpenGL.GLasgl
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:
importOpenGL.GLUTasglut
glut.glutInit()
self._have_glut=True
except:
pass開發者ID:spectralpython,項目名稱:spectral,代碼行數:22,代碼來源:ndwindow.py
示例2:init_glut
▲點讚6
▼
#需要導入模塊:fromOpenGLimportGLUT[as別名]
#或者:fromOpenGL.GLUTimportglutInit[as別名]
definit_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]),"CameraZupclose")
#self.glutwindow.scene.set_camera(2)
self.glutwindow.scene.resize(*window_size)
self.glutwindow.drawGL()開發者ID:purdue-biorobotics,項目名稱:flappy,代碼行數:26,代碼來源:simulation_maneuver.py
示例3:init_glut
▲點讚6
▼
#需要導入模塊:fromOpenGLimportGLUT[as別名]
#或者:fromOpenGL.GLUTimportglutInit[as別名]
definit_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]),"CameraZupclose")
#self.glutwindow.scene.set_camera(2)
self.glutwindow.scene.resize(*window_size)
self.glutwindow.drawGL()開發者ID:purdue-biorobotics,項目名稱:flappy,代碼行數:26,代碼來源:simulation.py
示例4:__init__
▲點讚4
▼
#需要導入模塊:fromOpenGLimportGLUT[as別名]
#或者:fromOpenGL.GLUTimportglutInit[as別名]
def__init__(self):
super(HEADMODEL_UI,self).__init__()
try:
GLUT.glutInit()
exceptOpenGL.error.NullFunctionError:
pass
self.referencePoints=[None]*5
mainLayout=QtWidgets.QVBoxLayout()
#Radiobuttonsforsurfaces
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("GrayMatter")
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("CurrentPosition:")
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)開發者ID:simnibs,項目名稱:simnibs,代碼行數:46,代碼來源:head_model_OGL.py
示例5:enable_glut
▲點讚4
▼
#需要導入模塊:fromOpenGLimportGLUT[as別名]
#或者:fromOpenGL.GLUTimportglutInit[as別名]
defenable_glut(self,app=None):
"""EnableeventloopintegrationwithGLUT.
Parameters
----------
app:ignored
Ignored,it'sonlyaplaceholdertokeepthecallsignatureofall
guiactivationmethodsconsistent,whichsimplifiesthelogicof
supportingmagics.
Notes
-----
ThismethodssetsthePyOS_InputHookforGLUT,whichallowstheGLUTto
integratewithterminalbasedapplicationslikeIPython.DuetoGLUT
limitations,itiscurrentlynotpossibletostarttheeventloop
withoutfirstcreatingawindow.Youshouldthusnotcreateanother
windowbutuseinsteadthecreatedone.See'gui-glut.py'inthe
docs/examples/libdirectory.
Thedefaultscreenmodeissetto:
glut.GLUT_DOUBLE|glut.GLUT_RGBA|glut.GLUT_DEPTH
"""
importOpenGL.GLUTasglut
fromIPython.lib.inputhookglutimportglut_display_mode,\
glut_close,glut_display,\
glut_idle,inputhook_glut
ifGUI_GLUTnotinself._apps:
glut.glutInit(sys.argv)
glut.glutInitDisplayMode(glut_display_mode)
#Thisisspecifictofreeglut
ifbool(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開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:52,代碼來源:inputhook.py
注:本文中的OpenGL.GLUT.glutInit方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。
延伸文章資訊
- 1PyOpenGL · PyPI
GLUT (FreeGLUT). GLExtrusion library (libgle). GLU (normally available on any OpenGL-capable mach...
- 2PyOpenGL - Python Wiki
GLUT import * # The display() method does all the work; it has to call the appropriate # OpenGL f...
- 3pyOpenGL GLUT window function doesn't close properly
PyOpenGL uses freeglut. You have to give freeglut the chance to close the window. glutDestroyWind...
- 4python-opengl/glut-cube.py at master - GitHub
An open access book on Python, OpenGL and Scientific Visualization, Nicolas P. Rougier, 2018 - py...
- 5Python GLUT.glutInit方法代碼示例- 純淨天空
本文整理匯總了Python中OpenGL.GLUT.glutInit方法的典型用法代碼示例。如果您正苦於以下問題:Python GLUT.glutInit方法的具體用法?Python GLUT....