当前位置: 首页>>代码示例>>Python>>正文


Python Geometry.from_OBJ方法代码示例

本文整理汇总了Python中geometry.Geometry.from_OBJ方法的典型用法代码示例。如果您正苦于以下问题:Python Geometry.from_OBJ方法的具体用法?Python Geometry.from_OBJ怎么用?Python Geometry.from_OBJ使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在geometry.Geometry的用法示例。


在下文中一共展示了Geometry.from_OBJ方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from geometry import Geometry [as 别名]
# 或者: from geometry.Geometry import from_OBJ [as 别名]
def main():
	global gl
	global test_model

	# Initialize the library
	if not glfwInit():
		sys.exit()

	# Initilize GL
	gl = pygloo.init()
	if not gl:
		sys.exit()


	# Create a windowed mode window and its OpenGL context
	window = glfwCreateWindow(640, 480, "Hello World", None, None)
	if not window:
		glfwTerminate()
		sys.exit()

	# Make the window's context current
	glfwMakeContextCurrent(window)

	# Install a input handlers
	glfwSetKeyCallback(window, on_key)
	glfwSetMouseButtonCallback(window, on_mouse)
	glfwSetCursorPosCallback(window, on_mouse_move)
	glfwSetScrollCallback(window, on_scroll)



	# Load an obj
	#
	test_model = Geometry.from_OBJ(gl, "assets/sphere.obj")


	# Loop until the user closes the window
	while not glfwWindowShouldClose(window):

		# Render
		width, height = glfwGetFramebufferSize(window)
		gl.glViewport(0, 0, width, height)

		gl.glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
		gl.glClearColor(1.0, 1.0, 1.0, 1.0) # white
		gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
		gl.glEnable(GL_DEPTH_TEST);
		# gl.glDepthFunc(GL_LESS);
		gl.glDepthFunc(GL_LEQUAL);

		# Render
		#
		render(width, height)

		# Poll for and process events
		glfwPollEvents()

		# Swap front and back buffers
		glfwSwapBuffers(window)

	glfwTerminate()
开发者ID:JJscott,项目名称:ARAP_Surface_Modelling,代码行数:63,代码来源:simple.py


注:本文中的geometry.Geometry.from_OBJ方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。