小编Sta*_* S.的帖子

如何从Superbible Opengl中读取,解析SBM文件格式

呼吁专家,专家和其他人来帮助阅读和解析python文件。

在第六版的第751页。或第7版第800页。Superbible OpenGL的附录B。SBM文件格式似乎在某种程度上很好地解释了该格式。

我试图在python中实现此文件格式的阅读器。

好的,已经取得了进展。我已经将Rabbid76惊人的代码合并到提供的源代码中。尽管我正在尝试取得更多进展。

更新Jun 23,2019-主要进展,修复了关于glVertexAttribPointer(i,...的错误。

当天,修复了Python无法找到变量第一个错误。

当天,成功!!!我们有渲染的东西!这是最终的程序sbmloader.py,它读取,解析由此问题创建的SBM文件格式。

虽然下一个问题。在第2部分中已经回答了,创建ktxloader

  • 如何使渲染的对象显示为应该是的圆环/圆环?也许与在此处加载文件有关 。pattern1.ktx 如何将其加载到变量tex_object变量?简单地分配它似乎没有任何作用。好的,这是因为ktx文件是另一个项目使用的其他文件格式。

更新:2019年6月24日Rabbid76已使用完美代码修复了渲染问题。我震惊,非常感谢!

要读取,解析的数据在这里torus_nrms_tc.sbm

任何帮助,评论或见解将不胜感激。这是我到目前为止所拥有的。

import sys
import time 
import os
import time
import math
import ctypes

currentWDir = os.getcwd()
print( 'current working directory: {}'.format( str(currentWDir) ) )
fileDir = os.path.dirname(os.path.abspath(__file__)) # det the directory of this file
print( 'current location of self: {}'.format( str(fileDir) ) )
parentDir = os.path.abspath(os.path.join(fileDir, os.pardir)) # get the parent directory of this file …
Run Code Online (Sandbox Code Playgroud)

python opengl glut fileparsing python-3.x

3
推荐指数
1
解决办法
1794
查看次数

标签 统计

fileparsing ×1

glut ×1

opengl ×1

python ×1

python-3.x ×1