i was trying to make a custom shader.
but i was not able to draw something on screen without any errors.
shaders and sample application are very simple.
can anybody let me know what i did mistake?
sorry for poor english and thanks!
[java]
public void simpleInitApp() {
Box b = new Box(1, 1, 1);
// b.setMode(Mesh.Mode.Lines);
Geometry geom = new Geometry(“Box”, b);
Material mat = new Material(assetManager, "MatDefs/TestMaterial1.j3md");
mat.setColor("m_Color", ColorRGBA.White);
geom.setMaterial(mat);
rootNode.attachChild(geom);
}
inPosition is set from the VertexBuffer for Type.Position. If you set a 3 element buffer then I guess it gets auto-expanded to a vec4 if you’ve declared it that way. I don’t know how it would know to put a 1 in the fourth position, though.
i knew that there was some mistakes in my code from your valuable comments.
attribute vec3 inPosition
I deleted attribute keyword because editor report that’s error. I think because that’s java editor so it cannot understand shader code.
m_Color
parameters that are declared on Material parameters are assigned to parameters which have ‘m_’ prefix + parameter name of shader.
anyway because of your comments, i was able to find my mistakes!
Thanks a lot!!
@chitoss2 said:
1. attribute vec3 inPosition
I deleted attribute keyword because editor report that's error. I think because that's java editor so it cannot understand shader code.
There’s a plugin called “GLSL Editor”. If you don’t have it installed and active, you should install and activate it.
@sgold said:
There's a plugin called "GLSL Editor". If you don't have it installed and active, you should install and activate it.
thanks for the information!
i found that GLSL editor is installed in my ide but i cannot find any option to use the editor for shader files.
can you let me know how to activate GLSL editor?
@nehon said:
Is that a new one?
It looks better than the one we have?
I don’t know actually, I only know of one GLSL-syntax plugin for netbeans, I assumed it was the same.
Related idea: Now that Khronos has released a reference GLSL compiler it would be great to include that in jME and “compile on save”. If there were only more hours in a day to do jME