http://www.mediafire.com/?2y6wu85z6tovxy8
but i don't see reflection. i have done a million experimnets but failed.
PS: i have corrected the code on the light of the code posted by Fred, now the Ogrehead textured and it is reflecting a real time rotating red cube also the plane beneath
use this texture to texture the ogre head with gold

the texture are added using
AddMaterialLayer(1, TextureID(4) , #PB_Material_Modulate )

the material script i have used is the same in the docs:
Code: Select all
material CubeMapMaterial
{
technique
{
pass
{
texture_unit
{
cubic_texture CubeMapTexture combinedUVW
tex_address_mode clamp
env_map cubic_reflection
}
}
}
}Code: Select all
Enumeration
#MESH
#TEXTURE
#TEX
#MATERIAL
#ENTITY
#CAMERA_ONE
#LIGHT
#cube
#cube2
EndEnumeration
;Set the width, height and bit depth of the screen
;Abbreviated variables are used here due to page width constraints :(
;Global ScrW.l = 1024
;Global ScrH.l = 768
Global ScrW.l = 800
Global ScrH.l = 600
Global ScrD.l = 32
;Other global variables
Global Quit.b = #False
;Simple error checking procedure
Procedure HandleError(Result.l, Text.s)
If Result = 0
MessageRequester("Error", Text, #PB_MessageRequester_Ok)
End
EndIf
EndProcedure
;Initialize environment
HandleError(InitEngine3D(), "InitEngine3D() command failed.")
HandleError(InitSprite(), "InitSprite() command failed.")
HandleError(OpenScreen(ScrW, ScrH, ScrD, ""), "Could not open screen.")
HandleError(InitKeyboard(), "InitKeyboard() command failed.")
SetFrameRate(60)
Add3DArchive("Data\", #PB_3DArchive_FileSystem)
Add3DArchive(".", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Textures", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "Examples/Sources\Data", #PB_3DArchive_FileSystem)
Parse3DScripts()
;SkyDome("clouds.jpg",2)
MyCubeMap = CreateCubeMapTexture(#PB_Any, 256, 256, "CubeMapTexture")
GetScriptMaterial(1,"CubeMapMaterial")
SetMaterialColor(1, #PB_Material_SelfIlluminationColor, $FFFFFF)
Mesh = LoadMesh(#PB_Any,"ogrehead.mesh")
Entity = CreateEntity(#PB_Any,MeshID(Mesh),MaterialID(1))
EntityCubeMapTexture(MyCubeMap, Entity)
MoveEntity(Entity, 0,0,0)
CreateMaterial(4, LoadTexture(4, "gold.png"))
;;0000000000000000000000000000000000000000000000
CreateCube(#cube,10)
CreateMaterial(2, LoadTexture(2, "MRAMOR6X6.jpg"))
MaterialCullingMode(2, #PB_Material_NoCulling)
DisableMaterialLighting(1, 0)
CreateEntity(#cube, MeshID(#cube), MaterialID(2))
ScaleEntity(#cube, 10,0.1,10)
MoveEntity(#cube, 0,-30,0)
CopyMesh(#cube, #cube2)
CreateMaterial(3, LoadTexture(3, "Geebee2.bmp"))
CreateEntity(#cube2, MeshID(#cube2), MaterialID(3))
ScaleEntity(#cube2, 0.7,0.7,0.7)
MoveEntity(#cube2, -30,10,0)
AddMaterialLayer(1, TextureID(4) , #PB_Material_Modulate )
CreateLight(#LIGHT, RGB(255,255,255),12.9, 72, 15.7)
CreateCamera(#CAMERA_ONE, 0, 0, 100, 100)
MoveCamera(#CAMERA_ONE, 0, 30, 100)
;Main loop
Repeat
CameraLookAt(#CAMERA_ONE, 0, 0, 0)
MoveEntity(#cube2,0, 0, -0.1, #PB_Local)
RotateEntity(#cube2, 0, -1, 0, #PB_Relative)
RenderWorld()
FlipBuffers()
ExamineKeyboard()
If KeyboardReleased(#PB_Key_Escape)
Quit = #True
EndIf
Until Quit = #True
EndCode: Select all
Enumeration
#mainwin
#MESH
#TEXTURE
#TEX
#MATERIAL
#ENTITY
#CAMERA_ONE
#LIGHT
#cube
#cube2
EndEnumeration
Global Quit.b = #False
;Simple error checking procedure
Procedure HandleError(Result.l, Text.s)
If Result = 0
MessageRequester("Error", Text, #PB_MessageRequester_Ok)
End
EndIf
EndProcedure
ExamineDesktops()
OpenWindow(#mainwin, 0, 0, DesktopWidth(0), DesktopHeight(0), "cube mapping reflection ", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
;Initialize environment
HandleError(InitEngine3D(), "InitEngine3D() command failed.")
HandleError(InitSprite(), "InitSprite() command failed.")
;HandleError(OpenScreen(ScrW, ScrH, ScrD, ""), "Could not open screen.")
HandleError(InitKeyboard(), "InitKeyboard() command failed.")
OpenWindowedScreen(WindowID(#mainwin), 0, 0, DesktopWidth(0), DesktopHeight(0)-60, 0, 0, 0)
SetFrameRate(60)
Add3DArchive("Data\", #PB_3DArchive_FileSystem)
Add3DArchive(".", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Textures", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "Examples/Sources\Data", #PB_3DArchive_FileSystem)
Parse3DScripts()
;SkyDome("clouds.jpg",2)
MyCubeMap = CreateCubeMapTexture(#PB_Any, 256, 256, "CubeMapTexture")
GetScriptMaterial(1,"CubeMapMaterial")
SetMaterialColor(1, #PB_Material_SelfIlluminationColor, $FFFFFF)
Mesh = LoadMesh(#PB_Any,"ogrehead.mesh")
Entity = CreateEntity(#PB_Any,MeshID(Mesh),MaterialID(1))
EntityCubeMapTexture(MyCubeMap, Entity)
MoveEntity(Entity, 0,0,0)
CreateMaterial(4, LoadTexture(4, "gold.png"))
;;0000000000000000000000000000000000000000000000
CreateCube(#cube,10)
CreateMaterial(2, LoadTexture(2, "MRAMOR6X6.jpg"))
MaterialCullingMode(2, #PB_Material_NoCulling)
DisableMaterialLighting(1, 0)
CreateEntity(#cube, MeshID(#cube), MaterialID(2))
ScaleEntity(#cube, 10,0.1,10)
MoveEntity(#cube, 0,-30,0)
CopyMesh(#cube, #cube2)
CreateMaterial(3, LoadTexture(3, "Geebee2.bmp"))
CreateEntity(#cube2, MeshID(#cube2), MaterialID(3))
ScaleEntity(#cube2, 0.7,0.7,0.7)
MoveEntity(#cube2, -30,10,0)
AddMaterialLayer(1, TextureID(4) , #PB_Material_Modulate )
CreateLight(#LIGHT, RGB(255,255,255),12.9, 72, 15.7)
CreateCamera(#CAMERA_ONE, 0, 0, 100, 100)
MoveCamera(#CAMERA_ONE, 0, 30, 100)
;Main loop
Repeat
Event = WindowEvent()
CameraLookAt(#CAMERA_ONE, 0, 0, 0)
MoveEntity(#cube2,0, 0, -0.1, #PB_Local)
RotateEntity(#cube2, 0, -1, 0, #PB_Relative)
RenderWorld()
FlipBuffers()
ExamineKeyboard()
If KeyboardReleased(#PB_Key_Escape) Or Event = #PB_Event_CloseWindow
Quit = #True
EndIf
Until Quit = #True
End


