PFC![]() Member Posts: 29 From: Canada Registered: 10-16-2007 |
well... so far I've been able to build an mmorpg game engine (3D) using python, Pygame(SDL) and PyOpenGL(OpenGL)... and it worked... only one little problem... I can't seem to figure out how to display text on the screen... I have been researching how to use multiple layers in pygame, but I can't seem to get it to work and I don't want to render 3d text in GL. does anyone know how to use multiple layers with an alpha colour set so that I can place text on top of the OpenGL rendered graphics? Note: I can't use screen.blit(source,rect) since an OpenGL enabled screen can't be blited... instead I use pygame.display.flip() here is the basic code I use: pygame.init() # init pygame win_size =(640,480) glEnable(GL_DEPTH_TEST) #GL related functions, nothing to do with pygame while 1: #THE FOLLOWING MUST BE INDENTED,THE BOARD DOEST SHOW SPACES ------------------ [This message has been edited by PFC (edited October 23, 2007).] |
|
CPUFreak91![]() Member Posts: 2337 From: Registered: 02-01-2005 |
quote: As far as I know, Pygame doesn't support layers. You have to blit items on top of each other with no special layer properties (you could create "layers" with some functions). To set something with an alpha you might want to use surfarray: http://www.pygame.org/docs/ref/surfarray.html I haven't played with surfarray myself so I don't know how well it works with text. PS> You can use tabs and spaces in your code by putting your source code in
------------------ "Oh, bother," said the Borg. "We've assimilated Pooh." Any fool can know, the point is to understand. -- Albert Einstein |
|
PFC![]() Member Posts: 29 From: Canada Registered: 10-16-2007 |
Update thanks for the hint about posting code I can't use the layers in pygame since I can't blit the screen when in OpenGL mode and the SDL OpenGLBlit doesn't work...(so therefor pygame can't do it) I got text semi-working in PyOpenGL and PyGame..... turns out that there is no documentation for this and that the only way to draw text on the screen is to render an image from text and then place this image as texture on an object in OpenGL if anyone wants the code, just ask ------------------ [This message has been edited by PFC (edited October 24, 2007).] |