Context: create, no gl context available. GL interop will be disabled

Please provide the following info (tick the boxes after creating this topic):
Software Version
DRIVE OS 6.0.4 (rev. 1)
DRIVE OS 6.0.4 SDK
other

Target Operating System
Linux
QNX
other

Hardware Platform
DRIVE AGX Orin Developer Kit (940-63710-0010-D00)
DRIVE AGX Orin Developer Kit (940-63710-0010-C00)
DRIVE AGX Orin Developer Kit (not sure its number)
other

SDK Manager Version
1.9.10816
other

Host Machine Version
native Ubuntu Linux 20.04 Host installed with SDK Manager
native Ubuntu Linux 20.04 Host installed with DRIVE OS Docker Containers
native Ubuntu Linux 18.04 Host installed with DRIVE OS Docker Containers
other

Hello. I am trying to render a image which is sent via a ros sensor msg with the dwRenderEngine. I currently have the problem, that, when i execute the Program on my Linux x86 Host, it throws an driveworks exception:
[22-11-2022 12:59:27] Context: create, no gl context available. GL interop will be disabled. [22-11-2022 12:59:27] Driveworks exception thrown: DW_NOT_INITIALIZED: CPU to GL: cannot initialize, GL context not present in this thread
I actually want to achieve something like this: Ros sensor_msg β†’ cv::Mat β†’ dwImageCPU β†’ dw ImageCUDA β†’ dwImageGL β†’ rendered Image. Is this even possible or did I misunderstand this. I got inspired by rendering the CUDA Image stream in the camera replay sample and some older threads in the forum.

Thanks for looking into!

This is the code snippet, where it throws the error:

    if (!glStreamer) 
    {
        dwImageStreamerGL_initialize(&m_image2GL,&rcbImage->prop,DW_IMAGE_GL,m_context);
        glStreamer = true;
        ROS_INFO("GL Streamer initialized");
    }

creation of the CPU Image from the ROS msg:

    // Convert the ROS message  
    cv_ptr = cv_bridge::toCvCopy(msg, "bgra8");

    cv::Mat mat = cv_ptr->image;

    from.height = msg->height;
    from.width = msg->width;
    from.format = DW_IMAGE_FORMAT_RGB_UINT8_PLANAR;
    from.type = DW_IMAGE_CPU;
    from.memoryLayout = DW_IMAGE_MEMORY_TYPE_DEFAULT;

    ROS_INFO("initialize dwImagefromerties: success\n");

    CHECK_DW_ERROR(
        dwImage_create(&m_imageCPU,from,m_context)
    );

    ROS_INFO("create dwImageCPU: success\n");

    char* a = (char*)malloc(sizeof(char)*from.width*from.height*3);
    char* b = (char*)malloc(sizeof(char)*from.width*from.height*3);
    char* c = (char*)malloc(sizeof(char)*from.width*from.height*3);

    if (!a | !b | !c)
    {
        ROS_INFO("Memory allocation: failed\n");
        exit(1);
    } else
    {
        ROS_INFO("Memory allocation: success\n");
    }

    dwImageCPU *nextFrameCPU;
    CHECK_DW_ERROR(
        dwImage_getCPU(&nextFrameCPU, m_imageCPU));

    ROS_INFO("dwImage_getCPU: success\n");

    memcpy(nextFrameCPU->data[0],a,sizeof(char)*from.width*from.height);
    memcpy(nextFrameCPU->data[1],b,sizeof(char)*from.width*from.height);
    memcpy(nextFrameCPU->data[2],c,sizeof(char)*from.width*from.height);

    dwImageCUDA *rcbImage;
    if(streamerInit != true) {
        dwImageStreamer_initialize(&m_streamerCPU2CUDA,&nextFrameCPU->prop,DW_IMAGE_CUDA,m_context);
        ROS_INFO("Initialized streamer: success\n");
        streamerInit = true;
    }
   

β€œfrom” is of the type DwImageProperties.

Dear @christopher.tuch,
The application pipeline is possible. Please check DriveWorks SDK Reference: Simple Image Streamer Sample for dwImageCPU->dwImageCUDA-> doSomeProcessingOnCUDA()->dwImageGL.

1 Like