我目前使用PyOpenGL與PyGame來編寫自頂向下的2D側滾動代碼。 下面顯示的代碼將在窗口中生成2D圖像。 添加的圖像是背景。我現在想使用OpenGL將精靈添加到背景中。換句話說,我想將一個2D圖像疊加在另一個之上。我似乎無法找到一個好辦法做到這一點。 import pygame
from pygame.locals import *
from OpenGL.GL import *
f
from OpenGL.extensions import alternate
from OpenGL.GL import *
from OpenGL.GL.ARB.multitexture import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
class TestTexture():
def __init
我試圖在pygame中將numpy數組設置爲OpenGl紋理。問題是隻有第一個像素被作爲紋理數據,而不是隨機模式(例如),我每次只能得到一個隨機顏色。 import pygame
from pygame.locals import *
from OpenGL.GL import *
from OpenGL.GLU import *
import numpy as np
#Setti