1)
For alpha blending, you can use:
TBGL_BlendFunc(%GL_SRC_ALPHA, %GL_ONE_MINUS_SRC_ALPHA)
TBGL_PushState(%TBGL_Blend)
...
TBGL_PopState
So here comes whole example:
Uses "TBGL"
Function TBMain()
Local hWnd As DWord
Local FrameRate As Double
' -- Create and show window
hWnd = TBGL_CreateWindowEx("TBGL script - press ESC to quit", 640, 480, 32, %TBGL_WS_WINDOWED Or %TBGL_WS_CLOSEBOX)
TBGL_ShowWindow
' -- Initialize lighting
TBGL_UseLighting(%TRUE)
TBGL_UseLightSource(%GL_LIGHT0, %TRUE)
TBGL_SetLightParameter(%GL_LIGHT0, %TBGL_LIGHT_POSITION, 10, 10, 10, 1)
' -- Setup material 1
' -- Create new materials
Global mBlue As Long = TBGL_NewMaterial
Global mGreen As Long = TBGL_NewMaterial
' -- Set properties
TBGL_SetMaterialDiffuse(mBlue, 0, 0, 255)
TBGL_SetMaterialAmbient(mBlue, 0, 0, 255)
TBGL_SetMaterialSpecular(mBlue, 255, 255, 255)
TBGL_SetMaterialSpecularExponent(mBlue, 128)
TBGL_SetMaterialDiffuse(mGreen, 0, 255, 0, 128)
TBGL_SetMaterialAmbient(mGreen, 0, 255, 0)
TBGL_SetMaterialSpecular(mGreen, 255, 255, 255)
TBGL_SetMaterialSpecularExponent(mGreen, 128)
' -- Resets status of all keys
TBGL_ResetKeyState()
' -- Main loop
While TBGL_IsWindow(hWnd)
FrameRate = TBGL_GetFrameRate
TBGL_ClearFrame
TBGL_Camera(5, 5, 10, 0, 0, 0)
' -- Transform
TBGL_PushMatrix
' -- Material
TBGL_PushMaterial mBlue
TBGL_Sphere 1
TBGL_PopMaterial
TBGL_PopMatrix
' -- Transform
TBGL_PushMatrix
TBGL_Translate 0.5, 0.5, 0
' -- Blending
TBGL_BlendFunc(%GL_SRC_ALPHA, %GL_ONE_MINUS_SRC_ALPHA)
TBGL_PushState(%TBGL_BLEND)
' -- Material
TBGL_PushMaterial mGreen
TBGL_Sphere 1
TBGL_PopMaterial
TBGL_PopState
TBGL_PopMatrix
TBGL_DrawFrame
' -- ESCAPE key to exit application
If TBGL_GetWindowKeyState(hWnd, %VK_ESCAPE) Then Exit While
Wend
TBGL_DestroyWindow
End Function
2)
You should be able to use FreeGlut primitives for example. Try it out, if you have time.
3)
I don't want to force you to do anything, but I would strongly recommend to upgrade to Firefox 5/6.
Petr
Bookmarks