Installing JOGL in Android Studio?

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

Installing JOGL in Android Studio?

n8skow
I've downloaded the necessary .jar files, and placed them in my project 'libs' folder - but where do I actually configure Android Studio to use them?
Reply | Threaded
Open this post in threaded view
|

Re: Installing JOGL in Android Studio?

gouessej
Administrator
Hello

- Click on File > Project Structure >Select app > Dependencies Tab
- Click on (+) plus button given on right side and select File Dependency
- This will pop up a dialog box for selecting path. Under this open libs folder and add your Jar files one by one.
- Once you select all three Jar files then click Ok button and your Gradle will Start building

Reference: https://abhiandroid.com/androidstudio/import-add-external-jar-files-android-studio.html

P.S: Note that there's an easier solution when you use a version of JogAmp already present on Maven Central or in a Maven development repository, you need to modify build.gradle to do it:
https://jogamp.org/cgit/ardor3d.git/tree/ardor3d-jogl/build.gradle
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Installing JOGL in Android Studio?

n8skow
When I click on 'file' there isn't a 'project structure' option.
Reply | Threaded
Open this post in threaded view
|

Re: Installing JOGL in Android Studio?

gouessej
Administrator
Which version of Android Studio are you using?

It's mentioned in the official documentation, it's still there:
https://developer.android.com/studio/projects#ProjectStructure

You wrote that you created a project, this menu item should be available.

Does it help?
https://stackoverflow.com/questions/33817556/android-studio-android-project-view-is-missing
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Installing JOGL in Android Studio?

n8skow
Android Studio 4.1
The shortcut 'ctrl+alt+shift+S' seems to work - but the option is not visible with my project opened, weird.
Reply | Threaded
Open this post in threaded view
|

Re: Installing JOGL in Android Studio?

n8skow
In reply to this post by gouessej
The 'simplified' solution also does not seem to work.
adding this to my build.gradle:

description = 'Ardor 3D JOGL'
dependencies {
  compile project(':ardor3d-core')
    compile group: 'org.jogamp.gluegen', name: 'gluegen-rt-main', version:'2.3.2'
    compile group: 'org.jogamp.jogl', name: 'jogl-all-main', version:'2.3.2'
}

produces error:
A problem occurred evaluating project ':lib'.
> Project with path ':ardor3d-core' could not be found in project ':lib'.
Reply | Threaded
Open this post in threaded view
|

Re: Installing JOGL in Android Studio?

n8skow
In reply to this post by gouessej
I'm believing this to now be a pathing issue...

"error: package net.java.games.jogl does not exist
import net.java.games.jogl.Animator;"

I've got 7 of these imports that do not exist in my directory structure:

import net.java.games.jogl.Animator;
import net.java.games.jogl.GL;
import net.java.games.jogl.GLCanvas;
import net.java.games.jogl.GLCapabilities;
import net.java.games.jogl.GLDrawable;
import net.java.games.jogl.GLDrawableFactory;
import net.java.games.jogl.GLEventListener;

Where do these exist if I followed the second install tutorial and didn't actually download anything?
Reply | Threaded
Open this post in threaded view
|

Re: Installing JOGL in Android Studio?

gouessej
Administrator
This post was updated on .
Your source code uses JOGL 1. Please use JOGL 2 to make it work, look at this simple example:
https://jogamp.org/wiki/index.php/Rudimentary_standalone_example_using_the_fixed_pipeline_by_Julien_Gouesse

By the way, my simple Gradle example works, you just have to remove Ardor3D as you only want to use JOGL. Add the necessary compile groups into your existing file named "build.gradle" in your project.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Installing JOGL in Android Studio?

n8skow
What dependencies do I need to load to run that code?

Currently have:
jogl-2.2.4.jar
jogl-cg.jar
jogl-awt.jar
jogl.jar

Running your code throws error: class JOGLQuad is public, should be declared in a file named JOGLQuad.java
public class JOGLQuad implements GLEventListener {"
Reply | Threaded
Open this post in threaded view
|

Re: Installing JOGL in Android Studio?

gouessej
Administrator
Why do you use JOGL 2.2.4? I've never mentioned this obsolete version. Please use the latest release candidate of JOGL 2.4.0:
https://jogamp.org/deployment/v2.4.0-rc-20200307/fat/jogamp-fat.jar

The error message is correct, please save my example in a file named "JOGLQuad.java".
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Installing JOGL in Android Studio?

n8skow
Looks like 2.3.2 is the latest stable version?
Only used 2.2.4 because that was what I had available last I dabbled with OGL... Any compatibility issues moving up to 2.4.0 in regards to 'old' code?
Reply | Threaded
Open this post in threaded view
|

Re: Installing JOGL in Android Studio?

n8skow
In reply to this post by gouessej
The test code does work correctly with 2.4.0 - thank you...
Reply | Threaded
Open this post in threaded view
|

Re: Installing JOGL in Android Studio?

gouessej
Administrator
You're welcome. Some import clauses might be different but it's not a big deal. Don't hesitate to ask questions, there's no silly question.
Julien Gouesse | Personal blog | Website