Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3509 Members - Latest Member: lioneltenel

26. May 2012, 09:06:39 pm
Xith3D CommunityGeneral CategorySupport (Moderator: Marvin Fröhlich)Weird error
Pages: [1]
Print
Author Topic: Weird error  (Read 1852 times)
'n ddrylliog
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« on: 26. March 2007, 05:44:31 pm »

Hi,

Stack trace :
Code:
Exception in thread "main" java.lang.Error: No coordinates defined!
at org.xith3d.scenegraph.GeomContainer.setNioBuffers(GeomContainer.java:249)
at org.xith3d.scenegraph.GeomContainer.setDataBuffers(GeomContainer.java:340)
at org.xith3d.scenegraph.GeomContainer.<init>(GeomContainer.java:132)
at org.xith3d.scenegraph.GeometryArray.<init>(GeometryArray.java:171)
at org.xith3d.scenegraph.GeomIndexedContainer.<init>(GeomIndexedContainer.java:70)
at org.xith3d.scenegraph.IndexedGeometryArray.<init>(IndexedGeometryArray.java:50)
at org.xith3d.scenegraph.IndexedQuadArray.<init>(IndexedQuadArray.java:49)
at org.collada.xith3d.COLLADALoader.loadGeom(COLLADALoader.java:352)
at org.collada.xith3d.COLLADALoader.loadLibraryGeometries(COLLADALoader.java:175)
at org.collada.xith3d.COLLADALoader.load(COLLADALoader.java:138)
at org.collada.xith3d.COLLADALoader.load(COLLADALoader.java:80)
at DAE_Blender.<init>(DAE_Blender.java:19)
at DAE_Blender.main(DAE_Blender.java:12)

And here's the code :

COLLADALoader.java :
Code:
/*
         * Build a Xith3D Shape3D
         */
       
        // First the flags :)
        int vertexFormat = 0;
        // VERTICES
        if(vertexOffset != -1) {
            vertexFormat &= GeometryArray.COORDINATES;
        } else {
            throw new Error("Huh.. we have no vertices.. Everything's fine ? I think Spock has lost his mind.." +
                        " Anyway one thing's sure, your COLLADA file has a problem :)");
        }
        // NORMALS
        if(normalOffset != -1) {
            vertexFormat &= GeometryArray.NORMALS;
        }
       
        GeometryArray geometry = null;
       
        if(verticesPerPrimitive == 3) {
            geometry = new IndexedTriangleArray(vertexCount, vertexFormat, indexCount);
        } else if(verticesPerPrimitive == 4) {
            geometry = new IndexedQuadArray(vertexCount, vertexFormat, indexCount); // --> Line 352
        } else {
            throw new Error("Unsupported vertex count per primitive : "+verticesPerPrimitive);
        }
       
        if(vertexOffset != -1) {
            geometry.setCoordinates(0, vertices);
        }
       
        if(normalOffset != -1) {
            geometry.setNormals(0, normals);
        }
       
        Shape3D shape = new Shape3D(geometry);
       
        return shape;

(Note : COLLADALoader isn't in SVN).

Thanks in advance, Marvin (or another one),

Amos
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #1 on: 26. March 2007, 06:35:20 pm »

What effective value does you "vertexFormat" variable have in teh end?

Why the hell do you want to use IndexedQuadArray?

Marvin
Logged
'n ddrylliog
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #2 on: 27. March 2007, 04:38:17 pm »

What effective value does you "vertexFormat" variable have in teh end?
Knowing that vertexOffset != -1 and that normalOffset != -1, the value of vertexFormat certainly is GeometryArray.COORDINATES & GeometryArray.NORMALS.

Why the hell do you want to use IndexedQuadArray?
Because COLLADA can describe quad primitives with indices. Smiley

But don't worry I just figured out I'm stupid, it should be "¦=", not "&="  Grin
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #3 on: 27. March 2007, 05:28:37 pm »

Why the hell do you want to use IndexedQuadArray?
Because COLLADA can describe quad primitives with indices. Smiley

Well, they should anyway be converted into IndexedTriangle(Strip)Arrays to improve performance. Don't you agree?

But don't worry I just figured out I'm stupid, it should be "¦=", not "&="  Grin

Indeed Grin

Marvin
Logged
'n ddrylliog
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #4 on: 27. March 2007, 07:34:42 pm »

Why the hell do you want to use IndexedQuadArray?
Because COLLADA can describe quad primitives with indices. Smiley

Well, they should anyway be converted into IndexedTriangle(Strip)Arrays to improve performance. Don't you agree?
Convert Quads to Triangles ? Why, that's an idea, but it needs some coding (time) and I have not much to spare Smiley And for strips it's worse..  Grin
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #5 on: 27. March 2007, 07:54:20 pm »

Convert Quads to Triangles ? Why, that's an idea, but it needs some coding (time) and I have not much to spare Smiley And for strips it's worse..  Grin

OK, not enough time is a point. But as far as I know, Triangels are faster than Quads and TriangeStrips are faster than QuadStrips and TriangleStrips are faster than Triangles. Even though I never understand, why Triangles should be slower than Quads. The driver (or even the card) could very easily handle a quad like two triangles. And a quad means less vertex data than two triangles. Of course for TriangleStrips, it's the same amount of vertex data.

Marvin
Logged
'n ddrylliog
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #6 on: 28. March 2007, 05:20:16 pm »

OK doing indexed geometry seems to tricky for that. For now I just use TriangleArray. When everything's workin' we can think about optimizing Smiley
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #7 on: 28. March 2007, 09:37:26 pm »

OK doing indexed geometry seems to tricky for that.

Why is indexed geoemtry even used? It is only useful for geoemtry, where you want to only render parts of it at a time. Is this the case for your collada models?

For now I just use TriangleArray. When everything's workin' we can think about optimizing Smiley

OK.

Marvin
Logged
'n ddrylliog
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #8 on: 29. March 2007, 03:33:55 pm »

OK doing indexed geometry seems to tricky for that.

Why is indexed geoemtry even used? It is only useful for geoemtry, where you want to only render parts of it at a time. Is this the case for your collada models?
Think about it. It allows a much more efficient storage, since vertex data isn't repeated. However I "un-index" ("expand") this data at loading time, for computations and rendering efficiency.
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #9 on: 29. March 2007, 04:18:23 pm »

Think about it. It allows a much more efficient storage, since vertex data isn't repeated. However I "un-index" ("expand") this data at loading time, for computations and rendering efficiency.

Think about it... hehe Smiley. OK, then I will think about it....

My results:
AFAIK, IndexedXXX works the following way: You have a regular list of vertices, color data, etc. Aditionally you have a list of the same length with boolean information about "is the vertex with the index to be rendered or not". So if you don't "use" this aditional information of the index-boolean-list, it is just a waste of memory and especially bus traffic. Note, that an indexed geometry cannot be rendered with only one or two parameters to the opengl call, but the whole index-boolean-list has to be passed.

Please correct me, if I'm wrong.

Marvin
Logged
'n ddrylliog
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #10 on: 29. March 2007, 04:57:15 pm »

Well here's how I learnt IndexedXXX works :

You have a list of vertices, color data, etc.. and a list of vertex indices, which defines in which order the vertices in the previously cited list makes triangles/quads/Npolys.

See ?

E.g. for a cube in a QuadArray you would have 6 * 4 = 24 vertices yet for an IndexedQuadArray you would have 8 vertices (one for each corner) and 24 indices. Well that's not the best example of memory saving but I let you see the advantage.
Logged
rasput
Just dropped in

Offline Offline

Posts: 14


dont risk STDs, use teh force


View Profile WWW Email
« Reply #11 on: 09. April 2007, 05:05:43 pm »

the memory footprint keeps increasing in my xith3d app, i ran the demo apps... same problem Cry My app will only run for a minute before it starts to lag severely due to memory. I am using the newest beta2, do i need to switch to the SVN?
Logged

not dead, not alive... somewhere blissfully inbetween
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #12 on: 09. April 2007, 06:16:58 pm »

the memory footprint keeps increasing in my xith3d app, i ran the demo apps... same problem Cry My app will only run for a minute before it starts to lag severely due to memory. I am using the newest beta2, do i need to switch to the SVN?

Well, at least it would not harm to run your tests with the SVN trunk. And there's a cooker release, which is a little newer.

Marvin
Logged
'n ddrylliog
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #13 on: 16. April 2007, 05:25:04 pm »

@rasput : yeah, If you can, switch to SVN
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic