jPCT - a 3d engine for Java > Support

Little help with GLSL shaders

(1/2) > >>

Jakes:
Hello,

I dunno if this is the correct forum for it, but if its not, can someone please point me out a good place?
I'm trying to write a shader that could simply render a scene, with multiple lights, texture, and fog.

I only want to override the factory shader that comes by default, because it only supports 8 lights, and I need a bit more, so while trying to write a shader I came across a lot of issues such as problems while using multiples light sources, fragment program with texture coord.

Can anyone help me out?

Many thanks,
Jakes

EgonOlsen:
Is this jPCT or jPCT-AE related?

Jakes:
Hello,

its jPCT (Desktop).

EgonOlsen:
In that case, I'm not sure what you mean by factory shaders. The desktop version uses the fixed function pipeline by default. You can of course write your own shader to replace it, but unlike the Android version, it doesn't provide a set of default shaders.
That said, I'm not sure what you exact question is!? You can look at the wiki for jPCT, which has some basic shader examples for desktop jPCT as well. Regarding light sources, the fixed function pipeline is limited to 8 and so is GLSL when using the magic attributes that OpenGL injects into a shader (depending on the GLSL version). If you need more, you can inject them into a GLSLShader by using the method that the class provides for adding a float array uniform. What you store in there and how you access it within your shader is up to you in that case.

Jakes:
Well, yes, I've already implemented the GLSLShader class into my scene, and hooked it up to the renderhook, it works, the thing is that I want to replace the fixed on by a custom one, in order to "emulate" more lights using per-pixel lighting. I was only trying to ask for some examples or guidance on C code for shaders as I've been searching a lot in the web lately for any and many failed.

But thanks for the tip.

Navigation

[0] Message Index

[#] Next page

Go to full version