Colorcode wrong?

Everything related to 3D programming
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Colorcode wrong?

Post by Bananenfreak »

Heyho,

why this is blue: $FF0000
while this is red?: $0000FF
It has to be the opposite way (RGB)...
Code is my purepunchcode, so I shortened it to this:

Code: Select all

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;>>                             >>
;>>  Name: Colorcode            >>
;>>                             >>
;>>  Author: Bananenfreak       >>
;>>                             >>
;>>  Date: 10.07.2014           >>
;>>                             >>
;>>  OS: Windows                >>
;>>                             >>
;>>                             >>
;>>                             >>
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
EnableExplicit


Structure Vektor3
  x.d
  y.d
  z.d
EndStructure


Define.Vektor3 cam
Define.i Quit, event
Global NewList Orte.s()
#kam_0 = 0
#window = 0
#plane = 0
#light = 0
#tex_0 = 0
#mat_0 = 0
#node_0 = 0


Enumeration Entities
  #planent
EndEnumeration


Procedure Fenster()
  OpenWindow(#window, 0, 0, 1000, 500, "COM-Calculator", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
  OpenWindowedScreen(WindowID(#window), 10, 10, 500, 480, 0, 500, 500, #PB_Screen_SmartSynchronization)
EndProcedure


If InitEngine3D()
  InitSprite()
  InitKeyboard()
  
  Add3DArchive("/", #PB_3DArchive_FileSystem)
  Parse3DScripts()
  
  Fenster()
  
  ;-Licht
  CreateLight(#light, RGB(255, 255, 255), 30, 20, 30)
  WorldShadows(#PB_Shadow_TextureAdditive, 200, RGB(255 * 0.2, 255 * 0.2, 255 * 0.2), 4096)
  AmbientColor(RGB(255 * 0.2, 255 * 0.2, 255 * 0.2))
  
  CreatePlane(#plane, 100, 100, 100, 100, 100, 100)
  CreateTexture(#tex_0, 128, 128)
  StartDrawing(TextureOutput(#tex_0))
  Box(0, 0, 128, 128, RGB(255, 255, 255))
  Box(64, 0, 64, 64, $0000FF)
  Box(0, 64, 64, 64, RGB(0, 0, 255))
  StopDrawing()
  CreateMaterial(#mat_0, TextureID(#tex_0))
  CreateEntity(#planent, MeshID(#plane), MaterialID(#mat_0), 0, 0, 0)
  
  ;-Node
  CreateNode(#node_0, 0, 0, 0)
  
  ;-Camera
  CreateCamera(#kam_0, 0, 0, 100, 100)
  cam\x = 10
  cam\y = 10
  cam\z = 10
  MoveCamera(#kam_0, cam\x, cam\y, cam\z, #PB_Absolute)
  CameraLookAt(#kam_0, 0, 0, 0)
  CameraBackColor(#kam_0, RGB(50, 50, 250))
  AttachNodeObject(#node_0, CameraID(#kam_0))
  
  
  Repeat
    Repeat
      event = WindowEvent()
      
      Select event
          
        Case #PB_Event_CloseWindow
          Quit = 1
          
      EndSelect
    Until event = 0
    
    
    ExamineKeyboard()
    RenderWorld()
    FlipBuffers()
  Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
  
Else
  MessageRequester("Error", "The 3D Engine can't be initialized", 0)
EndIf

End
Image
Fred
Administrator
Administrator
Posts: 16618
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Colorcode wrong?

Post by Fred »

No, in PB $FF is red, so $FF0000 is blue. You should use the RGB() command anyway to be on the safe side.
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: Colorcode wrong?

Post by Bananenfreak »

So german doc is wrong. Thank you fred for your quick help :)
Image
Post Reply