我正在使用pygame和pyopengl,并试图让glGenTextures(1,img)返回1。我查过了myPixelArt.bmp'有2个维度的幂。从我的脚本开始:
import pygame, OpenGL, math, numpy
from pygame.locals import *
from OpenGL.GL import *
from OpenGL.WGL import *
from OpenGL.GLU import *
from PIL import Image
from ctypes import *
img = Image.open('myPixelArt.bmp')
glEnable(GL_TEXTURE_2D)
hdc=windll.user32.GetDC(1)
print hdc
hglrc=wglCreateContext(hdc)
wglMakeCurrent(hdc,hglrc)
im=glGenTextures(1,img)
print im
但这会为hdc打印0,为im打印0。在
我应该用什么论点windll.user32.GetDC来创建一个显示上下文,并希望让glGenTextures返回1?在
尝试先创建一个窗口!在
因为Pygame在窗口中创建了一个OpenGL上下文。在
相关问题 更多 >
编程相关推荐