How to Resize the OpenGL window from jetson.inference tutorials

How do I resize an openGL window using jetson.utils?

To be more specific, whenever I run any kind of a python program based off the inference tutorials, using:

display = jetson.utils.glDisplay()

while display.IsOpen():
    img, width, height = camera.CaptureRGBA()
    detections = net.Detect(img, width, height)
    display.RenderOnce(img, width, height)
    display.SetTitle("Object Detection | Network {:.0f} FPS".format(net.GetNetworkFPS()))

The window is the size of the display (fullscreen which is usually much bigger than the image size). The video is in the top left and the rest of the window fills with black. I would like to make the window the size of the video frame being shown. I’ll be doggone if I can find how to do that with jetson.utils.

I don’t need to scale anything or worry about fustrum, I just want to crop the window to the video size.

Do I need to do this with an openGL command like glViewport() ? If so, can you give me a hint where I should look to get started with that (I’m a Python guy, but very new to the whole working with images in VRAM thing).

some modification to the glDisplay.cpp file will solve your problem

Thanks. I actually got a great reply from Dusty here:

https://devtalk.nvidia.com/default/topic/1067872/jetson-tx2/how-to-resize-the-opengl-window-from-jetson-inference-tutorials/post/5409028/#5409028

When I wrote the original post, the functionality had not been added yet and the answer was to modify the cpp file. I’m not sure if this has changed.

Thanks for the tip.