我成功地整合了vuforia和jpct-ae。我可以下载.obj模型及其.Mtl文件和纹理文件,并使用jpct加载器进行标记检测。三维模型显示非常好的图像目标,但没有纹理(材料是罚款)。在更深入的研究中,我发现当我在Renderer类中声明纹理时,它使用的是JPCT-ae纹理,但是当我在我的主要活动类中这样做时,它将纹理作为Vuforia纹理。我试图显式地将Jpct Texture.h包含在主要活动中,但是QCAR不会初始化。不声明纹理的主要活动,我不知道如何改变/更新新的纹理(下载的图像)的实时。
基本上,我需要更新纹理使用新下载的图像动态。
有人能建议我如何解决这个问题吗?如有任何帮助或建议,我们将不胜感激。
谢谢
发布于 2013-08-13 14:13:20
我通过禁用将纹理发送给本机代码的getProductTexture()来解决歧义问题。现在,我可以在主活动和渲染活动中应用纹理。为了动态更新纹理,我使用了jpct的ReplaceTexture()。下面是代码片段(我不确定这是最好的方法,但它对我来说很好)\ try { modelstrm =(新文件(ImagePath));
texstrm = new FileInputStream(new File(TexturePath));
System.out.println("Start loading crab md2 model");
try {
System.out.println("Start loading Texture");
TextureManager tm = TextureManager.getInstance();
if(!tm.containsTexture("new_texture")){
new_texture = new Texture(BitmapHelper.rescale(BitmapHelper.loadImage(texstrm), 512, 512));
tm.addTexture("new_texture", new_texture);
}
else{
old_texture = new Texture(BitmapHelper.rescale(BitmapHelper.loadImage(texstrm), 512, 512));
tm.replaceTexture("new_texture", old_texture);
}
System.out.println("End loading Texture");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} https://stackoverflow.com/questions/18043415
复制相似问题