Pete,
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.
Regards,
Dirk
-----Ursprüngliche Nachricht-----
Von: Pete Shinners [mailto:shredwheat@mediaone.net]
Gesendet: Freitag, 22. Juni 2001 18:13
An: pygame-users@seul.org
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
pygame.init()
screen = pygame.display.set_mode((300,300), OPENGL)
glClear(GL_COLOR_BUFFER_BIT)
#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
glRasterPos2i(20,20)
glDrawPixels(size[0], size[1], GL_RGBA, GL_UNSIGNED_BYTE, pix)
#all done!
pygame.event.pump()
pygame.time.delay(1000)
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org