本文整理汇总了C++中CShader::SetFloat方法的典型用法代码示例。如果您正苦于以下问题:C++ CShader::SetFloat方法的具体用法?C++ CShader::SetFloat怎么用?C++ CShader::SetFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CShader
的用法示例。
在下文中一共展示了CShader::SetFloat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RenderScene
void RenderScene()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
glLoadIdentity(); // Reset The matrix
/////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// * ///////
// In our RenderScene() function we will now start using the shader. We added support
// to create quadrics so we don't have to load any models, which makes the tutorials easy.
// What we do is create a sphere and then have our shader make it wave. When we loaded
// the shader files it turned ON the shader, so we don't need to turn it on every frame.
// Notice that we pass in our g_TimeLoc variable that we got in the Init() function above
// to change the "time" variable in the vertex shader. We also pass in a new waveChange
// value to vary the wave.
// Create a static float to hold our current wave value, then update and change it each frame.
static float waveChange = 0.0f;
g_Shader.SetFloat(g_TimeLoc, waveChange);
waveChange += 0.06f;
GLUquadricObj *pObj = gluNewQuadric(); // Get a Quadric off the stack
gluQuadricDrawStyle(pObj, GLU_LINE); // Draw the sphere in wireframe
glTranslatef(0.0f, 0.0f, -6.5f); // Move the sphere backwards from the camera
gluSphere(pObj, 2.5f, 75, 75); // Draw a decent poly sphere with a radius of 2.5
gluDeleteQuadric(pObj); // Free the Quadric
/////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// * ///////
SwapBuffers(g_hDC); // Swap the backbuffers to the foreground
}