Topic: ib3d with maxgui ?

Hi All smile
Is it possible to use ib3d with maxgui?
If so How would i setup a camera to work in a canvas?

Thankx
Doug

Re: ib3d with maxgui ?

greetings Doug smile  it should be possible to get iB3D running with MaxGUI but not in the format it is now.  i currently dont use the creation params required to set it up.  it shouldnt be difficult though.  ill see if i can whip something up this evening.

Re: ib3d with maxgui ?

i can confirm that MaxGUI works with iB3D but as i expected it does require an update to iB3D.  i will see if i can get out an updated version tomorrow.

Re: ib3d with maxgui ?

Excellent, thank you very much gman smile

Re: ib3d with maxgui ?

Hummmmm, I have MaxGui, and it not all that, I would try and use the Irrlicht GUI commands instead.

Unless....... GMan is going to make a IrrMaxGUI wink

Re: ib3d with maxgui ?

I have a project iv'e been working on for some time that uses maxgui, so i'm hoping i can save some time smile

Re: ib3d with maxgui ?

Hi gman, may i ask how the update is coming along? smile



Thankx
Doug

Re: ib3d with maxgui ?

greetings doug smile  my apologies on the delay.  the mods have been updated (see the announcements forum).  here is a quick sample to run from the examples Win32Window folder:

' this is an example showing how to display Irrlicht in a panel on a MaxGUI form.  i have modified it a bit
' by adding an eventreceiver to the Irrlicht instance to show how MaxGUI and Irrlicht events can coexist.
' it is important to note that there still is probably some issues to work out, but for now this works.
'
' NOTE: press the 'w' key to toggle wireframe

SuperStrict 
Framework Irrlicht.B3D

Import BRL.Basic
Import BRL.Win32MaxGUI
Import BRL.EventQueue

Local window:TGadget
Local panel:TGadget

Local windowWidth:Int = 440
Local windowHeight:Int = 380

window=CreateWindow("Irrlicht Win32 BlitzMax window example",100,100, ..
    windowWidth,windowHeight,Null,WINDOW_TITLEBAR | WINDOW_CLIENTCOORDS | WINDOW_HIDDEN)

' create window To put irrlicht in
Local hIrrlichtWindow:TGadget=CreatePanel(50,80,320,220,window,PANEL_ACTIVE|PANEL_BORDER)

' create ok button
Local Ok:TGadget=CreateButton("OK - Close",windowWidth - 160,windowHeight - 40,150,30,window)

' this is not in the original, but is here to show you can have a textbox and enter into it
' without the events posting to Irrlicht
Local tb:TGadget=CreateTextField(windowWidth - 160,windowHeight - 70,150,20,window)

' create some text
CreateLabel("This is Irrlicht running inside a Win32 MaxGUI window.",20,20,400,40,window)
    
Local param:SIrrlichtCreationParameters=SIrrlichtCreationParameters.create()
param.setWindowId(QueryGadget(hIrrlichtWindow,QUERY_HWND))
param.setDriverType(EDT_OPENGL)

' create the device from the params object and initialize iB3D
ib3d_Graphics3DParams(param)

' setup a simple 3d scene

Local cam:CAMERA = ib3d_CreateCamera()
ib3d_MoveEntity(cam,0,20,-20)

Local cube:PRIMITIVE = ib3d_CreateCube()

ib3d_EntityTexture(cube,ib3d_LoadTexture:TEXTURE("../../media/wall.bmp"),0,0)
ib3d_EntityTexture(cube,ib3d_LoadTexture:TEXTURE("../../media/water.jpg"),0,1)
ib3d_EntityFX(cube,EMF_LIGHTING,False)
ib3d_EntityBlend(cube,EMT_REFLECTION_2_LAYER)

ib3d_PointEntity(cam,cube)

' show And execute dialog
ShowGadget(window)

' do message queue

Local bWireFrame:Int = False

While (True)

    ib3d_UpdateWorld()
    ib3d_RenderWorld()

    If PeekEvent() Then 
        PollEvent()
        Select EventID()
            Case EVENT_WINDOWCLOSE
                Exit
            Case EVENT_GADGETACTION
                If EventSource()=Ok
                    PostEvent(CreateEvent(EVENT_WINDOWCLOSE,Ok))
                EndIf
            Default
                ActivateGadget(hIrrlichtWindow)
                If EventID()=EVENT_KEYDOWN And EventData()=KEY_W
                    bWireFrame = Not bWireFrame
                    ib3d_EntityFX(cube,EMF_WIREFRAME,bWireFrame)                    
                EndIf
        End Select
    End If        
    
Wend

ib3d_EndGraphics()

Re: ib3d with maxgui ?

Thank you very much gman, this is very much Appreciated smile



Thankx
Doug

10 (edited by Doug Cohen 2007-05-11 11:55:15)

Re: ib3d with maxgui ?

Excellent work gman, works great, just one thing though, do shadows work with ib3d?

I added the below to my scene:

'create light
Local LIGHT:LIGHT=ib3d_CreateLight()
ib3d_LightColor(LIGHT,255,255,255)
ib3d_LightRange(LIGHT,1000)
ib3d_LightCastShadows(LIGHT,True)
ib3d_PositionEntity(LIGHT,-3,4,-3 )

and also added

ib3d_EntityFX(all_models,EMF_LIGHTING,True)

Re: ib3d with maxgui ?

I tried this and got : "Attempt to access field or method of null object" on the create window line:

Re: ib3d with maxgui ?

greetings smile  i assume you have MaxGUI installed and updated?  which version of BlitzMax are you using?