本文整理汇总了C++中TextureManager::getTextureID方法的典型用法代码示例。如果您正苦于以下问题:C++ TextureManager::getTextureID方法的具体用法?C++ TextureManager::getTextureID怎么用?C++ TextureManager::getTextureID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextureManager
的用法示例。
在下文中一共展示了TextureManager::getTextureID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: intro_do
//.........这里部分代码省略.........
glUniform1f(loc, interpolatedParameters[14]);
loc = glGetUniformLocation(programID, "knob2");
glUniform1f(loc, interpolatedParameters[15]);
loc = glGetUniformLocation(programID, "knob3");
glUniform1f(loc, interpolatedParameters[16]);
loc = glGetUniformLocation(programID, "knob4");
glUniform1f(loc, interpolatedParameters[17]);
loc = glGetUniformLocation(programID, "knob5");
glUniform1f(loc, interpolatedParameters[18]);
loc = glGetUniformLocation(programID, "knob6");
glUniform1f(loc, interpolatedParameters[19]);
loc = glGetUniformLocation(programID, "knob7");
glUniform1f(loc, interpolatedParameters[20]);
loc = glGetUniformLocation(programID, "knob8");
glUniform1f(loc, interpolatedParameters[21]);
loc = glGetUniformLocation(programID, "knob9");
glUniform1f(loc, interpolatedParameters[22]);
loc = glGetUniformLocation(programID, "slider1");
glUniform1f(loc, interpolatedParameters[2]);
loc = glGetUniformLocation(programID, "slider2");
glUniform1f(loc, interpolatedParameters[3]);
loc = glGetUniformLocation(programID, "slider3");
glUniform1f(loc, interpolatedParameters[4]);
loc = glGetUniformLocation(programID, "slider4");
glUniform1f(loc, interpolatedParameters[5]);
loc = glGetUniformLocation(programID, "slider5");
glUniform1f(loc, interpolatedParameters[6]);
loc = glGetUniformLocation(programID, "slider6");
glUniform1f(loc, interpolatedParameters[8]);
loc = glGetUniformLocation(programID, "slider7");
glUniform1f(loc, interpolatedParameters[9]);
loc = glGetUniformLocation(programID, "slider8");
glUniform1f(loc, interpolatedParameters[12]);
loc = glGetUniformLocation(programID, "slider9");
glUniform1f(loc, interpolatedParameters[13]);
// Set texture identifiers
GLint texture_location;
texture_location = glGetUniformLocation(programID, "Noise3DTexture");
glUniform1i(texture_location, 0);
texture_location = glGetUniformLocation(programID, "DepthSensorTexture");
glUniform1i(texture_location, 1);
texture_location = glGetUniformLocation(programID, "BGTexture");
glUniform1i(texture_location, 2);
// render to larger offscreen texture
glActiveTexture(GL_TEXTURE2);
textureManager.getTextureID("hermaniak.tga", &textureID, errorText);
glBindTexture(GL_TEXTURE_2D, textureID);
glActiveTexture(GL_TEXTURE1);
textureManager.getTextureID(TM_DEPTH_SENSOR_NAME, &textureID, errorText);
glBindTexture(GL_TEXTURE_2D, textureID);
glActiveTexture(GL_TEXTURE0);
textureManager.getTextureID(TM_NOISE3D_NAME, &textureID, errorText);
glBindTexture(GL_TEXTURE_3D, textureID);
if (usedIndex > 4) {
glViewport(0, 0, X_HIGHLIGHT, Y_HIGHLIGHT);
} else {
glViewport(0, 0, X_OFFSCREEN, Y_OFFSCREEN);
}
glRectf(-1.0, -1.0, 1.0, 1.0);
// Copy backbuffer to texture
if (usedIndex > 4) {
textureManager.getTextureID(TM_HIGHLIGHT_NAME, &textureID, errorText);
glBindTexture(GL_TEXTURE_2D, textureID);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, X_HIGHLIGHT, Y_HIGHLIGHT);
} else {
textureManager.getTextureID(TM_OFFSCREEN_NAME, &textureID, errorText);
glBindTexture(GL_TEXTURE_2D, textureID);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, X_OFFSCREEN, Y_OFFSCREEN);
}
// Copy backbuffer to front (so far no improvement)
int xres = windowRect.right - windowRect.left;
int yres = windowRect.bottom - windowRect.top;
glViewport(0, 0, xres, yres);
if (usedIndex > 4) {
shaderManager.getProgramID("DitherTexture.gprg", &programID, errorText);
} else {
shaderManager.getProgramID("SimpleTexture.gprg", &programID, errorText);
}
glUseProgram(programID);
loc = glGetUniformLocation(programID, "time");
glUniform1f(loc, (float)(t * 0.001f));
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glDisable(GL_BLEND);
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f);
glVertex2f(-1.0f, -1.0f);
glTexCoord2f(1.0f, 0.0f);
glVertex2f(1.0f, -1.0f);
glTexCoord2f(1.0f, 1.0f);
glVertex2f(1.0f, 1.0f);
glTexCoord2f(0.0f, 1.0f);
glVertex2f(-1.0f, 1.0f);
glEnd();
}
示例2: intro_do
void intro_do(long t)
{
char errorText[MAX_ERROR_LENGTH+1];
float ftime = 0.001f*(float)t;
GLuint textureID;
glDisable(GL_BLEND);
glDisable(GL_DEPTH_TEST);
// Those are key-Press indicators. I only act on 0-to-1.
for (int i = 0; i < maxNumParameters; i++)
{
interpolatedParameters[i] = 0.98f * interpolatedParameters[i] +
0.02f * params.getParam(i, defaultParameters[i]);
}
// Update key press events.
for (int i = 0; i < NUM_KEYS; i++)
{
if (params.getParam(i, 0.0) > 0.5f) keyPressed[i]++;
else keyPressed[i] = 0;
}
// BPM => spike calculation
float BPS = BPM / 60.0f;
float jumpsPerSecond = BPS / 1.0f; // Jump on every fourth beat.
static float phase = 0.0f;
float jumpTime = (ftime * jumpsPerSecond) + phase;
jumpTime -= floor(jumpTime);
if (keyPressed[41] == 1)
{
phase -= jumpTime;
jumpTime = 0.0f;
if (phase < 0.0f) phase += 1.0;
}
jumpTime = jumpTime * jumpTime;
// spike is between 0.0 and 1.0 depending on the position within whatever.
float spike = 0.5f * cosf(jumpTime * 3.1415926f * 1.5f) + 0.5f;
// Set the program uniforms
GLuint programID;
shaderManager.getProgramID(usedProgram[usedIndex], &programID, errorText);
glUseProgram(programID);
GLuint loc = glGetUniformLocation(programID, "time");
glUniform1f(loc, (float)(t * 0.001f));
// For now I am just sending the spike to the shader. I might need something better...
loc = glGetUniformLocation(programID, "spike");
glUniform1f(loc, spike);
loc = glGetUniformLocation(programID, "knob1");
glUniform1f(loc, interpolatedParameters[14]);
loc = glGetUniformLocation(programID, "knob2");
glUniform1f(loc, interpolatedParameters[15]);
loc = glGetUniformLocation(programID, "knob3");
glUniform1f(loc, interpolatedParameters[16]);
loc = glGetUniformLocation(programID, "knob4");
glUniform1f(loc, interpolatedParameters[17]);
loc = glGetUniformLocation(programID, "knob5");
glUniform1f(loc, interpolatedParameters[18]);
loc = glGetUniformLocation(programID, "knob6");
glUniform1f(loc, interpolatedParameters[19]);
loc = glGetUniformLocation(programID, "knob7");
glUniform1f(loc, interpolatedParameters[20]);
loc = glGetUniformLocation(programID, "knob8");
glUniform1f(loc, interpolatedParameters[21]);
loc = glGetUniformLocation(programID, "knob9");
glUniform1f(loc, interpolatedParameters[22]);
loc = glGetUniformLocation(programID, "slider1");
glUniform1f(loc, interpolatedParameters[2]);
loc = glGetUniformLocation(programID, "slider2");
glUniform1f(loc, interpolatedParameters[3]);
loc = glGetUniformLocation(programID, "slider3");
glUniform1f(loc, interpolatedParameters[4]);
loc = glGetUniformLocation(programID, "slider4");
glUniform1f(loc, interpolatedParameters[5]);
loc = glGetUniformLocation(programID, "slider5");
glUniform1f(loc, interpolatedParameters[6]);
loc = glGetUniformLocation(programID, "slider6");
glUniform1f(loc, interpolatedParameters[8]);
loc = glGetUniformLocation(programID, "slider7");
glUniform1f(loc, interpolatedParameters[9]);
loc = glGetUniformLocation(programID, "slider8");
glUniform1f(loc, interpolatedParameters[12]);
loc = glGetUniformLocation(programID, "slider9");
glUniform1f(loc, interpolatedParameters[13]);
// render to larger offscreen texture
textureManager.getTextureID("noise3D", &textureID, errorText);
glBindTexture(GL_TEXTURE_3D, textureID);
glViewport(0, 0, X_OFFSCREEN, Y_OFFSCREEN);
glRectf(-1.0, -1.0, 1.0, 1.0);
// Copy backbuffer to texture
textureManager.getTextureID("renderTarget", &textureID, errorText);
glBindTexture(GL_TEXTURE_2D, textureID);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, X_OFFSCREEN, Y_OFFSCREEN);
// Copy backbuffer to front (so far no improvement)
int xres = windowRect.right - windowRect.left;
int yres = windowRect.bottom - windowRect.top;
glViewport(0, 0, xres, yres);
shaderManager.getProgramID("SimpleTexture.gprg", &programID, errorText);
//.........这里部分代码省略.........
示例3: intro_do
//.........这里部分代码省略.........
loc = glGetUniformLocation(programID, "knob9");
glUniform1f(loc, interpolatedParameters[22]);
loc = glGetUniformLocation(programID, "slider1");
glUniform1f(loc, interpolatedParameters[2]);
loc = glGetUniformLocation(programID, "slider2");
glUniform1f(loc, interpolatedParameters[3]);
loc = glGetUniformLocation(programID, "slider3");
glUniform1f(loc, interpolatedParameters[4]);
loc = glGetUniformLocation(programID, "slider4");
glUniform1f(loc, interpolatedParameters[5]);
loc = glGetUniformLocation(programID, "slider5");
glUniform1f(loc, interpolatedParameters[6]);
loc = glGetUniformLocation(programID, "slider6");
glUniform1f(loc, interpolatedParameters[8]);
loc = glGetUniformLocation(programID, "slider7");
glUniform1f(loc, interpolatedParameters[9]);
loc = glGetUniformLocation(programID, "slider8");
glUniform1f(loc, interpolatedParameters[12]);
loc = glGetUniformLocation(programID, "slider9");
glUniform1f(loc, interpolatedParameters[13]);
#endif
// Set texture identifiers
GLint texture_location;
texture_location = glGetUniformLocation(programID, "Noise3DTexture");
glUniform1i(texture_location, 0);
texture_location = glGetUniformLocation(programID, "DepthSensorTexture");
glUniform1i(texture_location, 1);
texture_location = glGetUniformLocation(programID, "BGTexture");
glUniform1i(texture_location, 2);
// render to larger offscreen texture
glActiveTexture(GL_TEXTURE2);
textureManager.getTextureID("hermaniak.tga", &textureID, errorText);
glBindTexture(GL_TEXTURE_2D, textureID);
glActiveTexture(GL_TEXTURE1);
//textureManager.getTextureID(TM_DEPTH_SENSOR_NAME, &textureID, errorText);
glBindTexture(GL_TEXTURE_2D, textureID);
glActiveTexture(GL_TEXTURE0);
textureManager.getTextureID(TM_NOISE3D_NAME, &textureID, errorText);
glBindTexture(GL_TEXTURE_3D, textureID);
#if 1
glViewport(0, 0, X_HIGHLIGHT, Y_HIGHLIGHT);
#endif
// TODO: Here is the rendering done!
interpolatedParameters[6] = 0.4f;
shaderManager.getProgramID("SimpleTexture.gprg", &programID, errorText);
glUseProgram(programID);
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
//glDisable(GL_BLEND);
glDisable(GL_CULL_FACE);
glEnable(GL_BLEND);
glBlendFunc(GL_DST_COLOR, GL_ZERO);
// Texture for first pass is simply black
textureManager.getTextureID("black.tga", &textureID, errorText);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, textureID);
const int num_passes = 4;
// TODO: Make the first 1 or 2 passes to the smaller backbuffer
for (int pass = 0; pass < num_passes; pass++) {