|
Post by vincentvangoria on Feb 14, 2008 17:24:25 GMT -5
Can anyone tell me how I can place 2d sprites over a 3d background? I need them to be transparent, too. Thanks!
|
|
|
Post by matthew on Feb 14, 2008 20:16:00 GMT -5
Hi vincent, welcome to the forum. I can't help you with your first question about 'placing 2d sprites over a 3d background' as I've never had to do something similar. But maybe someone else on the forum can help you. As for sprite transparency, if you look in the Basic4GL Data folder you'll notice that the sprites are saved in the .png format and their dimensions are either 16x16, 32x32 or 64x64. I recommend you use the .png format and keep to those sizes to avoid complications. If you need an image editor, try Paint.NET or The Gimp.
|
|
|
Post by timid on Feb 15, 2008 1:40:21 GMT -5
well vincent,
i guess you should check the nehe8.gb tutorial.
there are used textures,lightning,blending, and filtering for textures on 3d objects.
hope it helps
|
|
|
Post by Tom Mulgrew on Feb 15, 2008 16:39:10 GMT -5
Can anyone tell me how I can place 2d sprites over a 3d background? I need them to be transparent, too. Thanks! Sprites are drawn when text is drawn, so they're controlled by the same commands. TextMode(TEXT_OVERLAID) will set the text (and sprites) to be drawn over the top of whatever else you draw on the screen, and only when you call: DrawText() Example: ' Overlay text and sprites on top of rendered image TextMode(TEXT_OVERLAID) ' Create a sprite dim sprite sprite = NewSprite(LoadTexture("data\ball.png")) SprSetSize(20, 20) ' Main animation loop dim ang# do ' Clear the screen glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT)
' Draw a spinning coloured triangle glLoadIdentity() glTranslatef(0, 0, -8) glRotatef(ang#, 0, 0, 1) glBegin(GL_TRIANGLES) glColor3f(1, 0, 0): glVertex2f(0, 2) glColor3f(0, 1, 0): glVertex2f(-2, -1) glColor3f(0, 0, 1): glVertex2f( 2, -1) glEnd()
' Draw text & sprites over the top DrawText()
' Show the completed image SwapBuffers() ' Make sprite follow the mouse position SprSetPos(mouse_x() * SpriteAreaWidth(), mouse_y() * SpriteAreaHeight())
' Spin the triangle ang# = ang# + 1 loop -Tom
|
|