LWJGL_OPENGL1 and shading (jME3)


is there a way to turn on flat or smooth shading when forcing the renderer to OpenGL 1.1 (like “glShadeModel(GL_SMOOTH)”, fixed function pipeline)? Which material definition do I have to use? I tried unshaded and lighting, but in all cases, the mesh was rendered with a single color with no shading (no matter if material color / diffuse or vertex color).

Is the jME 3 OpenGL 1.1 renderer capable of shading meshes? Even today, there are many netbooks with poor or missing OpenGL 2 implementation.



No its not, its planned though and you can add your own fixed func bindings for OpenGL1 to shaders. Generally, OpenGL 1 support is very low on the todo list for us, in fact its only netbooks nowadays, even phones have proper OpenGL2 implementations.

you can add your own fixed func bindings for OpenGL1 to shaders

The problem is, the linking fails on those devices, since they don’t have programmable shaders. Or did I get you wrong?

Its a fixed func binding… :roll: So the engine binds the shader call to a fixed function from OpenGL1.

Hmm, then why is the mesh rendered in a single color? Afaik GL_SMOOTH is the default shading model. It seems the fixed function is fed with the same angle to the light source (1.0) for all vertices.

Yes. As said its not fully implemented. Its just displaying something on OpenGL1 devices. jME3 was never meant to run on these devices and if the opengl1 support was fully working it would not be on the todo list xD

Got it, thanks!

Did I mention that I like open source? :slight_smile:

I’d like to contribute my improvements to the OpenGL 1.1 renderer. Is that possible / desired?


Yes sure, depending on the size of the changes, you can post patches in the Contributions forum in [patch][/patch] tags.

Yes please do. I assume you implemented the LwjglGL1Renderer.setLighting() method?

Yes, but I think it is also necessary to extend FixedFunctionBinding by something like “UseVertexColors” and some of the MatDefs by “(UseVertexColors)”, respectively.

BTW, is the implementation of Unshaded.frag really correct when enabling VertexColor?

For example:

vertColor = red = (1, 0, 0, 1)

m_Color = green = (0, 1, 0, 1)

The resulting color is black: (1, 1, 1, 1) * (1, 0, 0, 1) * (0, 1, 0, 1) = (0, 0, 0, 1)

Yes it is correct.

The only matdef that uses material colors (and thus lighting) is Lighting.j3md so only that one really needs it. The rest just use the color or texture parameter

=> http://hub.jmonkeyengine.org/groups/contribution-depot-jme3/forum/topic/opengl-1-1-renderer-lwjglgl1renderer/