Losing objects after rendering text

This topic contains 3 replies, has 3 voices, and was last updated by  geo 4 years, 4 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #31286

    geo
    Member

    Hello,

    I am trying to use the CPVRTPrint3D class according to the SDK example but every time I render(flush) the pending text, all other objects I have rendered disappear from screen. Could anyone tell me what i might be doing wrong?
    Here is part of my code:

    Initview:

    bool bRotate = PVRShellGet(prefWidth)/PVRShellGet(prefHeight);

    if(m_Print3D.SetTextures(0, PVRShellGet(prefWidth), PVRShellGet(prefHeight), bRotate) != PVR_SUCCESS)
    {
    PVRShellSet(prefExitMessage, "ERROR: Cannot initialise Print3Dn");
    return false;
    }

    ReleaseView:

    m_Print3D.ReleaseTextures();

    Renderscene:

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    ........
    else if (pressed==2)
    {
    Pad();
    }
    else
    {
    Main_Menu();
    }

    Pad():

    int tnLocation = glGetUniformLocation(m_uiProgramObject, "myPMVMatrix");
    glUniformMatrix4fv( tnLocation, 1, GL_FALSE, aPMVMatrix);
    tnLocation = glGetUniformLocation(m_uiProgramObject, "myModelViewIT");
    glUniformMatrix3fv( tnLocation, 1, GL_FALSE, aModelViewIT);
    tnLocation = glGetUniformLocation(m_uiProgramObject, "myLightDirection");
    glUniform3f( tnLocation, 0, 0, 1);
    glBindBuffer(GL_ARRAY_BUFFER, m_ui32Vbo[9]);
    glEnableVertexAttribArray(VERTEX_ARRAY);
    glVertexAttribPointer(VERTEX_ARRAY, 3, GL_FLOAT, GL_FALSE, m_ui32VertexStride, 0);
    glBindTexture( GL_TEXTURE_2D, m_uiTexture[9] );
    glEnableVertexAttribArray(TEXCOORD_ARRAY);
    glVertexAttribPointer(TEXCOORD_ARRAY, 2, GL_FLOAT, GL_FALSE, m_ui32VertexStride, (void*) (3 * sizeof(GLfloat)));
    glEnableVertexAttribArray(NORMAL_ARRAY);
    glVertexAttribPointer(NORMAL_ARRAY, 3, GL_FLOAT, GL_FALSE, m_ui32VertexStride, (void*) (5 * sizeof(GLfloat)) );
    glDrawArrays(GL_TRIANGLES, 0, 6);
    glBindBuffer(GL_ARRAY_BUFFER, 0);

    m_Print3D.Print3D(50.0f, 50.0f, 1.0f, 0xFF30AA80, "Hello world");

    m_Print3D.Flush();

    if (NULL != (vec2PointerLocation = (float *)PVRShellGet(prefPointerLocation)))
    {
    x = vec2PointerLocation[0];
    y = vec2PointerLocation[1];

    if(0 != PVRShellGet(prefButtonState) && x<0.25 && y>0.75 )
    {
    pressed=0;
    }
    }

    Thanks in advance

    Giorgos

    #37316

    Arron
    Member

    Hi Giorgos,

    Does Print3D render correctly in this case? It could be that Print3D is setting a render state that your render code does not expect and reset correctly before you re-render.

    #37317

    dgu
    Member

    Hello

    did you set a default texture as well ?
    what happend if you flush at the end of the rendering 🙂 ?

    daavid

    #37318

    geo
    Member

    hello,

    I guess Arron is right..I moved the “glUseProgram” to the beginning of my RenderScence function to reuse my shaders and it works fine..

    Thanks a lot for your help

    Giorgos

Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.