Page 1 of 1

PureBasic <> Python 2D/3D commands

Posted: Sun Mar 02, 2014 9:33 pm
by marc_256
I use PB to create a 2D/3D editor.
And I feel that since i use PB 5.21 there are some problems with mixed 2D and 3D stuff in one program.
The last one is some stuff with mouse movements in screen mode.
and the speed in 2D to draw stuff on the screen.

On the other side, I use blender to edit and position my created meshes.

If I am correct ??
- Blender is developed in Python, and python is a interpretor.
- I did some stuff in Purebasic, and i think PB is a compiler who compiles all to ASM. ??

Q1) is my thinking correct ?

I think this a software problem since blender works very, very fast.
But PB is slow in 2D/3D mixed stuff.

Q2) Is there a good alternative solution to use fast 2D and 3D designing in PB 5.21 ... and later ?

thanks,
marc

Re: PureBasic <> Python 2D/3D commands

Posted: Sun Mar 02, 2014 11:25 pm
by IdeasVacuum
From Blender.org:
Blender is an open source project licensed under the GNU GPL. All code is written in C, C++ and Python.
So, the main code is likely C/C++ and Python used for scripts/may be User coding (a lot of CAD-CAM apps have this facility for Users and the User coding language varies widely, from bespoke to VBA/VBS, Lua, LSP etc.)

Is the PB 2D slowness the fault of PB/Ogre or could your code design be better? Or perhaps you need to swap Ogre for something else?

Re: PureBasic <> Python 2D/3D commands

Posted: Mon Mar 03, 2014 1:38 am
by Danilo
marc_256 wrote:and the speed in 2D to draw stuff on the screen.
Do you use Sprites to draw on the screen? Directly drawing to screen is probably
slow, because the screen memory is located in 'external' graphics card memory.
Using sprites and bitmap fonts should be much faster, but you didn't give much
info nor an example of what you meant.

Re: PureBasic <> Python 2D/3D commands

Posted: Mon Mar 03, 2014 7:40 am
by Samuel
As Danilo said it's better to use sprites for 2D drawing especially if your using OpenGL.
marc_256 wrote:I think this a software problem since blender works very, very fast.
But PB is slow in 2D/3D mixed stuff.
Purebasic's 2D/3D is fast if you use sprites, but it also depends on how well you code your apps.
Your comparing your project to Blender which has several expert programmers working on it.
It would be a good idea to post an example showing your speed issues. That way others might be able to help you.

Edit:
I should also mention that although Blender was programmed in C, C++, and Python. They use OpenGL to render everything onto the screen, including the user interface.

Re: PureBasic <> Python 2D/3D commands

Posted: Mon Mar 03, 2014 9:45 am
by marc_256
thanks everyone for your advices,
IdeasVacuum wrote:Is the PB 2D slowness the fault of PB/Ogre or could your code design be better?
Or perhaps you need to swap Ogre for something else?
Well everything works very fast if I use only ogre,
and it works fast if I use only 2D drawing screen tools.

But when I use a mix of 3D / 2D / and direct drawing on the screen,
the mouse jumps in steps, and every redrawing is very slow.
And direct text drawing is a problem.

I don't think this is a Ogre problem.
Danilo wrote: Do you use Sprites to draw on the screen? Directly drawing to screen is probably
slow, because the screen memory is located in 'external' graphics card memory.
Using sprites and bitmap fonts should be much faster, but you didn't give much
info nor an example of what you meant.
I use sprites for all my CAD Menu/Tools/Cursor ...
but text is draw in direct 2D mode.

So, I have to redraw all on sprites ...

I found your GDI+
But is only Windows, so if I want to use multi platform (Win, Linux), I need to use OpenGL.
But is very good stuff.
Samuel wrote:As Danilo said it's better to use sprites for 2D drawing especially if your using OpenGL.
marc_256 wrote:I think this a software problem since blender works very, very fast.
But PB is slow in 2D/3D mixed stuff.
Purebasic's 2D/3D is fast if you use sprites, but it also depends on how well you code your apps.
Your comparing your project to Blender which has several expert programmers working on it.
It would be a good idea to post an example showing your speed issues. That way others might be able to help you.
Yes, I go convert all the text info on sprites, so I can use OpenGL.
But than I still have the mesh problem to solve.

The total program is more than 2.600.000 lines long now, so I need to find some parts of it to show.


Abouth OpenGL, i did some tests, but I have some troubles about meshes.
see http://www.purebasic.fr/english/viewtop ... 36&t=56020
Who works very well in DirectX, but than I can't direct draw text on the screen.


Use PB 5.21 and Win 8.1 - 64 bits