簡體   English   中英

將jpct-ae與vuforia集成時的紋理歧義

[英]Texture ambiguty when integrating jpct-ae with vuforia

我成功整合了vuforia和jpct-ae。 我可以下載帶有.Mtl文件和紋理文件的.obj模型,並在進行標記檢測時使用jpct-ae加載程序加載它。 3D模型在圖像目標上顯示得很好,但沒有紋理(材質很好)。 在進行更多挖掘時,我發現在Renderer類中聲明紋理時,它將作為JPCT-ae Texture,而在我的Main Activity類中進行聲明時,它將Texture作為Vuforia紋理。 我試圖在Main活動中明確包含Jpct-ae Texture.h,但是QCAR無法初始化。 沒有在主要活動中聲明紋理,我不知道如何實時更改/更新新紋理(下載的圖像)。

基本上,我需要使用新下載的圖像來動態更新紋理。

有人可以建議我如何解決這個問題嗎? 任何幫助或建議,表示贊賞。

謝謝

我通過禁用將紋理發送到本機代碼的getProductTexture()解決了歧義問題。 現在,我可以在主活動以及渲染活動中應用紋理。 為了動態更新紋理,我使用了jpct-ae的ReplaceTexture()。 以下是代碼段(我不確定這是否是最好的方法,但是對我來說效果很好)\\試試{modelstrm = new FileInputStream(new File(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();
            }    

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM