Wireframe rendering for GLES

Thank you both for the tips :wink:

1 Like

Great work :heart::v:, I would like to try that for sure , would it work on jme3 bullet or Minie or both ?

1 Like

The most easiest way ( i am a lazy developer :joy::joy:) is to create a java library on intellij or android module on Android studio then do your code there , make sure the Gradle defines it as android or java library

plugins {
    id 'com.android.library'
}

or

plugins{

 id 'java-library'
}

, & not application then push your code to github repository , then create a release on github , after that go to jitpack.io & login with your git acc , after that you will see all your git repos with their subsequent releases , but your users must add jitpack url in repositories{} block

Examples :

the android library(android module):

plugins {
    id 'com.android.library'
}

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.2"
    defaultConfig {
        minSdkVersion 22
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        consumerProguardFiles "consumer-rules.pro"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.2.1'
    testImplementation 'junit:junit:4.13.1'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    implementation "org.jmonkeyengine:jme3-core:3.3.2-stable"
    implementation "org.jmonkeyengine:jme3-effects:3.3.2-stable"
    implementation "org.jmonkeyengine:jme3-android-native:3.3.2-stable"
    implementation "org.jmonkeyengine:jme3-lwjgl:3.3.2-stable"
    implementation 'com.github.stephengold:Minie:3.1.0'
}

the android application that uses it (build.gradle file of this app module) :

plugins {
    id 'com.android.application'
    id 'com.google.gms.google-services'
    id 'kotlin-android'// Google Services plugin

}

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.2"

    defaultConfig {
        applicationId "com.scrappers.carsoccer"
        minSdkVersion 22
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.2.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    testImplementation 'junit:junit:4.13.1'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    implementation "org.jmonkeyengine:jme3-core:3.3.2-stable"
    implementation "org.jmonkeyengine:jme3-effects:3.3.2-stable"
    implementation "org.jmonkeyengine:jme3-android-native:3.3.2-stable"
    implementation 'com.simsilica:lemur:1.14.0'
    implementation 'com.github.stephengold:Minie:3.0.0'
    /*this part here*/
    implementation "com.github.Scrappers-glitch:JmEGamePad:1.3.0"
    implementation platform('com.google.firebase:firebase-bom:26.1.0')
    implementation 'com.google.firebase:firebase-analytics'
    implementation 'com.google.firebase:firebase-database'
}

the build.gradle file of the whole android project(main package , as you know android project can have multiple android java modules/flutter modules etc) :

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext {
        kotlin_version = '1.4.10'
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.1.0"
        classpath 'com.google.gms:google-services:4.3.4'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        // Google Services plugin

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        /*this part here */
        maven { url 'https://jitpack.io' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Java Library example :

plugins {
    id 'java-library'
}

group 'Com.Scrappers'
version '1.0-BETA'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.12'
    implementation "com.pi4j:pi4j-core:1.2"
    implementation "com.pi4j:pi4j-gpio-extension:1.2"
    implementation "com.pi4j:pi4j-device:1.2"
}

& using it inside android app or jme program through gradle would be the same as above.

1 Like

And libraries that use your library… and libraries that use those libraries.

It’s not hard to get things into jcenter and saves a ton of frustration if you are making a library that you actually want people to use. Totally worth the 10 extra minutes, in my opinion.

2 Likes

Thanks @Pavl_G for the quick howto. I’m lazy too so I may go this way if jitpack.io is integrated with github this easy

Answering your question on jme3-bullet and minie, this will require they both to add the dependency to the new library and modify code to use it.

Once all bullet stuff is moved to the jme contribution project I’ll do it myself as I’m still using it and I’m interested in having proper debug shapes on gles.

About minie, I assume Stephen will do it too

Side note: I’m also planning on moving my projects using physics to minie but I think it’ll take too much time as I’m stuck in a custom compilation of jme3 in between 3.2 and 3.3 and moving forward to latest jme3 could be a real pain. Not to mention that sound in android seems to be faulty still in latest release and my main target is android :confused:

2 Likes

So jcenter is somehow the default repository and it’s worth to use it instead, right?

Most gradle builds will include jcenter(). It’s the easiest standard public repo to upload to without additional restrictions. Sometimes to get things onto maven central requires some additional hoops.

For example, if you create a new project with gradle init it will include jcenter() by default.

2 Likes

That’s a sad truth though…

There wouldnot be too much work if you are using gradle besides jme3-bullet is very similar in code to Minie so you wonot do major changes(may require some code logic changes in CharacterControls/VehicleControls etc but just some objects initialization logic not major code).

My concern is not about bullet vs minie as it’s mostly a clean replacement from user perspective but minie depending on jme3.3 (as said, I’m stuck in an unofficial 3.2.x) and this change will imply big changes from my side

1 Like

Thank you all for your comments and assistance with the repository stuff. I just managed to upload it properly.

Now there’s two different github repos:

Finally the library is published in jcenter using the pipeline as explained by @sgold using gradle scripts based on @pspeed work. Thank you both

For using it, just add implementation ‘org.joliver82:jme3-wireframe:1.0.1’ to your gradle dependencies.

Any feedback is appreciated :wink:

3 Likes

To ease the transition, there are many older versions of Minie that work with JME v3.2.x. The latest and greatest of those was Minie v1.6.0+for32.

1 Like

In fact yes, I can use 1.6.0 for32 because it’s the first version supporting Android. I didn’t know because I’ve not been following Minie improvements for long :sweat_smile:

1 Like

I’ve updated the wireframe rendering to use a deprecated reserved buffer (Reserved0) instead of normals. I kept normal buffer based also in the code so it can be still be used.

Bintray and jcenter will be closed so I decided to publish it on jitpack because it was the quickest solution.

Also I’ve updated the sample app showing both reserved buffer and normal buffer examples

EDIT:

also added to the jme store, review pending

3 Likes

It’s now online in the store at jMonkeyEngine | Library

But it’s stating that it’s not at any repository: " This software is not available on any hosted repository service. To use this software you must build it from source."

Maybe I filled incorrectly the repository information, I wrote:

maven { url ‘https://jitpack.io’ } implementation ‘com.github.joliver82:jme3-wireframe:1.0.2’

But maybe I should have written the implementation inside the curly brackets…

Any one having posted stuff to the store previously could clarify me this?

Thanks

3 Likes

The 2 textboxes that need to be filled in are “Repositories”—which should have

maven { url 'https://jitpack.io' }

and “Dependencies”—which should have

implementation 'com.github.joliver82:jme3-wireframe:1.0.2'
3 Likes

Thanks @sgold I didn’t read the instructions carefully and filled it in the same textbox :man_facepalming:

1 Like

@joliver82 First off, thank you. The library runs great. I’ve distilled the “Heart” library to only the needed classes so the whole project does not have to be included, then created a separate library. If you’re interested, just let me know, though I’m sure you include the whole library for other reasons…

Anywho, the wireframe spheres look great, but when I applied the procedures to some other shapes (a Box, for example), I had trouble with the edges. Increasing the line width from .5 to 1 fixed the issue, but the thinner width seems better for other situations.

In BarycentricWireframe.frag you left the comment “Should parametrize line width?” Can you, please?

I’ve been programming for years, but this is my first foray into graphics, so I have no idea how to go about this (instructions would be fine, too).

If anyone is interested, I’m programming with jMonkey 3.2 in AIDE directly on my tablet! For obvious reasons, wireframing is a great help.

1 Like

Hi @Trasd . Thanks for the comment and welcome to the community. I’m glad you found my contribution usefull

About the Heart library, I used it as a dependency instead of just copying the extend method (the only one used) because it’s a popuplar library which is even included in latest SDK, so I though it wouldn’t be an issue, specially if you are already including it for other reasons into your project. If you think you don’t need it, feel free to fork this, remove the dependency and directly copy the extend stuff from Heart.

My advice is to use the geometry shader approach instead because most (if not all) devices support it and you won’t face this bad rendering depending on the line width you’re talking about

I left that comment because I had plans for improving it but I’ve been busy with other jme3 stuff and also in the real world :stuck_out_tongue: so, once I get back to this and I update it, I will post the changes here. Adding a parameter shouldn’t be hard, you need to modify the j3md file (material definition) to include a new float and also change the shaders to use it. Please note internal shader parameter naming of jme3. I’ll look for the wiki link later and point you there :wink:

About AIDE, what’s that? I’ve never heard of it…

2 Likes

AIDE is an Android IDE apk for android devices , not official , find it google play , it has a code compiler & it can indeed build packages , donot know the exact machinery behind it , but its kinda funny for testing purposes , if you do a big project on , that sounds dumb.

1 Like