PyOpenGL is a wrapper of GL library.
It’s recommended to verify if OpenGL can work correctly on your environment first.
OpenGL is not available on Jetson. Please use EGL or OpenGLES instead.
[s]Both EGL and OpenGLES are supported by PyOpenGL: [url]http://pyopengl.sourceforge.net/[/url][/s]
Like I said I think its something in the example you gave not with the jetson nano. Here is a test I hacked together using snippets from this site noobtuts - Python OpenGL Introduction
#!/usr/bin/env python
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
window = 0 # glut window number
width, height = 500, 400 # window size
def draw_rect(x, y, width, height):
glBegin(GL_QUADS) # start drawing a rectangle
glVertex2f(x, y) # bottom left point
glVertex2f(x + width, y) # bottom right point
glVertex2f(x + width, y + height) # top right point
glVertex2f(x, y + height) # top left point
glEnd()
def refresh2d(width, height):
glViewport(0, 0, width, height)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
glOrtho(0.0, width, 0.0, height, 0.0, 1.0)
glMatrixMode (GL_MODELVIEW)
glLoadIdentity()
def draw(): # ondraw is called all the time
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) # clear the screen
glLoadIdentity() # reset position
refresh2d(width, height) # set mode to 2d
print """
Vendor: {0}
Renderer: {1}
OpenGL Version: {2}
Shader Version: {3}
""".format(
glGetString(GL_VENDOR),
glGetString(GL_RENDERER),
glGetString(GL_VERSION),
glGetString(GL_SHADING_LANGUAGE_VERSION)
)
glColor3f(0.0, 0.0, 1.0) # set color to blue
draw_rect(10, 10, 200, 100) # rect at (10, 10) with width 200, height 100
glutSwapBuffers() # important for double buffering
# initialization
glutInit() # initialize glut
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH)
glutInitWindowSize(width, height) # set window size
glutInitWindowPosition(0, 0) # set window position
window = glutCreateWindow("noobtuts.com") # create window with title
glutDisplayFunc(draw) # set draw function callback
glutIdleFunc(draw) # draw all the time
glutMainLoop()
What you said is right. I could run this example on my computer(ubuntu or windows) successfully, but failed to run on the jetson nano. I want to know why. This example should run well because the OpenGL is supported according to the wiki. Could you please give me some OpenGL(not OpenGL ES) examples which run successfully on the jetson nano? Thank you.