opengl in blitzplus?

Community Forums/General Help/opengl in blitzplus?

meems(Posted 2016) [#1]
Can it be done? If so how?


xlsior(Posted 2016) [#2]
Yes, Blitzplus has OpenGL built-in, but just for 2D.

I don't remember how to change the default graphics driver from DirectX to OpenGl within Blitzplus, though.

There's also a 3D library for Blitzplus that uses OpenGL: http://www.blitzbasic.com/Community/posts.php?topic=102744


Rick Nasher(Posted 2016) [#3]
Don't know really if that one(bOGL 2-OpenGL 3Dengine in BlitzPlus) is actually fully finished and up to par, but check out this one.

It works under Blitz+, Blitz3D & BlitzMax:
bIrrlicht 2.0 for BLITZ (Irrlicht 1.8.3)
Supports OPENGL and DIRECTX9. Great stuff!


[EDIT]
Now I dunno if this is possible(lack of knowledge), but as this is OpenGL and it's source has been released by Aqualung:
Wouldn't it be great if this worked under Monkey2 for Windows/ MacOS/ Linux & Android?

*Then I actually would be very, very tempted to use and purchase Monkey2!!*


For it would then have all the best of BRL products:
- OOP from BlitzMax
- GUI stuff from BlitzPlus
- 3D from Blitz3D
And from what I understand from the docs, shaders too! So it could be a BIG hit all over again for BRL.

Only what needed to be added then is a MultiplayerNet and Physics module and of we go:
*Straight from the box back into the dawn of the new multiplayer, multiplatform shader age, all included.*

Correct me if I'm talking silliness here please.. <Mark?>


meems(Posted 2016) [#4]
@xlsior
>Yes, Blitzplus has OpenGL built-in, but just for 2D

But when I run my 2D programs in blitzplus, all the load goes on the CPU, and zero on my GPUs. I'm wanting to offload onto the GPUs, and I'm hoping openGL commands will do it.


@Rick
Thks I downloaded bIrrlicht, but I don't know how to use it. Seems everyone else who uses blitz is savvy with modern C++ and linking. The readme says to put .decls files in the userlibs folder, but I don't see any .decls files, heck, I didn't know 5 letter file typenames existed, I've been using 1,2,3 letters all my life, thats how noob I am.

Wot do? Just dump all the files in the dl into the userlibs folder?


Rick Nasher(Posted 2016) [#5]
From the _libs folder copy "bIrrlicht.decls" into your BlitzPlus "userlibs" folder, something that on my Windows 10 Pro 64bit is located in this path:
"C:\Program Files (x86)\Blitz3D\userlibs"

Now I'm using Windowsn 10 x64 with Blitz3D , but on BlitzPlus it's something similar:
"C:\Program Files (x86)\BlitzPlus\userlibs"

If for example you are on a 32bit system with BlitzPlus installed this would probably be:
"C:\Program Files\BlitzPlus\userlibs"


Then you can just load the files in the "Examples" folder that have the extension ".bb" into BlitzPlus.
The ".bmx" files are for people using BlitzMax, not for you and me(or at least not for now).

You can safely ignore all the other stuff in the root folder, for this is the C++ source which the author was so kind to supply to the people who want to expand and build on this, but that's not for us Blitz3d/Plus language programmers/users.

This should get you going. ;-)


meems(Posted 2016) [#6]
thks rick. I had missed that decls file hiding in the _libs folder.
I copied it into the user_libs folder, and got an improvement : the examples compile with F7, which it wasn't doing before.
before it was something like : " function irrl3d not found " at compiletime

However when I F5, there's an immediate runtime error, " user lib not found "
I've tried copying DLLs around, the readme's say they have to go in the user's project folder. so now I've got bIrrlicht DLL's in several root folders, and places I consider my 'project folder'. But still no luck.

This is a serious barrier which separates noobs from experts. The pros don't realise how confounding all this C++, DLL, decls, linking etc is.


RustyKristi(Posted 2016) [#7]
@Rick Nasher

Porting bIrrlicht to Monkey would really take some heavy work. It would be more plausible, given the work involve if MiniB3D would be simply ported to Mojo2 which BlitzMax (NG) and Monkey2 now supports.

I'm sure any Monkey expert here would not have any problem doing it, if Mojo1 and 2 is not that far apart in terms of syntax or implementation.

I have read on Monkey forums AdamRedwoods (author) would consider porting it to Monkey/Mojo2 but it seems it has stopped development.


Rick Nasher(Posted 2016) [#8]
@RustiKristi
Ow, ok. I thought that MiniB3D was purely DX based so wouldn't work cross platforms(I favor Android and Windows as they are most widely spread), that's why I was thinking about the OpenGL/DX that Irrlicht apparently supports given what they mention int the docs:

The Irrlicht Engine supports 5 rendering APIs, which are 4 more than most other 3D engines do:
•Direct3D 9.0
•OpenGL 1.2-4.x
•The Irrlicht Engine software renderer.
•The Burningsvideo Software Renderer
•A null device.

When using the Irrlicht engine, the programmer needs not know, which API the engine is using, it is totally abstracted. He only needs to tell the engine which API the engine should prefer.
There are three reasons why the engine not only focuses on one API:
•Performance. Some graphic adapters are optimized for OpenGL, some simply run faster with Direct3D.
•Platform independence. Direct3D will not be present on a Mac or a Linux Workstation, while maybe OpenGL will. And when OpenGL is not available either, there are still the Irrlicht Engine software renderers, which will always operate on any platform. In this way, the user will see something on the screen for sure.
•Driver problems, which are a common problem a user encounters when using 3D software. There are thousands of hardware configurations out there, and often games and 3D applications are crashing, because there is an old driver installed. Letting the user switch the driver might solve the problem.

[cut..]

The Irrlicht Engine is platform independent, currently there is official support for:
•XP, XP64, Vista, CE, Windows 7,Windows 8 and Windows 10
•Linux
•OSX
•Sun Solaris/SPARC
•All platforms using SDL

For the serious mobile developer there are work-in-progress OpenGL ES drivers, which have enabled the Irrlicht community to develop iPhone, Android and Nokia Symbian ports. The Engine works with all supported platforms in the same way. The programmer only has to write the game/application code once, and it will run on all supported platforms without the need to change one single line of code.




@meems
Couple of questions to consider:
1) What Windows and BlitzPlus version are you using, are they fully updated and what path is your BlitzPlus installed to?
2) Also what DX do you have installed? (type DXDiag.exe at a CMD or search window - dunno how to check OpenGL versions though).
3) What GFX card do you have, does it support DX and OpenGL and which versions?

Afaik you really shouldn't have to copy DLL's around, with me it compiles & runs the examples using F5 right away, no hassle at all, but then again I'm currently using Blitz3d and I do have quite a number of other decls/dll's in my Blitz3d already.

Like a year ago I also tested it on BlitzPlus though and all was fine.


RustyKristi(Posted 2016) [#9]
Yes Rick, MiniB3D is based on OpenB3D so it is OpenGL. Minib3D Monkey has been a success it seems and has a lot of improvement compared to the original BlitzMax. If you bought Monkey Pro you can pretty much do 3d on all platforms or targets support by Monkey1, which is a LOT. :-)


Rick Nasher(Posted 2016) [#10]
Nope haven't bought Monkey for that it doesn't include a 3D engine by default. I've tried the free trial version, but my main targets are Windows and Android and 2D is not my goal(in this day and age, just feels too 80's ;-).

If I look at miniB3D for Monkey in: http://www.monkey-x.com/Community/posts.php?topic=6206
Then I still see a lot of issues/wip, but perhaps I'm not looking in the right location? Never really was drawn to follow up on it because of for mentioned reasons, so I may be out of touch with latest developments..


RustyKristi(Posted 2016) [#11]
Ok I see Rick. Just in case, here's the latest at official GitHub repo

https://github.com/adamredwoods/minib3d-monkey


meems(Posted 2016) [#12]
@rick
1. Windows 7, BlitzPlus v1.47 , E:\blitzplus
2. DX11
3. AMD Raedon R7

I don't have Blitz3D installed, so there's a chance thats stopping it.


Yasha(Posted 2016) [#13]
@meems

Not to toot my own horn too much, but did you try bOGL (linked by xlsior in post #2)?

It has .decls files but no .dlls, making it perhaps easier to install. The Draw2D module is intended to be very close to the builtin 2D command set (although it's closest to BlitzMax), and uses hardware acceleration (not optimized or batched though, just accelerated).

It's not realistically going to be as fast or as flexible as Irrlicht, which will use a deeper level of optimization and be much better for scenes with lots of moving parts (and to be honest if you want to move forward with serious work you should definitely learn an engine like that), but it might be easier to get started.


Rick Nasher(Posted 2016) [#14]
@meems
No, that shouldn't be an issue, for it should work fine with all Blitz flavors regardless. Just go from the standard downloaded and unzipped Irrlicht file "bIrrlicht_(2.0).7z"
-BTW: to what drive/location did you unzip to? (I assume you unzipped it right?)

-Could be that you'll just need to install DX9, download <here>
(For more info see the System Requirements DirectX section of Ploppy's, R.I.P :( HardWired , which similarly also used DX9 as well as DX11)

-Also possible is that it's due to your installation path and therefore the userlibs folder location, which defers from the standard which normally is:
>For 32bit Win7: "C:\Program Files\BlitzPlus\userlibs"
>For 64bit Win7: "C:\Program Files (x86)\BlitzPlus\userlibs"

In that case perhaps you'll need to set a environment variable towards your BlitzPlus path. Something I found on the net:

•Right click MY COMPUTER and select PROPERTIES. Or press Win + Pause.
•Select ADVANCED tab.
•Click ENVIRONMENTAL VARIABLES.
•Find the variable called PATH on the bottom system variables and add:

E:\BLITZPLUS\BIN
Take care of the specific path names on your system. •Add a new system variable called blitzpath and point it to:

E:\BlitzPlus
Note: You may have to put a blitzpath variable in both USER and SYSTEM, and you'll probably need to make one for each user that logs in and uses BlitzBasic. •Hit OK. You're done here.

Note: You will probably have to log off, then back on (maybe even reboot depending on the OS) to get the enviromental variables to work.
And make sure you modify all of the paths above to suit those on your system.



Dunno if this latter will do the trick, but is worth the try if the other options fail.

@Yasha
I always admire your skill level, pity you didn't go for a full blown 3d all bells and whistles thing. <Hint> ;-)

[EDIT: forgot the HardWired link]


Rick Nasher(Posted 2016) [#15]
@RustyKristi

Now I've gotten too curious and downloaded the lot. Thanks ;-)
I've also been pointed towards this link by Pete Rigz:
http://forum.mx2.community/viewtopic.php?f=31&t=7&p=30&sid=df52a4395fbd796eb18274504ab04ee7#p30


RustyKristi(Posted 2016) [#16]
Ah nice. The irrlicht port looks promising too. :)


Rick Nasher(Posted 2016) [#17]
Keeping fingers x-ed.