Two Methods of Multitexture In Cg
来源:互联网 发布:淘宝淘客推广网站 编辑:程序博客网 时间:2024/05/18 18:56
Method 1: Using OpenGL's native multi-texture support (using semantics)
// In C++ File:
// Identify the textures to use for the pixel shader...
cgGLSetTextureParameter( g_CGparam_testTexture, g_testTextureID );
cgGLSetTextureParameter( g_CGparam_checkerTexture, g_checkerTextureID );
// STAGE 0
glActiveTextureARB( GL_TEXTURE0_ARB );
glBindTexture( GL_TEXTURE_2D, g_testTextureID );
// STAGE 1
glActiveTextureARB( GL_TEXTURE1_ARB );
glBindTexture( GL_TEXTURE_2D, g_checkerTextureID );
cgGLBindProgram( g_CGprogram_pixel );
cgGLEnableProfile( g_CGprofile_pixel );
// Draw primitives
cgGLDisableProfile( g_CGprofile_pixel );
// In Cg File:
uniform sampler2D testTexture : TEXUNIT0,
uniform sampler2D checkerTexture : TEXUNIT1
Method 2: Using Cg's special texture functions:cgGLSetTextureParameter, cgGLEnableTextureParameter, and cgGLDisableTextureParameter
// In C++ File:
g_CGparam_testTexture = cgGetNamedParameter(g_CGprogram_pixel, "testTexture");
g_CGparam_checkerTexture = cgGetNamedParameter(g_CGprogram_pixel, "checkerTexture");
// Identify the textures to use for the pixel shader...
cgGLSetTextureParameter( g_CGparam_testTexture, g_testTextureID );
cgGLSetTextureParameter( g_CGparam_checkerTexture, g_checkerTextureID );
cgGLBindProgram( g_CGprogram_pixel );
cgGLEnableProfile( g_CGprofile_pixel );
cgGLEnableTextureParameter( g_CGparam_testTexture );
cgGLEnableTextureParameter( g_CGparam_checkerTexture );
// Draw primitives
cgGLDisableTextureParameter( g_CGparam_checkerTexture );
cgGLDisableTextureParameter( g_CGparam_testTexture );
cgGLDisableProfile( g_CGprofile_pixel );
// In Cg File:
uniform sampler2D testTexture,
uniform sampler2D checkerTexture
- Two Methods of Multitexture In Cg
- Two methods of transporting file in webservice
- Cg in Two Pages
- Obscured two methods of ScheduledExecutorService
- Template in cpp: two methods
- Purpose of Instance Methods vs. Class Methods in Objective-C
- New methods of NSString in iOS6
- Two Methods to Remove Duplicates in an ArrayList
- Two methods to show warning information in MySQL
- The implementation of anonymous methods in C# and its consequences
- Methods Collection of Enumerating Com Port in Windows, by C
- [MED]Summary of Methods used in MED task(TRECVID 2015)
- Thinking in Java(8)-Behavior of Polymorphic methods inside constructors
- Two principle methods of better controlling the impact of FX exposure
- Two Methods of Finding the sum of 1! + 2! +3! + 4! +...+ 20!
- Two Types of Error in JAVA
- ABAP 动态生成内表的两种方法(Two Methods of Dynamic Internal Table Creation)
- Using two methods for recognition common carotid artery of B-mode longitudinal ultrasound image
- 基于Visual C++6.0的DLL编程实现
- 昨天下雨,又是涂鸦
- oralce 物化视图/实体化视图
- 自己写的.Net(C#)代码自动生成器
- 海量数据库的查询优化及分页算法方案(转)
- Two Methods of Multitexture In Cg
- 技术专题-网络管理(一个网管的论坛)
- 在blog中显示天气预报、日历、时钟、MSN、QQ在线状态
- 如何获取SQL Server数据库里表的占用容量大小[选择自 keenx 的 Blog ]
- 对句柄的认识
- 搜索引擎研究
- google bot
- Enterprise Library- Data Block使用oracle存储过程,字符串参数传入值为""时出现问题的解决
- 第一次,所以遐想