Render to Texture

This topic contains 0 replies, has 1 voice, and was last updated by  r2d2Proton 8 years, 1 month ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #29969

    r2d2Proton
    Member

    I’m using OGLES-1.1_WINDOWS_PCEMULATION_2.05.25.0804

    I am trying to render first to a texture by using a Pbuffer, and then apply the texture to geometry.

    After creating my window surface and its context, I make the window current, then I create the texture, then the pbuffer and its context, then I make the pbuffer current and then render. Is this correct?

    Here is the list:

    Initialize the display

    Create the window surface & context

    Make the window surface & context current

    Create the texture:

        glGenTextures( 1, &itsMapTexture );

        glBindTexture( GL_TEXTURE_2D, itsMapTexture );

        glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );

        glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );

        glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,     GL_CLAMP_TO_EDGE );

        glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,     GL_CLAMP_TO_EDGE );

    Create the Pbuffer and make it current:

        itsPbuffer = CreatePbufferSurface( 256, 256, false );

        clear the color buffer to RED (for testing)

    Make the window surface current

    And then when drawing the geometry with the texture I use:

                glEnable( GL_TEXTURE_2D );

                glBindTexture( GL_TEXTURE_2D, itsMapTexture );

                eglBindTexImage( eglGetCurrentDisplay(), itsPbuffer, EGL_BACK_BUFFER );

    I release the texture after I am done with the current frame

                eglReleaseTexImage( eglGetCurrentDisplay(), itsPbuffer, EGL_BACK_BUFFER );

                glBindTexture( GL_TEXTURE_2D, 0 );

                glDisable( GL_TEXTURE_2D );

    Is this the right order of steps? Could you please offer some ideas?

    I am not seeing the cleared buffer value of RED. In fact depending on how I change the order sometimes I see a bright blue, and other times it is a dark blue.

    Thank you for your help.

Viewing 1 post (of 1 total)
You must be logged in to reply to this topic.