tests/cuda4.1sdk/tests/postProcessGL/main.cpp
void displayImage(GLuint texture)
{
    glBindTexture(GL_TEXTURE_2D, texture);
    glEnable(GL_TEXTURE_2D);
    glDisable(GL_DEPTH_TEST);
    glDisable(GL_LIGHTING);
    glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

    glMatrixMode(GL_PROJECTION);
    glPushMatrix();
    glLoadIdentity();
    glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);

    glMatrixMode( GL_MODELVIEW);
    glLoadIdentity();

    glViewport(0, 0, window_width, window_height);

    // if the texture is a 8 bits UI, scale the fetch with a GLSL shader
#ifndef USE_TEXSUBIMAGE2D
    glUseProgram(shDrawTex);
    GLint id = glGetUniformLocation(shDrawTex, "texImage");
    glUniform1i(id, 0); // texture unit 0 to "texImage"
    CUT_CHECK_ERROR_GL2();
#endif

    glBegin(GL_QUADS);
    glTexCoord2f(0.0, 0.0); glVertex3f(-1.0, -1.0, 0.5);
    glTexCoord2f(1.0, 0.0); glVertex3f(1.0, -1.0, 0.5);
    glTexCoord2f(1.0, 1.0); glVertex3f(1.0, 1.0, 0.5);
    glTexCoord2f(0.0, 1.0); glVertex3f(-1.0, 1.0, 0.5);
    glEnd();

    glMatrixMode(GL_PROJECTION);
    glPopMatrix();

    glDisable(GL_TEXTURE_2D);

#ifndef USE_TEXSUBIMAGE2D
    glUseProgram(0);
#endif
    CUT_CHECK_ERROR_GL2();
}
// display image to the screen as textured quad
display image to the screen as textured quad
display image to the screen as textured quad
void displayImage(GLuint texture)
{
    glBindTexture(GL_TEXTURE_2D, texture);
    glEnable(GL_TEXTURE_2D);
    glDisable(GL_DEPTH_TEST);
    glDisable(GL_LIGHTING);
    glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
    glMatrixMode(GL_PROJECTION);
    glPushMatrix();
    glLoadIdentity();
    glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
    glMatrixMode( GL_MODELVIEW);
    glLoadIdentity();
    glViewport(0, 0, window_width, window_height);
#ifndef USE_TEXSUBIMAGE2D
    glUseProgram(shDrawTex);
    GLint id = glGetUniformLocation(shDrawTex, "texImage");
    glUniform1i(id, 0); 
    CUT_CHECK_ERROR_GL2();
#endif
    glBegin(GL_QUADS);
    glTexCoord2f(0.0, 0.0); glVertex3f(-1.0, -1.0, 0.5);
    glTexCoord2f(1.0, 0.0); glVertex3f(1.0, -1.0, 0.5);
    glTexCoord2f(1.0, 1.0); glVertex3f(1.0, 1.0, 0.5);
    glTexCoord2f(0.0, 1.0); glVertex3f(-1.0, 1.0, 0.5);
    glEnd();
    glMatrixMode(GL_PROJECTION);
    glPopMatrix();
    glDisable(GL_TEXTURE_2D);
#ifndef USE_TEXSUBIMAGE2D
    glUseProgram(0);
#endif
    CUT_CHECK_ERROR_GL2();
}
void displayImage ( GLuint texture ) { glBindTexture ( GL_TEXTURE_2D , texture ) ; glEnable ( GL_TEXTURE_2D ) ; glDisable ( GL_DEPTH_TEST ) ; glDisable ( GL_LIGHTING ) ; glTexEnvf ( GL_TEXTURE_ENV , GL_TEXTURE_ENV_MODE , GL_REPLACE ) ; glMatrixMode ( GL_PROJECTION ) ; glPushMatrix ( ) ; glLoadIdentity ( ) ; glOrtho ( -1.0 , 1.0 , -1.0 , 1.0 , -1.0 , 1.0 ) ; glMatrixMode ( GL_MODELVIEW ) ; glLoadIdentity ( ) ; glViewport ( 0 , 0 , window_width , window_height ) ; #ifndef USE_TEXSUBIMAGE2D glUseProgram ( shDrawTex ) ; GLint id = glGetUniformLocation ( shDrawTex , " " ) ; glUniform1i ( id , 0 ) ; CUT_CHECK_ERROR_GL2 ( ) ; #endif glBegin ( GL_QUADS ) ; glTexCoord2f ( 0.0 , 0.0 ) ; glVertex3f ( -1.0 , -1.0 , 0.5 ) ; glTexCoord2f ( 1.0 , 0.0 ) ; glVertex3f ( 1.0 , -1.0 , 0.5 ) ; glTexCoord2f ( 1.0 , 1.0 ) ; glVertex3f ( 1.0 , 1.0 , 0.5 ) ; glTexCoord2f ( 0.0 , 1.0 ) ; glVertex3f ( -1.0 , 1.0 , 0.5 ) ; glEnd ( ) ; glMatrixMode ( GL_PROJECTION ) ; glPopMatrix ( ) ; glDisable ( GL_TEXTURE_2D ) ; #ifndef USE_TEXSUBIMAGE2D glUseProgram ( 0 ) ; #endif CUT_CHECK_ERROR_GL2 ( ) ; }
display image to the screen as textured quad
display image to the screen as textured quad
// if the texture is a 8 bits UI, scale the fetch with a GLSL shader // texture unit 0 to "texImage"