your code doesn't work for me for some reasons. One might be that there is a typo in your code (see below): I assume it should read pixels rather than pix. After that it runs but I don't see anything, though the Opengl Demo itself works.
What would be nice: if one could render the opengl output to a surface, and a surface to a texture map.
Von: Pete Shinners [mailto:email@example.com]
Gesendet: Freitag, 22. Juni 2001 18:13
Betreff: Re: [pygame] open gl blit
> It seem open gl blit don't work even with
> OPENGL|DOUBLEBUF|OPENGLBLIT flag any one success
> blit to or from opengl screen ?
i've never actually done anything with the OPENGLBLIT mode.
i just did some simple testing (following along the C SDL
example) but i couldn't get the blit to draw anything.
i'll try to figure out why that is, but i don't think its
a big deal. just use the standard GL functions to blit
a 2d image to the screen. remember, opengl's coordinate
system is bottom to top, opposite of SDL/pygame.
here's some code that shows that....
import pygame, pygame.image
from pygame.locals import *
from OpenGL.GL import *
#create opengl screen and clear it
screen = pygame.display.set_mode((300,300), OPENGL)
#load image and get pixel buffer
image = pygame.image.load('cowbaby.ppm')
pixels = pygame.image.tostring(image, 'RGBA', 1)
size = image.get_size()
#setup opengl for 2d drawing
glOrtho(0, 300, 0, 300, 0, 1)
#show the image onscreen
glDrawPixels(size, size, GL_RGBA, GL_UNSIGNED_BYTE, pix)
pygame mailing list