Ogre传入数组到cg程序中
来源:互联网 发布:md5加密c语言代码 编辑:程序博客网 时间:2024/06/05 12:05
1.material文件
不需要定义变量
2.cg文件
定义数组参数:uniform float4 arr
注意:cg中必须使用传入的数组,否则会报错。
3.主程序中更新数组信息
float m_arr[10][4];
Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().getByName("materialName");
mat->getTechnique(0)->getPass(0)->getFragmentProgramParameters()->setNamedConstant("arr", m_arr[0], 10);
关键API:
/** Sets a multiple value constant floating-point parameter to the program.
@par
Some systems only allow constants to be set on certain boundaries,
e.g. in sets of 4 values for example. The 'multiple' parameter allows
you to control that although you should only change it if you know
your chosen language supports that (at the time of writing, only
GLSL allows constants which are not a multiple of 4).
@note
This named option will only work if you are using a parameters object created
from a high-level program (HighLevelGpuProgram).
@param name The name of the parameter
@param val Pointer to the values to write
@param count The number of 'multiples' of floats to write
@param multiple The number of raw entries in each element to write,
the default is 4 so count = 1 would write 4 floats.
*/
void setNamedConstant(const String& name, const float *val, size_t count,
size_t multiple = 4);
- Ogre传入数组到cg程序中
- 数据从程序中传入到form中
- 将二维数组的某一行传入到函数中
- OGRE+CG学习日记[1]-简单的3D程序
- OGRE CG教程 (一):OGRE CG 基础
- 【GPU编程】The Cg Runtime:OpenGL中调用Cg程序
- The Cg Runtime:OpenGL中调用Cg程序
- The Cg Runtime:OpenGL中调用Cg程序
- mybaits中传入数组参数
- OGRE CG教程(二): 如何编译CG
- 实际解决adb shell am broadcast 传入参数到程序中
- 传入一个数组进行排列,奇数在前升序,偶数在后降序,在程序执行中不能开辟新数组空间
- ibatis中传入数组的解决方案(转载)
- SQL SERVER传入数组到到存储过程
- Spring 框架下,用数组作为参数 传入到 存储过程,或存储过程返回动态数组到java程序 ,BLOB等大对象类似
- Ogre中渲染到纹理的步骤
- 将ogre 嵌入到 Qt中
- 将ogre 嵌入到 Qt中
- 无人机管理放大招!实名制能否真的管住黑飞?
- 冒泡排序
- 一次线上服务故障应急问题总结
- 数据类型
- java匿名内部类使用外部变量时,外部变量必须是final,为什么?
- Ogre传入数组到cg程序中
- java代码执行字符串中的逻辑运算
- 自定义View Measure过程
- iOS 自定义双向滑块Slider
- 让你的代码量减少3倍!使用kotlin开发Android(四) kotlin bean背后的秘密
- 畅通工程
- 浏览器原理及优化
- Anaconda 3 4.2.0上 安装geopandas
- Android Glide You cannot start a load for a destroyed activity 的异常及解决方法