Python GL.glRotatef函數代碼示例- 純淨天空
文章推薦指數: 80 %
本文整理匯總了Python中OpenGL.GL.glRotatef函數的典型用法代碼示例。
如果您正苦於以下問題:Python glRotatef函數的具體用法?Python glRotatef怎麽用?
當前位置:首頁>>代碼示例>>Python>>正文
本文整理匯總了Python中OpenGL.GL.glRotatef函數的典型用法代碼示例。
如果您正苦於以下問題:PythonglRotatef函數的具體用法?PythonglRotatef怎麽用?PythonglRotatef使用的例子?那麽恭喜您,這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了glRotatef函數的15個代碼示例,這些例子默認根據受歡迎程度排序。
您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Python代碼示例。
示例1:draw_in_abs_coords
▲點讚6
▼
defdraw_in_abs_coords(self,glpane,color):
"""
Drawthehandleasahighlightedobject.
@paramglpane:The3DGraphicsarea.
@typegplane:L{GLPane}
@paramcolor:Unused.
@typecolor:
@attention:I{color}isnotused.
"""
q=self.parent.quat
glPushMatrix()
ifself.parent.center:
glTranslatef(self.parent.center[0],
self.parent.center[1],
self.parent.center[2])
ifq:
glRotatef(q.angle*ONE_RADIAN,
q.x,
q.y,
q.z)
self._draw(highlighted=True)
glPopMatrix()開發者ID:ematvey,項目名稱:NanoEngineer-1,代碼行數:26,代碼來源:ResizeHandle.py
示例2:_draw_jig
▲點讚5
▼
def_draw_jig(self,glpane,color,highlighted=False):
"""
DrawaGridPlanejigasasetofgridlines.
"""
glPushMatrix()
glTranslatef(self.center[0],self.center[1],self.center[2])
q=self.quat
glRotatef(q.angle*180.0/math.pi,q.x,q.y,q.z)
hw=self.width/2.0;hh=self.height/2.0
corners_pos=[V(-hw,hh,0.0),V(-hw,-hh,0.0),V(hw,-hh,0.0),V(hw,hh,0.0)]
ifhighlighted:
grid_color=color
else:
grid_color=self.grid_color
ifself.picked:
drawLineLoop(self.color,corners_pos)
else:
drawLineLoop(color,corners_pos)
ifself.grid_type==SQUARE_GRID:
drawGPGrid(glpane,grid_color,self.line_type,self.width,self.height,self.x_spacing,self.y_spacing,
q.unrot(self.assy.o.up),q.unrot(self.assy.o.right))
else:
drawSiCGrid(grid_color,self.line_type,self.width,self.height,
q.unrot(self.assy.o.up),q.unrot(self.assy.o.right))
glPopMatrix()開發者ID:pmetzger,項目名稱:nanoengineer,代碼行數:31,代碼來源:jigs_planes.py
示例3:drawFilledCircle
▲點讚3
▼
defdrawFilledCircle(color,center,radius,normal):
"""
Scale,rotate/translatetheunitcircleproperly.
Addedafilledcirclevariant,piotr080405
"""
glMatrixMode(GL_MODELVIEW)
glPushMatrix()
glColor3fv(color)
glDisable(GL_LIGHTING)
glTranslatef(center[0],center[1],center[2])
rQ=Q(V(0,0,1),normal)
rotAngle=rQ.angle*180.0/pi
#ThismaycauseproblemsasprovedbeforeinLinearmotordisplay.
#rotationaround(0,0,0)
#ifvlen(V(rQ.x,rQ.y,rQ.z))<0.00005:
#rQ.x=1.0
glRotatef(rotAngle,rQ.x,rQ.y,rQ.z)
glScalef(radius,radius,1.0)
glCallList(drawing_globals.filledCircleList)
glEnable(GL_LIGHTING)
glPopMatrix()
return開發者ID:ematvey,項目名稱:NanoEngineer-1,代碼行數:25,代碼來源:drawers.py
示例4:rotate
▲點讚1
▼
defrotate():
iflen(node.rotate)!=4:
forrinnode.rotate:
glRotatef(*r)
else:
glRotatef(*node.rotate)開發者ID:softtrainee,項目名稱:arlab,代碼行數:7,代碼來源:scene_graph.py
示例5:draw
▲點讚1
▼
defdraw(self,x,y,z=0,angle=0,scale=1):
"""DrawstheSVGtoscreen.
:Parameters
`x`:float
Thex-coordinateatwhichtodraw.
`y`:float
They-coordinateatwhichtodraw.
`z`:float
Thez-coordinateatwhichtodraw.Defaultsto0.Notethatz-orderingmaynot
giveexpectedresultswhentransparencyisused.
`angle`:float
Theanglebywhichtheimageshouldberotated(indegrees).Defaultsto0.
`scale`:float
Theamountbywhichtheimageshouldbescaled,eitherasafloat,oratuple
oftwofloats(xscale,yscale).
"""
glPushMatrix()
glTranslatef(x,y,z)
ifangle:
glRotatef(angle,0,0,1)
ifscale!=1:
try:
glScalef(scale[0],scale[1],1)
exceptTypeError:
glScalef(scale,scale,1)
ifself._a_xorself._a_y:
glTranslatef(-self._a_x,-self._a_y,0)
glCallList(self.disp_list)
glPopMatrix()開發者ID:Markitox,項目名稱:pymt,代碼行數:31,代碼來源:squirtle.py
示例6:on_draw
▲點讚1
▼
defon_draw(self):
"""Redrawwindow."""
self.set_3d()
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)
#rotatecamera
glRotatef(self.camera.v_angle_deg(),1.0,0,0)
glRotatef(self.camera.h_angle_deg(),0.0,1.0,0)
glTranslatef(
-self.camera.x_pos,
-self.camera.y_pos,
self.camera.z_pos)
ifself.rendering_type=="fill":
self.use_shader("test")
elifself.rendering_type=="lines":
self.use_shader("lines")
self.renderer.render()
#drawHUD
self.set_2d()
self.draw_hud()開發者ID:dvoraka,項目名稱:pygl-prototype,代碼行數:29,代碼來源:graphics.py
示例7:_draw_jig
▲點讚1
▼
def_draw_jig(self,glpane,color,highlighted=False):
"""
Drawalinearmotorasalongboxalongtheaxis,withathincylinder(spoke)toeachatom.
"""
glPushMatrix()
try:
glTranslatef(self.center[0],self.center[1],self.center[2])
q=self.quat
glRotatef(q.angle*180.0/pi,q.x,q.y,q.z)
orig_center=V(0.0,0.0,0.0)
drawbrick(color,orig_center,self.axis,
self.length,self.width,self.width,
opacity=self.opacity)
drawLinearSign((0,0,0),orig_center,self.axis,self.length,self.width,self.width)
#(note:drawLinearSignusesasmalldepthoffsetsothatarrowsareslightlyinfrontofbrick)
#[brucecomment060302,aguessfromskimmingdrawLinearSign'scode]
forainself.atoms[:]:
drawcylinder(color,orig_center,
a.posn()-self.center,
self.sradius,
opacity=self.opacity)
except:
#bruce060208protectOpenGLstackfromexceptionanalogoustothatseenforRotaryMotorinbug1445
print_compact_traceback("exceptioninLinearMotor._draw,continuing:")
glPopMatrix()開發者ID:ematvey,項目名稱:NanoEngineer-1,代碼行數:27,代碼來源:jigs_motors.py
示例8:_draw_jig
▲點讚1
▼
def_draw_jig(self,glpane,color,highlighted=False):
"""
DrawanESPImagejig(self)asaplanewithanedgeandaboundingbox.
@note:thisisnotcalledduringgraphicsMode.Draw_modelaswithmost
Jigs,butduringgraphicsMode.Draw_after_highlighting.
"""
glPushMatrix()
glTranslatef(self.center[0],self.center[1],self.center[2])
q=self.quat
glRotatef(q.angle*180.0/math.pi,q.x,q.y,q.z)
#bruce060207extensivelyrevisedtexturecoderefixingbug1059
ifself.tex_nameisnotNoneandself.image_obj:
#self.image_objcondisneeded,forclear_esp_image()towork
textureReady=True
glBindTexture(GL_TEXTURE_2D,self.tex_name)
#review:maybethisbelongsindraw_planeinstead?
self._initTextureEnv()#setstextureparamsthewaywewantthem
else:
textureReady=False
drawPlane(self.fill_color,self.width,self.width,textureReady,
self.opacity,SOLID=True,
pickCheckOnly=self.pickCheckOnly)
hw=self.width/2.0
corners_pos=[V(-hw,hw,0.0),
V(-hw,-hw,0.0),
V(hw,-hw,0.0),
V(hw,hw,0.0)]
drawLineLoop(color,corners_pos)
#DrawtheESPImagebbox.
ifself.show_esp_bbox:
wo=self.image_offset
eo=self.edge_offset
drawwirecube(color,V(0.0,0.0,0.0),V(hw+eo,hw+eo,wo),1.0)
#drawwirebox
#Thisisfordebuggingpurposes.Thisdrawsagreennormalvector
#usinglocalspacecoords.[Mark050930]
if0:
fromgraphics.drawing.CS_draw_primitivesimportdrawline
drawline(green,V(0.0,0.0,0.0),V(0.0,0.0,1.0),0,3)
glpane.kluge_reset_texture_mode_to_work_around_renderText_bug()
glPopMatrix()
#Thisisfordebuggingpurposes.Thisdrawsayellownormalvector
#usingmodelspacecoords.[Mark050930]
if0:
fromgraphics.drawing.CS_draw_primitivesimportdrawline
fromutilities.constantsimportyellow
drawline(yellow,self.center,self.center+self.planeNorm,0,3)開發者ID:elfion,項目名稱:nanoengineer,代碼行數:56,代碼來源:ESPImage.py
示例9:iniciar_renderizado
▲點讚1
▼
definiciar_renderizado(self):
"""Accionesposterioresalrenderizadodeobjetos."""
self.fbos[0].usar()
#glClearColor(*self.capa.escena.color)#0.)parafondotransparente
glClear(GL_COLOR_BUFFER_BIT)#|GL_DEPTH_BUFFER_BIT)
#Transformacióndelacámara
glLoadIdentity()
glScalef(self.acerc,self.acerc,0.)
glTranslatef(-self.pos.x,-self.pos.y,0.)
glRotatef(-self.angulo,0.,0.,1.)開發者ID:Lizard-13,項目名稱:LizardEngine,代碼行數:10,代碼來源:camara.py
示例10:calc_rotation_matrix
▲點讚1
▼
defcalc_rotation_matrix(self,x,y,z):
'''
'''
glPushMatrix()
glLoadIdentity()
forrin[[x,1,0,0],[y,0,1,0],[z,0,0,1]]:
glRotatef(*r)
m=glGetFloatv(GL_MODELVIEW_MATRIX)
glPopMatrix()
rot=[[yforj,yinenumerate(x)ifj<=2]fori,xinenumerate(m)ifi<=2]
returnm,rot開發者ID:softtrainee,項目名稱:arlab,代碼行數:12,代碼來源:scene_graph.py
示例11:draw_pin
▲點讚1
▼
defdraw_pin(self,x,y):
glPushMatrix()
glColor3f(1.0,1.0,0.0)
glTranslatef(x,0.0,-y)
glRotatef(-90,1.0,0.0,0.0)
obj=gluNewQuadric()
gluCylinder(obj,0.05,0.05,0.5,10,10)
glPushMatrix()
gluDisk(obj,0.0,0.05,10,10)
glTranslatef(0.0,0.5,0.0)
glPopMatrix()
glPopMatrix()開發者ID:smunix,項目名稱:brickv,代碼行數:12,代碼來源:imu_gl_widget.py
示例12:render
▲點讚1
▼
defrender(self):
glTranslatef(self.position.x,self.position.y,0.0)
glRotatef(self.rotation,0.0,0.0,1.0)
glScalef(self.scale.x,self.scale.y,0.0)
forchildinself._children:
glPushMatrix()
child.render()
glPopMatrix()
self.draw()開發者ID:genjix,項目名稱:random,代碼行數:13,代碼來源:Node.py
示例13:_draw_orbitals
▲點讚1
▼
def_draw_orbitals(self):
r=1.5
glPushAttrib(GL_CURRENT_BIT)
self._set_material((0,0,1))
forain[60,-60,0]:
glPushMatrix()
glRotatef(a,1,0,0)
glTranslatef(0,0,-0.25/2)
self._torus_(radius=r,inner_radius=0.15,
xs=25,ys=25
)
glPopMatrix()
glPopAttrib()開發者ID:softtrainee,項目名稱:arlab,代碼行數:14,代碼來源:components.py
示例14:draw_led
▲點讚1
▼
defdraw_led(self,x,y,color):
glPushMatrix()
ifcolor<0:
glColor3f(*self.color_led_red)
else:
glColor3f(*self.color_led_green)
glTranslatef(x,0.1,-y)
glRotatef(-90,1.0,0.0,0.0)
obj=gluNewQuadric()
gluSphere(obj,0.15,10,10)
glPopMatrix()開發者ID:smunix,項目名稱:brickv,代碼行數:14,代碼來源:imu_gl_widget.py
示例15:opgl_move_to_pose
▲點讚1
▼
defopgl_move_to_pose(self,from_fixed_frame:bool=True):
iffrom_fixed_frame:
#Resetinitview
glLoadIdentity()
#Translatetotherightposition
glTranslatef(self.pose.position[0],
self.pose.position[1],
self.pose.position[2])
#Rotatetotherightorientation
glRotatef(self.pose.orientation.get_theta(rad=False),
self.pose.orientation[1],
self.pose.orientation[2],
self.pose.orientation[3])開發者ID:sylvaus,項目名稱:quaternion-sim,代碼行數:15,代碼來源:solids.py
注:本文中的OpenGL.GL.glRotatef函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。
延伸文章資訊
- 1OpenGL中平移函数glTranslatef()、旋转函数glRotatef()的理解
void glRotatef(GLfloat angle,GLfloat x,GLfloat y,GLfloat z);. 先解释一下旋转方向,做(0,0,0)到(x,y,z)的向量,用右手握住...
- 2glrotatef(3) - Linux man page - Die.net
- 3Python GL.glRotatef函數代碼示例- 純淨天空
本文整理匯總了Python中OpenGL.GL.glRotatef函數的典型用法代碼示例。如果您正苦於以下問題:Python glRotatef函數的具體用法?Python glRotatef怎麽用?
- 4glRotate - Khronos Registry
void glRotatef(, GLfloat angle ,. GLfloat x ,. GLfloat y ,. GLfloat z ) ;. Parameters. angle. Spe...
- 5【c++】OpenGL:glRotatef旋轉什麼? - 程式人生
當我這樣呼叫 glRotatef 時: glRotatef(angle,0.0,1.0,0.0) //rotate about y-axis 我知道這是圍繞 angle 旋轉 y axis 度。...