本文整理汇总了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()