[Implemented] setting shader variables inside PB-program

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
DarkDragon
Addict
Addict
Posts: 2344
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

[Implemented] setting shader variables inside PB-program

Post by DarkDragon »

Hello,

I'd like to specify shader variables (attribute is already there through AddMeshVertex/SetMeshData but the rest - uniform, varying - is missing) inside the purebasic code. Its essential for making games. And beside this I want a

Code: Select all

SetMaterialShader(#Material, Shader.s, Type.i)
Which does something similar to this inside a material script (binding a shader source to a material): http://www.ogre3d.org/docs/manual/manual_18.html#SEC104

Regards,
Daniel
bye,
Daniel
User avatar
idle
Always Here
Always Here
Posts: 5844
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: OGRE: setting shader variables inside PB-program

Post by idle »

I think it could be done by

Ogre::GpuProgramPtr mActiveFragmentProgram;
Ogre::GpuProgramPtr mActiveVertexProgram;
Ogre::GpuProgramParametersSharedPtr mActiveFragmentParameters;
Ogre::GpuProgramParametersSharedPtr mActiveVertexParameters;

and providing the routines to get and set the parameters maybe using the materialId
to map through to the GPUProgramPtr

GetGPUProgramParameter(materialID,parameter,#PBGPUVertex)
SetGPUProgramParameter(materialID,parameter,value.f,#PBGPUFragment)
Windows 11, Manjaro, Raspberry Pi OS
Image
Post Reply