Log in or register to post comments

Enabling opengl1.1 for videoplayback sample

May 28, 2013 - 6:06pm #1

Hi,

I have integrated cloudreco example into videoplayback sample code for my purpose. Now, it is working for devices with opengl 2.0 version. I want to make it work for opengl es 1.1 as well. I tried to enable opengl es flag 1.1 in native code and made changes accordingly. But it is not working for me.

 

Cna someone suggest the steps I need to follow to enable opengl es 1.1 for videoplayback sample. I tried making all the changes similar to imagetargets.cpp in videoplayback.cpp. but in renserframe, I am getting an error that I am calling unimplemented opengl es api.

 

This is my renderframe code :

 

NIEXPORT void JNICALL
Java_com_qualcomm_QCARSamples_VideoPlayback_VideoPlaybackRenderer_renderFrame(JNIEnv * env, jobject obj)
{
    LOG("Java_com_qualcomm_QCARSamples_VideoPlayback_GLRenderer_renderFrame");

 //Sushil start
 //New code for Cloud Reco
 if (showStartScanButton)
 {
     //jclass javaClass = env->GetObjectClass(obj);
     //jmethodID method = env->GetMethodID(javaClass, "showStartScanButton", "()V");
     //env->CallVoidMethod(obj, method);

     showStartScanButton = false;
 }
 ///////////////////
 //Sushil end

    // Clear color and depth buffer
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    // Get the state from QCAR and mark the beginning of a rendering section
    QCAR::State state = QCAR::Renderer::getInstance().begin();

    // Explicitly render the Video Background
    QCAR::Renderer::getInstance().drawVideoBackground();

    //sushopengl
    glEnableClientState(GL_VERTEX_ARRAY);
     glEnableClientState(GL_NORMAL_ARRAY);
     glEnableClientState(GL_TEXTURE_COORD_ARRAY);

     glEnable(GL_TEXTURE_2D);
     glDisable(GL_LIGHTING);
     //sushopengl

    glEnable(GL_DEPTH_TEST);
   
    // We must detect if background reflection is active and adjust the culling direction.
    // If the reflection is active, this means the post matrix has been reflected as well,
    // therefore standard counter clockwise face culling will result in "inside out" models.
    glEnable(GL_CULL_FACE);
    glCullFace(GL_BACK);
    if(QCAR::Renderer::getInstance().getVideoBackgroundConfig().mReflection == QCAR::VIDEO_BACKGROUND_REFLECTION_ON)
        glFrontFace(GL_CW);  //Front camera
    else
        glFrontFace(GL_CCW);   //Back camera

  
    for (int i=0; i<NUM_TARGETS; i++)
    {
        isTracking[i] = false;
        targetPositiveDimensions[i].data[0] = 0.0;
        targetPositiveDimensions[i].data[1] = 0.0;
    }

//Sushil

    //for(int tIdx = 0; tIdx < state.getNumTrackableResults(); tIdx++)
    if (state.getNumTrackableResults() > 0)
    {
        // Get the trackable:
     const QCAR::TrackableResult* trackableResult = state. getTrackableResult(/*tIdx*/0);
     const QCAR::Trackable& trackable = trackableResult->getTrackable();
     //const QCAR::ImageTarget& imageTarget = (const QCAR::ImageTarget&) trackableResult->getTrackable();

//         Compare this trackable's id to a globally stored id
//         If this is a new trackable, find the displayMessage java method and
//         call it with the trackable's name
        if (/*trackable.getId() != lastTrackableId*/scanningMode) {
         scanningMode = false;
            jstring js = env->NewStringUTF(trackable.getName());
            jclass javaClass = env->GetObjectClass(obj);
            jmethodID method = env->GetMethodID(javaClass, "displayMessage", "(Ljava/lang/String;)V");
            env->CallVoidMethod(obj, method, js);
            lastTrackableId = trackable.getId();
        }
    }

    glDisable(GL_DEPTH_TEST);

    glDisable(GL_TEXTURE_2D);
    glDisableClientState(GL_VERTEX_ARRAY);
    glDisableClientState(GL_NORMAL_ARRAY);
    glDisableClientState(GL_TEXTURE_COORD_ARRAY);

    QCAR::Renderer::getInstance().end();
}

 

 

Thank You,

Sushil

Enabling opengl1.1 for videoplayback sample

May 29, 2013 - 1:09am #6

I would suggest to compare once again the whole OpenGL code with the one in ImageTargets;

check every line of code which applies under the condition define by this def:

USE_OPENGL_ES_1_1

and see if you perhaps have forgot something in your VP code.

 

Enabling opengl1.1 for videoplayback sample

May 28, 2013 - 11:45pm #5

Thank you very much for your reply. Yes I did remove the code from java part as well. Also in native sise I am returning 1 in getOpenGLESVersionNative(). But after changing app to opengl1.1, I am getting crash in renderframe from this line "QCAR::Renderer::getInstance().drawVideoBackground();" . After application getting launched, there is just a black screen for some time after showing splashscreen and finally the app crashes. Am clueless how to fix it now.

Enabling opengl1.1 for videoplayback sample

May 28, 2013 - 11:39pm #4

Ok, then you should be able to achieve it, but also make sure to check the Java part of the code, to see if there is any openGL 2.0 specific code which is perhaps executed (in particular, check the VideoPlaybackRenderer.java class)

Also, in VideoPlayback.cpp you should see a function called getOpenGLESVersionNative()....    make sure it returns 1.

 

Enabling opengl1.1 for videoplayback sample

May 28, 2013 - 10:51pm #3

I dont want to render videos on textures. I'll be more than happy if the video plays fullscreen on phone using videoplayer. Also, I have commented the code which makes the video to play on textures. Can I achieve it now?

Enabling opengl1.1 for videoplayback sample

May 28, 2013 - 10:44pm #2

Hi, not sure if it is possible to port VideoPlayback to GL ES 1.1, as the sample uses a special extension for rendering the video content on the textures.

 

Log in or register to post comments