However, after putting a value with SetMaterialColor() to the material, then when reading it back with GetMaterialColor() , the readed value is wrong.
Code: Select all
RX.u=1024:RY.u=768
InitEngine3D()
InitSprite():InitKeyboard():InitMouse()
OpenWindow(0,0,0,RX,RY,"tip",#PB_Window_BorderLess|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0),0,0,RX,RY,0,0,0,#PB_Screen_WaitSynchronization)
Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Textures", #PB_3DArchive_FileSystem)
Parse3DScripts()
luz.i=CreateLight(#PB_Any,$EEEEEE,4,4,2,#PB_Light_Point)
camara.i=CreateCamera(#PB_Any,0,0,100,100)
MoveCamera(camara.i,0,0,3,#PB_Absolute)
cuerpotextura.i=LoadTexture(#PB_Any,"soil_wall.jpg")
cuerpomaterial.i=CreateMaterial(#PB_Any,TextureID(cuerpotextura.i))
cuerpomalla.i=CreateSphere(#PB_Any,0.5)
cuerpo.i=CreateEntity(#PB_Any,MeshID(cuerpomalla.i),MaterialID(cuerpomaterial.i))
MaterialBlendingMode(cuerpomaterial.i,#PB_Material_AlphaBlend)
SetMaterialColor(cuerpomaterial.i,#PB_Material_DiffuseColor,RGBA($FF,$FF,$FF,$AF))
Repeat
ExamineKeyboard()
If KeyboardReleased(#PB_Key_M)
SetMaterialColor(cuerpomaterial.i,#PB_Material_DiffuseColor,RGBA($FF,$FF,$FF,$6F))
Debug Hex(Alpha(GetMaterialColor(cuerpomaterial.i,#PB_Material_DiffuseColor)),#PB_Long); <- got $FF (should be $6F)
ElseIf KeyboardReleased(#PB_Key_N)
SetMaterialColor(cuerpomaterial.i,#PB_Material_DiffuseColor,RGBA($FF,$FF,$FF,$AF))
Debug Hex(Alpha(GetMaterialColor(cuerpomaterial.i,#PB_Material_DiffuseColor)),#PB_Long); <- got $FF (should be $AF)
EndIf
RenderWorld()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)