Rendering vertex with orx

edited October 2011 in Help request
If I want to draw a softbody with orx, how to accomplish it?
Or, imagine that I have some points that control the body, and I need to draw the body on the screen. All resource available is an array of points and a texture(or something).

Since I am new to rendering, any info will be highly appreciated.

This is my first topic on orx and thanks you for creating orx. :)



  • edited October 2011
    Hi guobin and welcome here! =)

    For anything that isn't rendered as a quad, you'll need to write the rendering part yourself. Sometimes it's pretty straightforward, sometimes it can be a bit more complex. It depends on what you need and for which platform you want to do it. :)

    The idea is to create a dummy object with an orxGRAPHIC for which you'll replace its rendering with your own code. In order to do so, you need to listen to the orxRENDER_EVENT_OBJECT_START, do your OpenGL/OpenGL ES rendering and return orxSTATUS_FAILURE from the event handler.

    That's the base. Now if you don't want to do the texture binding yourself, you can create your dummy object with a graphic that uses this texture and set its alpha to 0. Then instead of listening to the OBJECT_START event, listen to the OBJECT_STOP.
    There you can simply issue glDrawArrays call with your own vertex buffer.

    In order for this to work fine, you need to use the latest svn version though, as many fixes have been added to this part since the latest release. :)

    If you're not familiar with OpenGL rendering, I'd suggest looking for online tutorials like NeHe for example.

    Let me know if you get any trouble! :)

  • edited November 2011
    Thank you, iarwain.
    Seems there are a lot of work to do. :), but it's a good start.
  • edited November 2011
    It's actually not that bad but it definitely requires some knowledge of OpenGL. It might feel overwhelming at first but that feeling should dissipate quickly. :)
Sign In or Register to comment.