Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - rbj

#1
Hi,

I am experiencing an exception on a S5 which does not occur on another S5.

There is an older similar thread from 2015 here: Re: Object3D's transparency issue
http://www.jpct.net/forum2/index.php/topic,4232.45.html

This is the problem that occurs in a world.draw(fb) statement:
java.lang.NullPointerException: Attempt to invoke virtual method 'int com.threed.jpct.Texture.getOpenGLID(int)' on a null object reference
        at com.threed.jpct.GLRenderer.setTextures(GLRenderer.java:2534)
        at com.threed.jpct.GLRenderer.drawVertexArray(GLRenderer.java:2389)
        at com.threed.jpct.World.draw(World.java:1419)
        at com.threed.jpct.World.draw(World.java:1102)
        at com.app.app_beta.ZYGLSurfaceView$ZYGLRenderer.onDrawFrame(ZYGLSurfaceView.java:298)
        at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1649)
        at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1354)

If I look at the code in GLRenderer I wonder why there is no check for a null texture:

   private void setTextures(Object3D obj, int number, int modeNumber, FrameBuffer buffer, World world) {
        int texInd = false;
        if (obj.oneTextureSet) {
            number = 0;
        }
        Texture texture = this.texMan.textures[obj.texture[number]];
>>> CHECK FOR NULL MISSING?? <<<<
        if (texture.getOpenGLID(this.myID) == 0 || texture.getMarker(this.myID) == Texture.MARKER_DELETE_AND_UPLOAD) {

Of course the deeper question is why the texture is missing on one device and not on another.
Any tips?
#2
Hi,

I am showing several 3d objects at the same time, this works fine.
Next, some objects need to be grayed out, some should have color/texture, depending on being selected or not.
I do this by replacing the textures in the TextureManager with a Texture from gray.png file.

However, how do I find out which Textures in TextureManager belong to which Object3D?

Or is there a simpler method of not using the color and textures of a 3D object?
(All objects are read from *.3DS exports from Blender)

Hope someone can point me in the right direction...

Robert
#3
AH, good to know, thanks.

From what I read the DAE/Collada import is not supported for jpct-ae, right?
#4
Hi all!

I am importing *.3ds files from Blender to JPCT-AE
Using the code below to get the textures names I see that the textures can not be loaded because the filenames are truncated:
-> Texture file not found: alienmat1.jp
-> Texture file not found: flagtexture.
These should be alienmat1.jpg and flagtexture.jpg
The names are truncated at 12 characters (old DOS 8.3 file names?)

Code:
        private void checkTextures() {
            int texCnt = TextureManager.getInstance().getTextureCount();
            Log.d(TAG, ">> Have " + texCnt + " textures");
            if (texCnt > 0) {
                Set<String> texNames = TextureManager.getInstance().getNames();
                Iterator itr = texNames.iterator();
                while (itr.hasNext()) {
                    String tex = itr.next().toString();
                    Log.d(TAG, "Texture " + tex);
                    try {
                        TextureManager.getInstance().replaceTexture(tex, new Texture(mContext.getAssets().open(tex.toLowerCase())));
                    } catch (java.io.FileNotFoundException e ) {
                        Log.d(TAG,"-> Texture file not found: "+tex);
                    } catch (java.io.IOException e) {
                        e.printStackTrace();
                    }
                }
            }
        }

Why? Anyone also experiencing this?

Robert