non-flash cpp drawing?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

non-flash cpp drawing?

Raoul Duke
hi,

i'm confused. nme professes to be an sdl wrapper, but it appears so
far to me that it is really more than that, it is a port of the whole
flash approach to things. e.g. the samples use OnEnterFrame. i am
currently seeking a cross-platform way to just draw basic lines and
rectangles, and do not want to have to get sucked into the flash
approach to architecting my app. is there some haxe-common/standard
way to get lower level graphics apis?

vielen danke / muchas gracias / merci beaucoup.

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: non-flash cpp drawing?

Tony Polinelli
nme1 was a lowlevel api in c++ (dll) with neash over the top (haxe code) for a flash style api.

nm2 replaces neash with flash style api, built primarily at the c++ level (dll)


If you are looking for drawing, i would simply use nme, the flash api is great, manages a display list for you etc, allows transformations, etc. all handy.

Another lib is franco's udraw - http://code.google.com/p/udraw/ Im not sure its maturity, but it has interesting scripting features.

cheers
Tony





On Sat, Apr 2, 2011 at 1:09 PM, Raoul Duke <[hidden email]> wrote:
hi,

i'm confused. nme professes to be an sdl wrapper, but it appears so
far to me that it is really more than that, it is a port of the whole
flash approach to things. e.g. the samples use OnEnterFrame. i am
currently seeking a cross-platform way to just draw basic lines and
rectangles, and do not want to have to get sucked into the flash
approach to architecting my app. is there some haxe-common/standard
way to get lower level graphics apis?

vielen danke / muchas gracias / merci beaucoup.

--
haXe - an open source web programming language
http://haxe.org



--
Tony Polinelli
http://touchmypixel.com

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: non-flash cpp drawing?

davidedc
In reply to this post by Raoul Duke
Hi Raoul,

The flash abstraction obviously introduces a little overhead, but it's probably not going to be the bottleneck in your app. I did a small game using just vector drawing: most of the time is spent waiting for the gpu to do its fills, and sending the geometry/texture data to the gpu. The flash Api overhead is not a problem for any display lists of reasonable size.

And in terms of frameworks, it's really not that difficult to bang vector graphics on screen, all you need is to extend Sprite and use graphics.moveto and graphics.lineto, there are good one-page examples, it's not a cumbersome framework at all, especially if you compare it with something like core animation.

Plus, even if you do vector drawing, the flash abstraction can be useful, for example in managing strokes over your fills, which is something that in OpenGL you'd have to do manually, which is quite verbose. Also, for animation, it can be convenient to have the option to go for a "display list" approach rather than building your own solution.

If you really want a thinner layer between you and your gpu, I suggest you look into openFrameworks. It's cross-platform and works on low-power devices too. It's a very thin and clean abstraction layer on bare opengl and takes away all the platform-specific boilerplate/scaffold. It's a neat framework, only trouble: it's cpp and has no garbage collection, so good luck with pointers, memory managemeny hell and syntax from planet Vulcan. It's fast, as it maps almost 1:1 to direct OpenGL primitives. Still, I bet you'll find most of your time you'll be waiting for the gpu to do the same fills and transferring the same geometry and texture data as nme.

Cheers,
Davide

Pardon any typos, sent from my mobile.

On 2 Apr 2011, at 03:09, Raoul Duke <[hidden email]> wrote:

> hi,
>
> i'm confused. nme professes to be an sdl wrapper, but it appears so
> far to me that it is really more than that, it is a port of the whole
> flash approach to things. e.g. the samples use OnEnterFrame. i am
> currently seeking a cross-platform way to just draw basic lines and
> rectangles, and do not want to have to get sucked into the flash
> approach to architecting my app. is there some haxe-common/standard
> way to get lower level graphics apis?
>
> vielen danke / muchas gracias / merci beaucoup.
>
> --
> haXe - an open source web programming language
> http://haxe.org

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: non-flash cpp drawing?

Raoul Duke
In reply to this post by Tony Polinelli
thanks to all responders for the info & ideas.

On Fri, Apr 1, 2011 at 9:27 PM, Tony Polinelli <[hidden email]> wrote:
> If you are looking for drawing, i would simply use nme, the flash api is
> great, manages a display list for you etc, allows transformations, etc. all
> handy.

ja, probably i cannot disagree but overall i just don't want to be
forced into the flash framework e.g. where Lib.create() is blocking
(and presumably single threaded etc.) :-(

sincerely.

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: non-flash cpp drawing?

Gamehaxe
Hi,
It is possible to use the NME atomic calls without the whole framework.
You could even process the messages yourself and have a different system.
Underneath, it's all "mouse move", "draw frame" "key hit" etc, etc,
which it pretty much how any graphics api is going to work.
Lib.create takes a callback so it is asynchronous (depending on the  
platform).

Hugh


> thanks to all responders for the info & ideas.
>
> On Fri, Apr 1, 2011 at 9:27 PM, Tony Polinelli <[hidden email]>  
> wrote:
>> If you are looking for drawing, i would simply use nme, the flash api is
>> great, manages a display list for you etc, allows transformations, etc.  
>> all
>> handy.
>
> ja, probably i cannot disagree but overall i just don't want to be
> forced into the flash framework e.g. where Lib.create() is blocking
> (and presumably single threaded etc.) :-(
>
> sincerely.

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: non-flash cpp drawing?

Raoul Duke
On Sun, Apr 3, 2011 at 5:15 PM, Gamehaxe <[hidden email]> wrote:
> It is possible to use the NME atomic calls without the whole framework.

eenteresting. might anybody happen to have example code? i'm looking
at the nme code that haxelib downloaded, but i'm not yet seeing how to
put the 'atomic' calls together myself. will try to experiment. if
only i had time :-}

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: non-flash cpp drawing?

Gamehaxe
Hi,
You could start by replacing nme/Lib.hx with your own code.
You can still use code like:
  static var nme_get_frame_stage = nme.Loader.load("nme_get_frame_stage",1);

And then you can grab some code from Stage.hx, particularly:
  nme_set_stage_handler(nmeHandle,nmeProcessStageEvent,inWidth,inHeight);

and do your own event handling.

Or, you could let it intialize normally, and then hijack the events by  
setting
your own  nme_set_stage_handler.

To do your own rendering, you may need to add a "callback" to  
"Stage::RenderStage"
to let you do your own drawing before the "swap buffers".
You may want to do this at the beginning, so you can use the flash-style
displayobjects for things like FPS overlays.

So a couple of bits of "wedge code" and you can do your own events/display.

Hugh



> On Sun, Apr 3, 2011 at 5:15 PM, Gamehaxe <[hidden email]> wrote:
>> It is possible to use the NME atomic calls without the whole framework.
>
> eenteresting. might anybody happen to have example code? i'm looking
> at the nme code that haxelib downloaded, but i'm not yet seeing how to
> put the 'atomic' calls together myself. will try to experiment. if
> only i had time :-}

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: non-flash cpp drawing?

Raoul Duke
On Tue, Apr 5, 2011 at 10:01 AM, Gamehaxe <[hidden email]> wrote:
> So a couple of bits of "wedge code" and you can do your own events/display.

awesome, thanks for the hints!

--
haXe - an open source web programming language
http://haxe.org