LibGDX从模型生成png

时间:2018-12-27 02:34:11

标签: libgdx

标题几乎说明了一切,我需要从'StructField' object has no attribute '_get_object_id' Traceback (most recent call last): File "/usr/lib/spark/python/lib/pyspark.zip/pyspark/mllib/evaluation.py", line 52, in __init__ StructField("label", DoubleType(), nullable=False)])) File "/usr/lib/spark/python/lib/pyspark.zip/pyspark/sql/context.py", line 302, in createDataFramereturn self.sparkSession.createDataFrame(data, schema, samplingRatio, verifySchema) File "/usr/lib/spark/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py", line 1248, in __call__args_command, temp_args = self._build_args(*args) File "/usr/lib/spark/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py", line 1212, in _build_args (new_args, temp_args) = self._get_args(args) File "/usr/lib/spark/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py", line 1199, in _get_args temp_arg converter.convert(arg,self.gateway_client) File "/usr/lib/spark/python/lib/py4j-0.1 src.zip/py4j/java_collections.py", line 501, in convert java_list.add(element) File "/usr/lib/spark/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py", line 1248, in __call__args_command, temp_args = self._build_args(*args) File "/usr/lib/spark/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py", line 1218, in _build_args [get_command_part(arg, self.pool) for arg in new_args]) File "/usr/lib/spark/python/lib/py4j-0.10.7-src.zip/py4j/protocol.py", line 298, in get_command_part command_part = REFERENCE_TYPE + parameter._get_object_id() AttributeError: 'StructField' object has no attribute '_get_object_id' 获取图片吗?我搜索了此内容,却一无所获。

感谢@retodaredevil解决方案

Model

1 个答案:

答案 0 :(得分:1)

据我了解,我们将不得不使用两个不同的教程

https://github.com/mattdesl/lwjgl-basics/wiki/FrameBufferObjects

https://xoppa.github.io/blog/basic-3d-using-libgdx/(您可能已经对此很熟悉)

FrameBuffer fbo = new FrameBuffer(Pixmap.Format.RGBA4444, width, height, hasDepth);
// I've never used a FrameBuffer before so you may have to play around with constructor parameters

ModelBatch batch = // your ModelBatch initialization here

fbo.begin(); // make fbo the current buffer
glClearColor(0f, 0f, 0f, 1f);
glClear(GL_COLOR_BUFFER_BIT);
batch.resize(fbo.getWidth(), fbo.getHeight());

batch.begin();
batch.render(modelInstance, environment);
batch.end();

fbo.end(); // Now you can draw on the display again

// If you want to, you can resize your batch and use it to draw on the display
batch.resize(Display.getWidth(), Display.getHeight());

一旦对FrameBuffer做任何必要的操作,就可以得到纹理

fbo.getTexture();

编辑:该方法不存在,请查看OP的问题以寻求解决方案 编辑2:FrameBuffer实际上有一个名为getColorBufferTexture()的方法

要保存纹理,请查看https://www.badlogicgames.com/forum/viewtopic.php?p=8358#p8358https://www.badlogicgames.com/forum/viewtopic.php?t=5686

我用它来获得链接之一:Libgdx save SpriteBatch in a texture我掉队的其他一切

如果某事不起作用,请告诉我,我可以尝试环顾四周。