[bmx] wxMax + minib3d by Warner [ 1+ years ago ]

Started by BlitzBot, June 29, 2017, 00:28:43

Previous topic - Next topic

BlitzBot

Title : wxMax + minib3d
Author : Warner
Posted : 1+ years ago

Description : Not sure if this is the best way to do this, but this is how I got this to work.

Code :
Code (blitzmax) Select
SuperStrict

Framework wx.wxApp
Import wx.wxFrame
Import wx.wxPanel
Import wx.wxGLCanvas
Import wx.wxglmax2D

Import wx.wxTimer

Import sidesign.minib3d

'Since i want to call 'refresh' from inside the timer, i need to store
'this handle. That way i can address 'prog.canvas'
Global prog:MyApp = New MyApp
prog.Run()

Type MyApp Extends wxApp

Field frame:wxFrame
Field panel:wxPanel
Field canvas:TMiniB3D

Method OnInit:Int()

'create a 640x480 window
frame = New wxFrame.Create(,,"MiniB3d Sample", 0, 0, 640, 480)
frame.Center()

'create a 320x240 wxPanel
panel = New wxPanel.Create(frame, wxID_ANY, 160, 0, 320, 240)
'create wxGLCanvas with minib3d on it
canvas = TMiniB3D(New TMiniB3D.Create(panel, wxID_ANY, GRAPHICS_BACKBUFFER|GRAPHICS_DEPTHBUFFER, 0, 0, 320, 240))

'create timer
Local timer:wxTimer = MyTimer(New MyTimer.Create())
timer.Start(25)

frame.show()

Return True

End Method

End Type

Type TMiniB3D Extends wxGLCanvas

Field init:Int = 0

Method OnPaint(event:wxPaintEvent)

'this could be done better, i'm sure, but for me it was the only way it works
'when onpaint is called, the canvas is valid and can be initialized by minib3d
If init = 0 Then

'init minib3d
SetGraphics CanvasGraphics2D( Self )
TGlobal.width = 320
TGlobal.height = 240
TGlobal.depth = 32
TGlobal.mode = 2
TGlobal.GraphicsInit()
init = 1

'function for creating camera's etc.
InitMB3D()

End If

'after that, every time onpaint is called, the scene can be rendered
RenderMB3D()

End Method

End Type

Global cam:TCamera
Global cube:TEntity

'setup camera and cube
Function InitMB3D()

cam  = CreateCamera()
cube = CreateCube()
MoveEntity cam, 0, 0, -5

EntityTexture cube, LoadTexture("C:Program FilesBlitzMaxdocshtmlmax120.png") 'hopefully you have this file too
EntityFX cube, 1

RenderWorld 'i need to do this in my modded version of minib3d, i don't think it is needed in the orig. version

End Function

'render stuff
Function RenderMB3D()

RenderWorld

BeginMax2D 'max2d works as well
DrawText "hello", 0, 0
EndMax2D

Flip

End Function

'timer
Type MyTimer Extends wxTimer

Field count:Int

Method Notify()
TurnEntity cube, 1, 2, 3 'turn cube
prog.canvas.Refresh() 'render scene
End Method

End Type


Comments : none...

Hardcoal

Hi Im trying to build the WX modules of WXMax in blide.. and I get this error for example

►wx.wxframe was scheduled to next iteration
In file included from D:/PORTABLE/BlitzMax/mod/wx.mod/wxframe.mod/glue.h:24:0,
                 from D:/PORTABLE/BlitzMax/mod/wx.mod/wxframe.mod/glue.cpp:23:
D:/PORTABLE/BlitzMax/mod/wx.mod/wxframe.mod/../wxstatusbar.mod/glue.h:31:19: fatal error: blitz.h: No such file or directory
compilation terminated.
Build Error: failed to compile D:/PORTABLE/BlitzMax/mod/wx.mod/wxframe.mod/glue.cpp
►►►►wx.wxframe was not built. See error information on latest attempt.


Any Ideas?
Code

Henri

Where did you download wx.mod ?

What is the MinGW version you are using ?

-Henri
- Got 01100011 problems, but the bit ain't 00000001

Hardcoal

#3
I downloaded it from brucey mods

https://libraries.io/github/maxmods

mingw version.. well how do i check it?

Im using blitzmax not blitzmax ng

Code

Henri

QuoteHow do I check MinGW version..

Run cmd and type gcc -v

Here is a more direct link to https://github.com/maxmods/wx.mod . Press the green Code button to download wx in zip file.

-Henri
- Got 01100011 problems, but the bit ain't 00000001

Hardcoal

#5
thanks henri . i did download it from there..

and the type gcc -v wrote me

C:\Users\Danny>type gcc -v
The system cannot find the file specified.
Error occurred while processing: gcc.
The system cannot find the file specified.
Error occurred while processing: -v.


[30 mins later update]

I downloaded the version from here https://code.google.com/archive/p/wxmax/downloads
and this one works..

[20 mins later again :)]

ok blide did built 187 files besides 3 that it didnt..
but now when i compile i get this type of errors

D:/PORTABLE/BlitzMax/mod/wx.mod/wx.mod/../lib/win32/libwxmsw28u_xrc.a(xrclib_xmlres.o):xmlres.cpp:(.text+0x15): undefined reference to `__gxx_personality_sj0'
D:/PORTABLE/BlitzMax/mod/wx.mod/wx.mod/../lib/win32/libwxmsw28u_xrc.a(xrclib_xmlres.o):xmlres.cpp:(.text+0xb8): undefined reference to `_Unwind_SjLj_Unregister'
D:/PORTABLE/BlitzMax/mod/wx.mod/wx.mod/../lib/win32/libwxmsw28u_xrc.a(xrclib_xmlres.o):xmlres.cpp:(.text+0xf5): undefined reference to `_Unwind_SjLj_Resume'
D:/PORTABLE/BlitzMax/mod/wx.mod/wx.mod/../lib/win32/libwxmsw28u_xrc.a(xrclib_xmlres.o):xmlres.cpp:(.text+0x137): undefined reference to `__gxx_personality_sj0'
D:/PORTABLE/BlitzMax/mod/wx.mod/wx.mod/../lib/win32/libwxmsw28u_xrc.a(xrclib_xmlres.o):xmlres.cpp:(.text+0x14a): undefined reference to `_Unwind_SjLj_Register'
D:/PORTABLE/BlitzMax/mod/wx.mod/wx.mod/../lib/win32/libwxmsw28u_xrc.a(xrclib_xmlres.o):xmlres.cpp:(.text+0x184): undefined reference to `_Unwind_SjLj_Unregister'
D:/PORTABLE/BlitzMax/mod/wx.mod/wx.mod/../lib/win32/libwxmsw28u_xrc.a(xrclib_xmlres.o):xmlres.cpp:(.text+0x1be): undefined reference to `_Unwind_SjLj_Resume'
D:/PORTABLE/BlitzMax/mod/wx.mod/wx.mod/../lib/win32/libwxmsw28u_xrc.a(xrclib_xmlres.o):xmlres.cpp:(.text+0x1f7): undefined reference to `__gxx_personality_sj0'
D:/PORTABLE/BlitzMax/mod/wx.mod/wx.mod/../lib/win32/libwxmsw28u_xrc.a(xrclib_xmlres.o):xmlres.cpp:(.text+0x20a): undefined reference to `_Unwind_SjLj_Register'
D:/PORTABLE/BlitzMax/mod/wx.mod/wx.mod/../lib/win32/libwxmsw28u_xrc.a(xrclib_xmlres.o):xmlres.cpp:(.text+0x244): undefined reference to `_Unwind_SjLj_Unregister'
D:/PORTABLE/BlitzMax/mod/wx.mod/wx.mod/../lib/win32/libwxmsw28u_xrc.a(xrclib_xmlres.o):xmlres.cpp:(.text+0x27e): undefined reference to `_Unwind_SjLj_Resume'
D:/PORTABLE/BlitzMax/mod/wx.mod/wx.mod/../lib/win32/libwxmsw28u_xrc.a(xrclib_xmlres.o):xmlres.cpp:(.text+0x2a2): undefined reference to `__gxx_personality_sj0'
D:/PORTABLE/BlitzMax/mod/wx.mod/wx.mod/../lib/win32/libwxmsw28u_xrc.a(xrclib_xmlres.o):xmlres.cpp:(.text+0x2c4): undefined reference to `_Unwind_SjLj_Register'
D:/PORTABLE/BlitzMax/mod/wx.mod/wx.mod/../lib/win32/libwxmsw28u_xrc.a(xrclib_xmlres.o):xmlres.cpp:(.text+0x389): undefined reference to `_Unwind_SjLj_Unregister'
D:/PORTABLE/BlitzMax/mod/wx.mod/wx.mod/../lib/win32/libwxmsw28u_xrc.a(xrclib_xmlres.o):xmlres.cpp:(.text+0x3ed): undefined reference to `_Unwind_SjLj_Resume'
D:/PORTABLE/BlitzMax/mod/wx.mod/wx.mod/../lib/win32/libwxmsw28u_xrc.a(xrclib_xmlres.o):xmlres.cpp:(.text+0x5a7): undefined reference to `__gxx_personality_sj0'
Code

Henri


@gcc error

That means that MinGW bin dir was not in your Windows path system variable,
which leads me to believe that MinGW is not installed by you (legacy has inbuilt MinGW).


@Build error

MinGW has two versions of exception models: dwarf and silj. Legacy bmax has inbuilt MinGW (old gcc 3.xx or something) that has dwarf model.
Old version of wx found at Google code needs older version of MinGW with silj model exceptions.

Ng has silj model gcc 8.xx by default.

You could try different MinGW versions with this installer found here https://sourceforge.net/projects/mingw-w64/

Just use the 32-bit architecture (i686)

DISCLAIMER!
BEFORE DOING ANYTHING PLEASE BACKUP YOUR BMAX FOLDER!

Legacy bmax has a lib folder that contains all the libraries used to build modules. These are specific to MinGW version.
You have to build all the modules with the same version or there will be errors..

This whole MinGW testing would be lot easier if you downloaded the newest version of bmk at https://github.com/bmx-ng/bmk
By using this you don't need to replace the libraries in bmax lib folder for every MinGW change you want to test,
just rename the newly installed MinGW folder to MinGW32 and copy it to bmax folder and rebuild all modules.

Also,better to first compile default modules and test that they are working before trying to compile wx mod.

-Henri

- Got 01100011 problems, but the bit ain't 00000001

Hardcoal

I downloaded the MinGw you offered.. so youre saying i only need to put it on the blitzmax folder?
no need installation?
than rebuild all modules?

also ive downloaded the bmk masters ..  but it needs compiling..
isnt there a compiled version made already?

sorry those things are beyond my knowledge.

anyway.. im experimenting and see what happen
Code

Henri

Just compile the bmk.bmx as console app and not as a gui app and in release mode. Optionally you can also enable threading.
And as the website instructions say copy the resulting bmk.exe, make.bmk, custom.bmk and core.bmk to your bmax bin folder (do not overwrite anything, just rename the original so they are safe)

After this you can install MinGW to <your_bmax_folder>/MinGW32 or MinGWx86 (as in 32-bit).

Then you can try to rebuild your modules..

-Henri
- Got 01100011 problems, but the bit ain't 00000001