Code: Select all
Enumeration
#MainWindow
EndEnumeration
InitEngine3D()
Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Textures", #PB_3DArchive_FileSystem)
InitSprite()
InitKeyboard()
InitMouse()
w.l = 800
h.l = 600
OpenWindow(0, 0, 0, w, h, "transparent texture", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
OpenWindowedScreen(WindowID(0), 0, 0, w, h, 0, 0, 0)
AmbientColor(RGB(255, 255, 255))
;- Camera
CreateCamera(0, 0, 0, 100, 100)
CameraFOV(0, 50)
MoveCamera(0, 0, 0, 100, #PB_Absolute)
CameraLookAt(0,0,0,0)
CameraBackColor(0, $996633)
; Cube
wt.l = 512
ht.l = 512
a.l = 255
; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; Loaded Texture - WORKS
LoadTexture(0, "ground_diffuse.png")
; Material
CreateMaterial(0, TextureID(0))
MaterialBlendingMode(0, #PB_Material_AlphaBlend)
SetMaterialColor(0, #PB_Material_DiffuseColor, RGBA(255, 255, 255, a))
;DisableMaterialLighting(0, #True)
; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; Custom Texture - DOESN'T WORK
; CreateTexture(0, wt, ht, "cube")
; StartDrawing(TextureOutput(0))
; FillArea(1, 1, -1, $ffffff)
; FrontColor(RGB(255, 0, 255))
; Circle(wt/2, ht/2, wt/2 - 2, $999933)
; StopDrawing()
; Material
; CreateMaterial(0, TextureID(0))
; MaterialBlendingMode(0, #PB_Material_AlphaBlend)
; SetMaterialColor(0, #PB_Material_DiffuseColor, RGBA(255, 255, 255, a))
; Mesh
CreateCube(0, 40)
CreateEntity(0, MeshID(0), MaterialID(0), 0, 0, 0)
go.l = #True
Repeat
ExamineKeyboard()
Repeat : Event = WindowEvent() : Until Event = 0
RotateEntity(0, 0, 1, 0, #PB_Relative)
SetMaterialColor(0, #PB_Material_DiffuseColor, RGBA(255, 255, 255, a))
If go : a - 1 : Else : a + 1 : EndIf
If a = 0 : go = #False : EndIf
If a = 255 : go = #True : EndIf
RenderWorld()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
End