lattepanda-mu-ultra-gpu-opengl-triangle-8.ino

LattePanda Mu Ultra : Module de calcul x86 pour l'IA embarquée · Fichier : lattepanda-mu-ultra-gpu-opengl-triangle-8.ino · Langage : python · Usage : Afficher un triangle OpenGL utilisant le GPU Intel Arc via le pilote XE dans une fenêtre GLFW.

Démo Python utilisant PyOpenGL et GLFW pour vérifier le fonctionnement du rendu graphique 3D sur le GPU intégré Intel Arc (Lunar Lake).

Matériel : LattePanda Mu Ultra (GPU Intel Arc). Logiciel : Ubuntu 24.04+, pilote graphique 'xe' installé. Python 3, paquets 'pyopengl', 'glfw'. La session graphique X11 ou Wayland doit être active. Exécution : python script.py.

lattepanda-mu-ultra-gpu-opengl-triangle-8.ino

import glfw
from OpenGL.GL import *
from OpenGL.GLU import *
import ctypes

def init():
    if not glfw.init():
        return None
    # Essayer de créer une fenêtre avec contexte OpenGL 4.6 (supporté par Arc)
    glfw.window_hint(glfw.CONTEXT_VERSION_MAJOR, 4)
    glfw.window_hint(glfw.CONTEXT_VERSION_MINOR, 6)
    glfw.window_hint(glfw.OPENGL_PROFILE, glfw.OPENGL_CORE_PROFILE)
    
    window = glfw.create_window(800, 600, "LattePanda Mu Ultra - Intel Arc OpenGL", None, None)
    if not window:
        glfw.terminate()
        return None
    
    glfw.make_context_current(window)
    print("Renderer:", glGetString(GL_RENDERER).decode())
    print("OpenGL Version:", glGetString(GL_VERSION).decode())
    return window

def draw():
    glClear(GL_COLOR_BUFFER_BIT)
    glColor3f(0.4, 0.8, 0.2) # Vert clair
    glBegin(GL_TRIANGLES)
    glVertex2f(0.0, 0.5)
    glVertex2f(-0.5, -0.5)
    glVertex2f(0.5, -0.5)
    glEnd()

def main():
    window = init()
    if not window:
        return

    while not glfw.window_should_close(window):
        glfw.poll_events()
        draw()
        glfw.swap_buffers(window)
        glfw.swap_interval(1) # VSync pour éviter le tearing
    
    glfw.terminate()

if __name__ == "__main__":
    main()

← Retour à la fiche