Newcomer, code won't work

When I try to run this code, I get a blank screen then it just closes…not even showing my box.

[java]

package mygame;



import com.jme3.app.SimpleApplication;

import com.jme3.material.Material;

import com.jme3.math.ColorRGBA;

import com.jme3.math.Vector3f;

import com.jme3.renderer.RenderManager;

import com.jme3.scene.Geometry;

import com.jme3.scene.shape.Box;

import com.jme3.scene.Node;



/**

  • test
  • @author normenhansen

    */

    public class Main extends SimpleApplication {



    public static void main(String[] args) {

    Main app = new Main();

    app.start();

    }



    @Override

    public void simpleInitApp() {

    Box box1 = new Box(new Vector3f(1f, 1f, -5f), 1, 1, 1);

    Geometry blue = new Geometry("Box", box1);

    Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");

    mat1.setColor("m_color", ColorRGBA.Blue);

    blue.setMaterial(mat1);



    Node boxes = new Node("boxes");

    rootNode.attachChild(boxes);



    boxes.attachChild(blue);

    boxes.rotate(0.4f, 0.4f, 0.0f);



    }

    }



    [/java]



    wth is wrong here? O_o

Whats the output of the application? Also, there is no parameter “m_color”, maybe you mean “m_Color”?

Application:


Running on jMonkey Engine 3 Alpha 0.6
Extraction Directory #1: file:/C:/Program%20Files/jmonkeyplatform/jmonkeyplatform/modules/ext/
Extraction Directory #2: C:Usersf0ppl2.jmonkeyplatform
Extraction Directory #3: C:Program Filesjmonkeyplatform
DesktopAssetManager created.
Valid jMP project, extending with ProjectAssetManager
DesktopAssetManager created.
Add locator:C:/Users/f0ppl2/Documents/jMonkeyProjects/BasicGame/assets/
EDT: Creating OGL thread.
Using LWJGL 2.5
Display created.
Adapter: nvd3dum
Driver Version: 8.17.12.6658
Vendor: NVIDIA Corporation
OpenGL Version: 3.3.0
Renderer: GeForce 9800 GT/PCI/SSE2
GLSL Ver: 3.30 NVIDIA via Cg compiler
Timer resolution: 1000 ticks per second
Caps: [FrameBuffer, FrameBufferMRT, FrameBufferMultisample, OpenGL20, OpenGL21, OpenGL30, ARBprogram, GLSL100, GLSL110, GLSL120, GLSL130, GLSL140, GLSL150, VertexTextureFetch, TextureArray, TextureBuffer, FloatTexture, FloatColorBuffer, FloatDepthBuffer, PackedFloatTexture, SharedExponentTexture, PackedFloatColorBuffer, TextureCompressionLATC, MeshInstancing, VertexBufferArray]
DesktopAssetManager created.
Camera created (W: 640, H: 480)
Camera created (W: 640, H: 480)
Mouse created.
Keyboard created.
Audio effect extension version: 1.0
Audio max auxilary sends: 2
Camera created (W: 120, H: 120)
Loaded material definition: Default GUI
Child (BitmapFont) attached to this node (Stats Gui Node)
Child (BitmapFont) attached to this node (Statistics View)
Child (BitmapFont) attached to this node (Statistics View)
Child (BitmapFont) attached to this node (Statistics View)
Child (BitmapFont) attached to this node (Statistics View)
Child (BitmapFont) attached to this node (Statistics View)
Child (BitmapFont) attached to this node (Statistics View)
Child (BitmapFont) attached to this node (Statistics View)
Child (BitmapFont) attached to this node (Statistics View)
Child (BitmapFont) attached to this node (Statistics View)
Child (BitmapFont) attached to this node (Statistics View)
Child (BitmapFont) attached to this node (Statistics View)
Child (BitmapFont) attached to this node (Statistics View)
Child (BitmapFont) attached to this node (Statistics View)
Child (Statistics View) attached to this node (Stats Gui Node)
Loaded material definition: Wire Color
All children removed.
All children removed.
Child (Welcome Screen) attached to this node (Root Node)
Loaded material definition: Sky Plane
Texture2D
Child (Sky) attached to this node (Welcome Screen)
Child (defCamNodeName) attached to this node (Welcome Screen)
Loaded material definition: GroundFromSpace
Loaded material definition: SkyFromSpace
Loaded material definition: GroundFromAtmosphere
Loaded material definition: SkyFromAtmosphere
Loaded material definition: Solid Color
Child (Sphere-ogremesh) attached to this node (Welcome Screen)
Child (Sphere-ogremesh) attached to this node (Welcome Screen)
Loaded material definition: Default GUI
Loaded material definition: Default GUI
Uniform fInnerRadius2 is not declared in shader.
Uniform g_NormalMatrix is not declared in shader.
Uniform m_SphereMap is not declared in shader.
Uniform g_NormalMatrix is not declared in shader.
Uniform fInnerRadius2 is not declared in shader.
Uniform fCameraHeight is not declared in shader.
Uniform g_NormalMatrix is not declared in shader.
Valid jMP project, extending with ProjectAssetManager
DesktopAssetManager created.
Add locator:C:/java/Game/assets/
Checking extension..
No assets-impl.xml found
Creating assets-impl.xml
Creating extension assets


and under BasicGame Template

init:
Deleting: C:javaGamebuildbuilt-jar.properties
deps-jar:
Updating property file: C:javaGamebuildbuilt-jar.properties
compile:
run:
Feb 23, 2011 12:01:14 PM com.jme3.system.JmeSystem initialize
INFO: Running on jMonkey Engine 3 Alpha 0.6
Feb 23, 2011 12:01:14 PM com.jme3.system.Natives extractNativeLibs
INFO: Extraction Directory #1: file:/C:/Program%20Files/jmonkeyplatform/jmonkeyplatform/libs/
Feb 23, 2011 12:01:14 PM com.jme3.system.Natives extractNativeLibs
INFO: Extraction Directory #2: C:javaGame
Feb 23, 2011 12:01:14 PM com.jme3.system.Natives extractNativeLibs
INFO: Extraction Directory #3: C:javaGame
Feb 23, 2011 12:01:14 PM com.jme3.system.lwjgl.LwjglAbstractDisplay run
INFO: Using LWJGL 2.5
Feb 23, 2011 12:01:14 PM com.jme3.system.lwjgl.LwjglDisplay createContext
INFO: Selected display mode: 640 x 480 x 0 @0Hz
Feb 23, 2011 12:01:14 PM com.jme3.system.lwjgl.LwjglAbstractDisplay initInThread
INFO: Display created.
Feb 23, 2011 12:01:14 PM com.jme3.system.lwjgl.LwjglAbstractDisplay initInThread
INFO: Adapter: nvd3dum
Feb 23, 2011 12:01:14 PM com.jme3.system.lwjgl.LwjglAbstractDisplay initInThread
INFO: Driver Version: 8.17.12.6658
Feb 23, 2011 12:01:14 PM com.jme3.system.lwjgl.LwjglAbstractDisplay initInThread
INFO: Vendor: NVIDIA Corporation
Feb 23, 2011 12:01:14 PM com.jme3.system.lwjgl.LwjglAbstractDisplay initInThread
INFO: OpenGL Version: 3.3.0
Feb 23, 2011 12:01:14 PM com.jme3.system.lwjgl.LwjglAbstractDisplay initInThread
INFO: Renderer: GeForce 9800 GT/PCI/SSE2
Feb 23, 2011 12:01:14 PM com.jme3.system.lwjgl.LwjglAbstractDisplay initInThread
INFO: GLSL Ver: 3.30 NVIDIA via Cg compiler
Feb 23, 2011 12:01:14 PM com.jme3.system.lwjgl.LwjglTimer
INFO: Timer resolution: 1000 ticks per second
Feb 23, 2011 12:01:14 PM com.jme3.renderer.lwjgl.LwjglRenderer initialize
INFO: Caps: [FrameBuffer, FrameBufferMRT, FrameBufferMultisample, OpenGL20, OpenGL21, OpenGL30, ARBprogram, GLSL100, GLSL110, GLSL120, GLSL130, GLSL140, GLSL150, VertexTextureFetch, TextureArray, TextureBuffer, FloatTexture, FloatColorBuffer, FloatDepthBuffer, PackedFloatTexture, SharedExponentTexture, PackedFloatColorBuffer, TextureCompressionLATC, MeshInstancing, VertexBufferArray]
Feb 23, 2011 12:01:14 PM com.jme3.asset.DesktopAssetManager
INFO: DesktopAssetManager created.
Feb 23, 2011 12:01:14 PM com.jme3.renderer.Camera
INFO: Camera created (W: 640, H: 480)
Feb 23, 2011 12:01:14 PM com.jme3.renderer.Camera
INFO: Camera created (W: 640, H: 480)
Feb 23, 2011 12:01:14 PM com.jme3.input.lwjgl.LwjglMouseInput initialize
INFO: Mouse created.
Feb 23, 2011 12:01:14 PM com.jme3.input.lwjgl.LwjglKeyInput initialize
INFO: Keyboard created.
Feb 23, 2011 12:01:14 PM com.jme3.audio.lwjgl.LwjglAudioRenderer initialize
INFO: Audio effect extension version: 1.0
Feb 23, 2011 12:01:14 PM com.jme3.audio.lwjgl.LwjglAudioRenderer initialize
INFO: Audio max auxilary sends: 2
Feb 23, 2011 12:01:14 PM com.jme3.material.MaterialDef
INFO: Loaded material definition: Default GUI
Feb 23, 2011 12:01:14 PM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (Gui Node)
Feb 23, 2011 12:01:14 PM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (Statistics View)
Feb 23, 2011 12:01:14 PM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (Statistics View)
Feb 23, 2011 12:01:14 PM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (Statistics View)
Feb 23, 2011 12:01:14 PM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (Statistics View)
Feb 23, 2011 12:01:14 PM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (Statistics View)
Feb 23, 2011 12:01:14 PM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (Statistics View)
Feb 23, 2011 12:01:14 PM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (Statistics View)
Feb 23, 2011 12:01:14 PM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (Statistics View)
Feb 23, 2011 12:01:14 PM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (Statistics View)
Feb 23, 2011 12:01:14 PM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (Statistics View)
Feb 23, 2011 12:01:14 PM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (Statistics View)
Feb 23, 2011 12:01:14 PM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (Statistics View)
Feb 23, 2011 12:01:14 PM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (Statistics View)
Feb 23, 2011 12:01:14 PM com.jme3.scene.Node attachChild
INFO: Child (Statistics View) attached to this node (Gui Node)
Feb 23, 2011 12:01:14 PM com.jme3.material.MaterialDef
INFO: Loaded material definition: Solid Color
Feb 23, 2011 12:01:14 PM com.jme3.app.Application handleError
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.IllegalArgumentException: Material parameter is not defined: m_color
at com.jme3.material.Material.checkSetParam(Material.java:250)
at com.jme3.material.Material.setParam(Material.java:265)
at com.jme3.material.Material.setColor(Material.java:366)
at mygame.Main.simpleInitApp(Main.java:28)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:186)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:134)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:183)
at java.lang.Thread.run(Thread.java:662)
BUILD SUCCESSFUL (total time: 3 seconds)

Yeah, what I said:

java.lang.IllegalArgumentException: Material parameter is not defined: m_color
normen said:
Also, there is no parameter "m_color", maybe you mean "m_Color"?


lol that's it. Thanks man. :p

Hey I have one more question. I have access to 3dsmax for models and I was wondering if this will be an issue or can I load models from 3ds as easily as blender?



If so, what is the method for 3ds max to JMonkey?

There is an Ogre XML exporter for 3DS Max available on their official page: http://www.ogre3d.org/tikiwiki/OGRE+Exporters

I have only tried it with Blender but I guess it should work well with 3DS Max too.

Thanks…I hope this thing works. I am familiar with 3dsMax so blender will be a pain to learn w/ all those 50 million shortcut keys. D:

Do I export the models as .obj or .scene?