jPCT-AE 3D engine Wrapper

Discussion in 'Old Libraries Archive' started by alhowiriny, May 23, 2013.

  1. alhowiriny

    alhowiriny Member Licensed User

    [​IMG]

    This's full wrapper of the engine, plus addon classes which are not part of the engine, such as glsurfaceview wrapper with rendring implementation, multitouch/gestures/scale implementation, 5 Interfaces implementation ..etc.

    The wrapper contains about 47 classes, the javadoc of the 3d engine is embedded inside the wrapper, so it will show as tool-tip when you type in basic4android.

    Using this 3D library requires you have basic understanding of 3D. I have created 6 examples to help understand the engine (the above image is taken from these examples), you should take a look at 'HelloWorld' example which's a convert of the Java 'helloworld', it also has enough comments to get you started, all the other examples assume you've understood the 'hello world' example. The examples run on OpenGL 1, The engine is capable of running on OpenGL 2 provided you know how write Shaders.

    The examples don't show the perfect way of using this engine, nor show a good programming practice in b4a, rather they show my own understanding and practice.

    Since i don't have time/energy to maintain this project, the full source code of the wrapper is available as an (eclipse project). If there's bugs, errors .. you have the source, so you get to fix it. note, that i didn't test all the engine's features.

    How to use:
    - Extract "JPCT-AE (Lib+Wrapper).zip".
    - Copy the 3 files into your basic4android library's folder.
    - Open 'HelloWorld' example.
    - Make sure the engine is loaded from within Libs tab, the name of the engine will be "JPCT-AE (alhowiriny)" before loading, and "JPCT-AE (version 1.0)" after loading.

    I've tested the engine/examples with basic4android version 2.52, on 2 devices, both have mali400GPU. works fine for me.

    JPCT-AE B4a Wrapper
    JPCT-AE (Lib+Wrapper).zip

    JPCT-AE Examples
    jPCT-AE Examples.zip

    JPCT-AE Wrapper Source (Eclipse Project)
    jPCT-AE Wrapper(Eclipse Project).zip
     

    Attached Files:

    • jpct.jpg
      jpct.jpg
      File size:
      81.3 KB
      Views:
      1,530
    Volga, hibrid0, ilan and 7 others like this.
  2. alwaysbusy

    alwaysbusy Expert Licensed User

    Waw! I haven't been able to take a deeper look into it but at first glance this looks amazing alhowiriny. I had seen the original lib before but never had the time to convert it for b4a. Truly a great job and thank you!
     
  3. Stulish

    Stulish Active Member Licensed User

    Wow

    WoW they look amazing, the only problem i had was getting the hello world B4A project to work, i get:

    There is defiantly a sub there:

    Code:
    Sub RendrerFPS(Data As Object)
       fps.Text = Data&
    " FPS" '<- Data = fpsCounter
    End Sub
    so not sure what is going on, all the other projects run fine

    Stu
     
  4. alhowiriny

    alhowiriny Member Licensed User

    Thank you. :)

    Probably you're using older version of Basic4Android.

    in "HelloWorld" example, under Jpct_SurfaceDraw, comment
    the line where it says:

    Jpct.SendDataTo("RendrerFPS", fpsCounter)

    Or replace it with this, if you want fpsCounter logged
    Log(fpsCounter)

    Jpct.SendDataTo..., uses (BA.raiseEventFromDifferentThread), its the only method that uses it, which sends fpsCounter's value from the rendreing thread to the main (B4A) thread, to show the value inside a label.

    The rest of the examples don't use SendDataTo, so they worked.
     
  5. Stulish

    Stulish Active Member Licensed User

    The Saga Continues

    I commented out the 'Jpct.SendDataTo("RendrerFPS", fpsCounter)' and it worked fine.

    I then added Log(fpsCounter) and the phone reset with the following logged error:

    Code:
    @@@ ABORTING: INVALID HEAP ADDRESS IN dlfree addr=0x671e1000
    Fatal signal 
    11 (SIGSEGV) at 0xdeadbaad (code=1), thread 2356 (er.ServerThread)
    After the reset the app runs fine and diaplays the FPS in the log

    So not sure what happened.

    Oh yeah i am using B4A 2.7
     
  6. alhowiriny

    alhowiriny Member Licensed User

    I dont know what that msg means, but i'm guessing its threading issue.

    Don't use B4A native Log, Use JPCT Log instead. somthing like:

    Code:
    Dim Logger As JpctLogger '<- put this under Process_Globals

    Logger.Initialize 
    '<- put this under Activity_Create

    Logger.Log(fpsCounter) 
    '<- put this under Jpct_SurfaceDraw, replace it with Log(fpsCounter)

    now before compiling make sure you untick 'Filter' under Logs tab, and when you run the example, wait untill all the garbage in the Log tab go away, and you should see something like this:

    [​IMG]

    Now, this's not what i'm intrested in. what i want to understand is why the sub rendrerfps isn't found when using SendDataTo. i've tested it with B4A 2.7 on 2 devices 4.0.3 and it works fine.

    Would you please rename Sub RendrerFPS... to lowercase somthing like : Sub rendrerfps(Data As Object) and dont forget to uncomment Jpct.SendDataTo ..

    does it find it?
     

    Attached Files:

    • fps.jpg
      fps.jpg
      File size:
      79.8 KB
      Views:
      1,239
  7. Stulish

    Stulish Active Member Licensed User

    I done everything you listed and the FPS did show in the Log (amongst everything else)

    I changed to lowercase with the same result and then put your new library in the Additional Libs folder and now it wont compile:

    Just so you know this is running on Samsung G3 with JB version 4.1.2
     
  8. alhowiriny

    alhowiriny Member Licensed User

    I see you're using jdk 1.7.0_21, while i'm using 1.6.0_31. maybe this's why it won't compile.

    attached an apk i just compiled.


    This's the method SendDataTo:
    If someone can see anything wrong, please inform me.
    Code:
    /**
          * Send Data (Single Object) 
    To UI thread
          * SubName: Name of the 
    Sub to send to, ie. "MySub"
          * Data: The Data Object you need 
    to send
          */
         
    public void SendDataTo(String SubName, Object Data) { 
            ba.raiseEventFromDifferentThread(getObject(),
                       
    null0, (SubName).toLowerCase(BA.cul), true, new Object[] {Data});
         }
     

    Attached Files:

  9. Stulish

    Stulish Active Member Licensed User

    The APK installed and Ran fine, with the FPS displayed at the top

    Not sure what my problem is, like you said maybe jdk?

    Thanks

    stu
     
  10. alhowiriny

    alhowiriny Member Licensed User

    The last log you posted shows you're using jdk 1.7.0_21, probably its bugged or there's issue with it & b4a libs. if you install jdk6 then from b4a IDE you can change to it.

    I have deleted my previous post with the new lib, you should delete it too, and stick with the old one.
     
  11. moster67

    moster67 Expert Licensed User

    Thank you!

    It is a bit out of my league and not something I will use in my current projects but nevertheless many thanks to you for sharing this with the B4A-community. I am sure it can be useful for many other users.
     
  12. Informatix

    Informatix Expert Licensed User

    Same comment for me. Thank you.
     
  13. Informatix

    Informatix Expert Licensed User

    The problem is not the JDK version (it only matters when you compile under Eclipse), it's because the sub has a name not compatible with the obfuscation mode. If you rename it Rendrer_FPS, that's OK.
     
    eps likes this.
  14. PhilN

    PhilN Member Licensed User

    Thanks dude! I'm gonna try it out... will let you know if I have any success! :sign0060:
     
  15. ldb68

    ldb68 Member Licensed User

    Some questions.
    How can I set an image backgroud?
    What's the maximum size that can used for models? A 8 Mb 3ds model is not loaded.
    Has anyone tried the demo on Andrdoid 4.3. On my nexus 7 pinch to zoom does not work.

    thanks
     
  16. ldb68

    ldb68 Member Licensed User

    Any helps?
     
  17. peacemaker

    peacemaker Well-Known Member Licensed User

    And how (what software) to prepare 3D-models for using with this framework in b4a?
     
  18. John.E

    John.E Member Licensed User

    SketchUp (pain now it is PayWare) or you could try Blender (freebie and a full fledge design package that will allow you to do loads, just don't ask me for help, I am still learning to use it) :)

    Oh, and while I remember ... Thanks for the wrapper alhowiriny :)
     
    Last edited: Jan 4, 2014
  19. lonleystar

    lonleystar Well-Known Member Licensed User

    Hi alhowiriny, great job.
     
  20. cbass

    cbass New Member Licensed User

    Does this Lib work with the Rapid debugger?

    I've been playing with the tutorials successfully with the legacy debugger, but when switching to the rapid debugger, the project compiles, installs, and the activity starts, but then it throws this exception and never fully starts.

    Ignoring event: jpct_surfacedraw. Raised from the wrong thread.

    Nexus 7, and I tried the Tools - clean project command with no success.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice