Colours turn to Black on using Print3D

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

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #31326

    hellboy
    Member

    Hi,

    I had got all the colourful objects in my scene. Then, I started using Print3D class to print information like FPS etc on the screen. But, when I run the program, every object turns black although the text is printed correctly on the screen. During running, I also get the following warnings :

    PVR:(Warning): UnpackRevision: The SGX core flag is 0x535 but we expected 0x544. [312, /binshader.c]
    PVR:(Warning): UnpackRevision: The GLSL compiled Uniflex interface revision flag is 0x0 but we expected 0x2. [1138, /binshader.c]
    PVR:(Warning): UnpackRevision: The Unipatch input revision flag is 0x0 but we expected 0x25. [1145, /binshader.c]
    PVR:(Warning): UnpackRevision: Couldn’t find a revision that matches the current hardware and driver. [1176, /binshader.c]

    Can someone help ?

    #37568

    dgu
    Member

    Hello

    did you define the usageof the default texture
    m_Print3D.SetTextures(NULL, uiWidth, uiHeight, bRotate);
    did you FLush ?
    m_Print3D.Flush();
    what will be your clear color :
    // Clears the color and depth buffer
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    like describe in the sample OGLES2IntroducingPrint3 ?

    regards
    david

    #37569

    hellboy
    Member

    Yes, I did all the above things. I will give you a brief overview of the code :

    InitView()
    {
    //Compiling shaders

    rotate = PVRShellGet(prefIsRotated) && PVRShellGet(prefFullScreen);

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

    RenderScene()
    {
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    //Camera Calculations

    for(i=0;i<nummeshes;i++)
    {
    glBindBuffer(GL_ARRAY_BUFFER, m_ui32Vbo);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ui32Ibo
    );

    glEnableVertexAttribArray(VERTEX_ARRAY);
    glVertexAttribPointer(VERTEX_ARRAY, 3, GL_FLOAT, GL_FALSE, 0, 0);
    glEnableVertexAttribArray(COLOUR_ARRAY);
    glVertexAttribPointer(COLOUR_ARRAY, 3, GL_FLOAT, GL_FALSE, 0, 0);

    glDrawElements(GL_TRIANGLES, facecount * 3, GL_UNSIGNED_SHORT, NULL);

    glBindBuffer(GL_ARRAY_BUFFER, 0);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
    }

    m_Print3D.DisplayDefaultTitle(“HELLO”, “”, NULL);
    m_Print3D.Flush();
    }

    #37570

    dgu
    Member

    can you set a clear color in the InitView to see
    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);

    #37571

    hellboy
    Member

    Right now, I have set it to be :

    glClearColor(0.7f, 0.85f, 1.0f, 1.0f);

    I can see the blue sky. Only the objects have turned black.

    #37572

    dgu
    Member

    so it s the color array that you set then

    #37573

    hellboy
    Member

    I didn’t get you.

    #37574

    Joe Davis
    Member

    Hi,

    Q1: Are your objects still black when you remove Print3D from your render (i.e. disable m_Print3D.Flush();)?

    Q2: The “PVR:(Warning): UnpackRevision: …” output sounds like an issue with shader binaries. Are you compiling shaders from GLSL ES source on each application run, or are you trying to use shader program binaries you’ve pre-compiled?

    Thanks,
    Joe

    #37575

    hellboy
    Member

    When I comment every line containing the Print3D variable, the colours are fine. I compile the shaders on each run.

    #37576

    Joe Davis
    Member

    Print3D has to change the OpenGL ES renderstate before it can render, for example enable blending if it is disabled. Print3D should revert the renderstate once it has finished rendering.

    As a test, can you reset your renderstate at the start of your RenderScene() function? If this fixes the problem, then this suggests that there is a bug in Print3D’s renderstate revert mechanism.

    Thanks,
    Joe

    #37577

    hellboy
    Member

    I will do that first thing tomorrow..

    #37578

    dgu
    Member

    something is probably wrong in the shader implementation then no?

    #37579

    hellboy
    Member

    The shader codes are merely 2 lines of code. What can be wrong in them ?

    #37580

    hellboy
    Member

    Joe, what did you mean exactly by resetting the render state of OpenGL ES ?

    #37581

    Joe Davis
    Member

    You need to reset anything that has been toggled with glEnable/glDisable and bind shaders, textures & buffers needed by your draw calls.

    Based on the code snippets you’ve supplied, it may just be glUseProgram() that needs to be set again. To be safe, you should reset all of your render state and bindings.

    Thanks,
    Joe

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