PDA

View Full Version : drawing



darkhorror
09-19-2000, 05:06 PM
I want to draw a 2d image that will be like using a transparent CopyBits(); can I do that after loading a TK_RGBImageRec? I already know how to draw it using glBegin(GL_POLYGON)
glEnd();
but is there something I can do so it doesn't draw the white area?

tdavie
09-20-2000, 06:06 AM
All you need is a bit of alpha blending:
Do everything as normal except for a few extra tweaks: in your initialiseation, call glEnable (GL_BLEND); you then need to specify how OpenGL calculates the blending so you specify your blending function: glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); (note these are just what I would suggest and not the be all and end all).
Then when you draw your polygons, specify the colours of the verticies useing glColor4f (red, green, blue, alpha); the alpha values specify how transparent or opaque a polygon is, if you just want your texture to appear and no colour added to the polygon call glColor4f (1.0, 1.0, 1.0, 0.5); (or whatever alpha value you like).
http://www.opengl.org/discussion_boards/ubb/biggrin.gif