Buffer Underflow when adding Child

its alot of code - so I have tried to be relevant

here goes:

this is my Loop :


Global BranchGroup : TOPGUESTTRANSFORM

run (){
try {

			while (isthreadAlive) {
			//System.out.println(String.valueOf((Runtime.getRuntime().maxMemory()-Runtime.getRuntime().freeMemory())/1000));
				startTime = System.currentTimeMillis();
                                                                                     currentTime = System.currentTimeMillis();
				fps++;
				if (currentTime - lastTime >= 500) {
					framePerSec=fps << 1;
					if (!fullScreen) {
						parentFrame.setTitle("BreedaMorph Demo: FPS "+ String.valueOf(framePerSec));
						lastTime = currentTime;
						fps = 0;
					}
				}
				
				
				processMessageQue();
				processAnimations();
				translateAnyMoves();
				processKeyPostRequests();
	                                    doAvatarTerrainFollowing();
				doCameraTerrainFollowing();
				avController.update(view)
                                                          doMove(new Vector3f(0, height, distance));
				setCameraDistances()
                                           collisionFrames=doCollisionChecking(collisionFrames);
		doCameraCollisionChecking();
				moveSea(0.0003f,new Vector3f(0.0f,0.00002f,0.0f));
				doPingIfRequired();
				
				view.renderOnce();
			
				//if(isThreadIdle()) {throw new IOException();}
				
				
				
				

				timeTaken = System.currentTimeMillis() - startTime;
				if (timeTaken < MILLIS_PER_TICK) {
					synchronized (this) {
                        
						wait((int)MILLIS_PER_TICK - timeTaken);

					}
				} else {
					currentThread.yield();
				}
				
			}// end while loop
		} catch (java.nio.BufferUnderflowException ioe){}
}

method processMessageQue() looks at a Queue of instructions and calls the necessary function
so if there is a addNewPlayer() instruction - this function is run:



public void addNewPlayer(String name, String ipAddress,Vector3f positionVector) {
		MD2ModelInstance playerHead;
		MD2ModelInstance playerBody;
		MD2ModelInstance playerShell;
		TransformGroup t = new TransformGroup();

		
		newMD2Object md22 = new newMD2Object(1.0f,t);
		md22.loadModel("characters/head.md2","characters/headtex.pcx");
		playerHead=md22.getInstance();
				
		newMD2Object md23 = new newMD2Object(1.0f,t);
		md23.loadModel("characters/shell.md2","characters/shelltex.pcx");
		playerShell=md23.getInstance();
		
		setPolygonAttributes(t,true,PolygonAttributes.POLYGON_FILL,PolygonAttributes.CULL_BACK);
			
		newMD2Object md21 = new newMD2Object(3.5f,t);
		md21.loadModel("characters/body.md2","characters/bodytex.pcx");
		playerBody=md21.getInstance();
		
		t.addChild(new Text2d(name));
		
		t.getTransform().setTranslation(positionVector);		
		playerObject p = new playerObject(t, ipAddress,name,playerHead,playerBody,playerShell);
		otherPlayers.addElement(p);   // vector of all other players
		TOPGUESTTRANSFORM.addChild(t);
	}

now using the same instruction Queue - if there are any positional updates:



public void updatePlayerPositions(TransformGroup playerTransformGroup, String MatrixString)
	{
		
		
		java.util.List nodes = TOPGUESTTRANSFORM.getChildren();
		Matrix4f p =new Matrix4f();
		String[] MatrixArray  = MatrixString.split(",");
		
			p.setRow(0,toFloat(MatrixArray[0]),toFloat(MatrixArray[1]),toFloat(MatrixArray[2]),toFloat(MatrixArray[3]));
			p.setRow(1,toFloat(MatrixArray[4]),toFloat(MatrixArray[5]),toFloat(MatrixArray[6]),toFloat(MatrixArray[7]));
			p.setRow(2,toFloat(MatrixArray[8]),toFloat(MatrixArray[9]),toFloat(MatrixArray[10]),toFloat(MatrixArray[11]));
			p.setRow(3,toFloat(MatrixArray[12]),toFloat(MatrixArray[13]),toFloat(MatrixArray[14]),toFloat(MatrixArray[15]));

		for (int i = 0; i < nodes.size(); i++) {
			SceneGraphObject obj = (SceneGraphObject) nodes.get(i);
			if (obj instanceof TransformGroup) {
				String objName=((TransformGroup)obj).getName();
				String playerName=playerTransformGroup.getName();
				if(objName.equals(playerName))
				{
					
					Transform3D j = new Transform3D();
					j=((TransformGroup)obj).getTransform();
					j.set(p);

                                              ///############here is where I get the Buffer underflow exception##############
					((TransformGroup)obj).setTransform(j);
                                              //####################################################
					
					break;
				}
			}
		}
	
		
	}

aside from the sloppy code
any ideas why i would still be getting Buffer Under Flow exception?

[quote]any ideas why i would still be getting Buffer Under Flow exception?
[/quote]
nope - you don’t modify the scenegraph while rendering. :frowning:

You sure it’s called from the render thread? - maybe you’ve just forgotten to comment something out and it gets called also from some AWT-event-thread? If you are using Eclipse, you can make it show you the methods that call your updatePlayerPositions-method.

No - have tried this also - the instruction is definately being called only once and from the rendering thread

The funny thing is that I tried this app on an older version of XITH and I didn’t get the error
it worked fine.

strange

are you using the latest cvs?

yep am using:

Parent Directory 24-Sep-2005 10:38 -
Xith3D_2005-08-31_cv…> 31-Aug-2005 05:23 4.1M
third-party.tar.gz 24-Sep-2005 10:39 5.6M

this is now very strange indeed :frowning: I’m at end with my wisdom :’(