Sorry to ask this noob question but…
How do you activate VBO on a static obj model ?
because binaryReader returns a Node and setVBOxxx method apply to a Geometry…
I know it must be simple but i can't see it… :roll:
Thanks for answers,
bye,
Adenthar
Here's a simple class I wrote to make something like that easier. It's part of the FurBallz source:
/*
* Copyright (c) 2003, jMonkeyEngine - Mojo Monkey Coding
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of the Mojo Monkey Coding, jME, jMonkey Engine, nor the
* names of its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package com.jme.furballz.scene;
import java.util.ArrayList;
import com.jme.scene.Geometry;
import com.jme.scene.Node;
import com.jme.scene.Spatial;
/**
* <code>VBOUtil</code>
* @author Joshua Slack
* @version $Id: VBOUtil.java,v 1.4 2005/04/19 18:06:59 josh Exp $
*/
public class VBOUtil {
public static void enableVBOonTree(Spatial treeRoot) {
if (treeRoot instanceof Node) {
Node treeNode = (Node)treeRoot;
ArrayList children = treeNode.getChildren();
for (int x = children.size(); --x >= 0;) {
enableVBOonTree((Spatial)children.get(x));
}
} else if (treeRoot instanceof Geometry) {
Geometry g = (Geometry)treeRoot;
g.setVBOColorEnabled(true);
g.setVBONormalEnabled(true);
g.setVBOTextureEnabled(true);
g.setVBOVertexEnabled(true);
}
}
}
Hope that helps!
Wonderful Renanse
And another question… must we ask the renderer if it supportsVBO before applying or we can set it to true and it will not do it if it's not supported without error ?
jME will ignore VBO if it can't use it.
That's just great 8)
Thanks again Renanse.