i have noticed this with CreateLine3D long time ago when we compile the code with option opengl
compiler -> compiler options -> Library subsystem : opengl
it produce the same S.T picture. since in mac and linux the opengl is the default
so in mac if you want to draw red (within CreateLine3D function) use rgb(0,0,255)
or use another approach is to draw a line by plotting 2 points with a parameter #PB_Mesh_LineList and it will give the same color whether in windows or mac
these thick lines works only in opengl compiler option, the function which define the thickness is:
glLineWidth_(10) ; this is an opengl only function

note the camera position, change it from MoveCamera(#camera, 5, 10, 20, #PB_Absolute)
to MoveCamera(#camera, 5, 10, -20, #PB_Absolute)
and naturally the red X will be in the left if we fixed the camera eye on 0,0,0
Code: Select all
Define.f KeyX, KeyY, MouseX, MouseY
#camera = 0
ExamineDesktops()
OpenWindow(0, 0, 0, DesktopWidth(0), DesktopHeight(0), " ... move/ rotate the cam with arrow keys and mouse", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
;Initialize environment
InitEngine3D()
InitSprite()
OpenWindowedScreen(WindowID(0), 0, 0, DesktopWidth(0), DesktopHeight(0), 0, 0, 0)
InitKeyboard()
InitMouse()
Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Textures", #PB_3DArchive_FileSystem)
;Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Scripts",#PB_3DArchive_FileSystem)
;Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Packs/desert.zip", #PB_3DArchive_Zip)
;Parse3DScripts()
CreateCamera(#camera, 0, 0, 100, 100)
MoveCamera(#camera, 5, 10, 20, #PB_Absolute)
;CameraFOV(#camera, 70)
CameraLookAt(#camera,0,0,0)
CreateMesh(0, #PB_Mesh_LineList , #PB_Mesh_Static)
;note above the #PB_Mesh_LineList so a line will be drawn between every pair of points
MeshVertexPosition(0, 0, 0)
MeshVertexColor(RGB(255,0,0)) ; color of the above point
MeshVertexPosition(10, 0, 0)
MeshVertexColor(RGB(255,0,0))
MeshVertexPosition(0, 0, 0)
MeshVertexColor(RGB(0,255,0))
MeshVertexPosition(0, 10, 0)
MeshVertexColor(RGB(0,255,0))
MeshVertexPosition(0, 0, 0)
MeshVertexColor(RGB(0,0,255))
MeshVertexPosition(0, 0, 10)
MeshVertexColor(RGB(0,0,255))
glLineWidth_(10) ; this is an opengl only function
FinishMesh(#True)
;imagine the entity (the 3 lines is painted with white color and then we paint the lines in specific colores
CreateMaterial(0, LoadTexture(0, "White.jpg"))
DisableMaterialLighting(0, #True)
SetMeshMaterial(0, MaterialID(0))
CreateEntity(0,MeshID(0),MaterialID(0) ) ; the 3 lines
Repeat
Event = WindowEvent()
If ExamineMouse()
MouseX = -MouseDeltaX()/20
MouseY = -MouseDeltaY()/20
EndIf
If ExamineKeyboard()
If KeyboardPushed(#PB_Key_Left)
KeyX = -0.5
ElseIf KeyboardPushed(#PB_Key_Right)
KeyX = 0.5
Else
KeyX = 0
EndIf
If KeyboardPushed(#PB_Key_Up)
KeyY = -0.5
ElseIf KeyboardPushed(#PB_Key_Down)
KeyY = 0.5
Else
KeyY = 0
EndIf
EndIf
RotateCamera(#Camera, MouseY, MouseX, 0, #PB_Relative)
MoveCamera(#Camera, KeyX, 0, KeyY)
RenderWorld()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
End
or with Screen3DRequester
Code: Select all
IncludeFile #PB_Compiler_Home + "Examples/3D/Screen3DRequester.pb"
Define.f KeyX, KeyY, MouseX, MouseY
#camera = 0
If InitEngine3D()
Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Textures", #PB_3DArchive_FileSystem)
; Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Scripts",#PB_3DArchive_FileSystem)
; Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Packs/desert.zip", #PB_3DArchive_Zip)
Parse3DScripts()
InitSprite()
InitKeyboard()
InitMouse()
If Screen3DRequester()
CreateCamera(#camera, 0, 0, 100, 100)
MoveCamera(#camera, 5, 10, 20, #PB_Absolute)
;CameraFOV(#camera, 70)
CameraLookAt(#camera,0,0,0)
CreateMesh(0, #PB_Mesh_LineList , #PB_Mesh_Static)
x.f = 0
y.f = 0
z.f = 0
MeshVertexPosition(0, 0, 0)
MeshVertexColor(RGB(255,0,0))
MeshVertexPosition(10, 0, 0)
MeshVertexColor(RGB(255,0,0))
MeshVertexPosition(0, 0, 0)
MeshVertexColor(RGB(0,255,0))
MeshVertexPosition(0, 10, 0)
MeshVertexColor(RGB(0,255,0))
MeshVertexPosition(0, 0, 0)
MeshVertexColor(RGB(0,0,255))
MeshVertexPosition(0, 0, 10)
MeshVertexColor(RGB(0,0,255))
glLineWidth_(10) ; this is an opengl function
FinishMesh(#True)
;imagine the entity (the 3 lines is painted with white color and then we paint the lines in specific colores
CreateMaterial(0, LoadTexture(0, "White.jpg"))
DisableMaterialLighting(0, #True)
SetMeshMaterial(0, MaterialID(0))
CreateEntity(0,MeshID(0),MaterialID(0) )
Repeat
Screen3DEvents()
If ExamineMouse()
MouseX = -MouseDeltaX()/20
MouseY = -MouseDeltaY()/20
EndIf
If ExamineKeyboard()
If KeyboardPushed(#PB_Key_Left)
KeyX = -0.5
ElseIf KeyboardPushed(#PB_Key_Right)
KeyX = 0.5
Else
KeyX = 0
EndIf
If KeyboardPushed(#PB_Key_Up)
KeyY = -0.5
ElseIf KeyboardPushed(#PB_Key_Down)
KeyY = 0.5
Else
KeyY = 0
EndIf
EndIf
RotateCamera(#camera, MouseY, MouseX, 0, #PB_Relative)
MoveCamera(#camera, KeyX, 0, KeyY)
;RotateEntity(0, 0.5,1,0.5,#PB_Relative)
RenderWorld()
Screen3DStats()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
EndIf
Else
MessageRequester("Error", "The 3D Engine can't be initialized",0)
EndIf
End