I have a program written in Java using JOGL with which you can draw lines with mouse. I now need to be able to navigate within the environment using the keyboard.
The game class code is here;
I have done this kind of thing with Java3D before in which you simply call the KeyNav class ad go from there but I can't seem to find the right functionality in JOGL. Any code, tutorials of information much appreciated.
Here is a link to a project I created. In the example implementation is a small class called Input.java. Just pass your gLAutoDrawable instance in the constructor and it should work.
Link
edit:
Oh, and you need to start the thread. :)
Related
I've run into a sort of impediment. I am trying to have 2 programs run at the same time, working with one another.
One is a Matlab program that accesses a piece of equipment (lets call it a camera) to take measurements. The other one is an android app (android studio was used) that has to change in between measurements.
Basically, I wish to start my app, showing a specific thing in my screen and take a picture of it. Then, I want the image that I'm showing to change and take another picture of it. And so on and so forth.
I already have the Matlab program to control the camera and take the measurements as well as the app, changing images on button click. I need to somehow make this automated, having them interacting with eachother to be able to perform simulation with 400+ images/pictures taken. Obviously, this would be very timewasteful to do manually.
My questions here are: Is there a way to call Matlab in my Java code in android studio? Should I create another piece of software from scratch, just to do this calibration with the interaction between the two? If so, would Java be a nice programming language to achieve this or should I work with something else that you might think is more accessible or easier to use?
Any help will be greatly appreciated. Thank you!
I have never done this but I have heard of it.
See the documentation for this very thing.
You can execute MATLAB® functions from Java® using the MatlabEngine
feval and fevalAsync methods. These methods work like the MATLAB feval
function. Use feval and fevalAsync when you want to return the result
of the function execution to Java or to pass arguments from Java.
I'm using Cocos-Code-IDE to create my game with lua language. Now I want to call some java method in Activity class.
For example: call method showAds() in Activity class when click to button on game scene.
I've searched but don't have any...
Please help me...
There is a thing called Java Native Interface (JNI). It allows one to call java methods from C++.
So the first thing you have to do is to create a C++ code.
You need to create a new directory in cocos/. Let it be MyJavaCall.
Inside MyJavaCall you create MyJavaCall.cpp and MyJavaCall.hpp.
Then you should probably read this tutorial http://www.cocos2d-x.org/wiki/User_Tutorial-Call_Java_functions_in_Cocos2d-x
Later this tutorial http://www.cocos2d-x.org/wiki/Binding_Custom_Class_To_Lua_Runtime for binding your C++ library to Lua.
Not sure if the tutorials are relevant with the latest cocos2d version. But at least they'll give you an idea. I hope you'll find this answer useful.
I've been set a graphics project as part of a Computer Graphics module, to familiarise myself with the basics of Open GL I've been following some of the tutorials from this website https://sites.google.com/site/justinscsstuff/
At the moment I'm working through a tutorial about rendering methods (https://sites.google.com/site/justinscsstuff/rendering-methods/triangle-scene). In the extended block of sample code for the class 'TriangleScene' there are two imports that I'm a little confused about:
1) support.GLInfo
2) windows.AWTWindowProgram
Eclipse doesn't recognise these automatically - do I need to download further sets of class libraries, as I had to for OpenGL?
I'm just looking to shed some light on these two imports so I can carry on working through the tutorials.
You do need to download these files. You can find them on this page that you mentioned down at the bottom (the first and third files in the list).
I'm writing a genome browser designed primarily to view the history of chromosomal rearrangements. Right now the project is a series of proof-of-concept demos written using Processing. At this point if I don't make any radical changes the final application will be a web applet with a gui built of swing components that open PApplets to actually show the rearrangements happening.
My question is: Should I give up on processing and switch over to pure Swing/AWT? This is my first big java project. I'm building in eclipse, but I can use netbeans as well. If I could embed PApplet objects inside a JFrame, for example, that would make my day.
processing.core.PApplet extends java.applet.Applet, so it should be possible to embed
a PApplet in a java.awt.Frame, as discussed in the article Applet ⇒ application: Hybrid Switch Hitters. See also, Mixing heavy and light components.
Addendum: From the API, "Processing runs in a Frame and not a JFrame. However, there's nothing to prevent you from embedding a PApplet into a JFrame," except for the limitations mentioned above.
Keep in mind that I know almost nothing about either Processing or your project, so I can only give you general advice.
The question that you should ask yourself before every major design change: what problem am I trying to solve by making this change? If the current architecture works, then you should keep it. If it's not working, then you should start by defining the specific things that are wrong with it (which I notice you didn't do).
If I have Java program and I need to alter it to an interface and include icons,
is there any easy I can do this and is there a good application that can help me to do it ?
or do I have to code it in myself?
Nop, /me thinks ur need 1337 mad Java programin' skillz!
Translation for the rest of the world: Sorry, you'll need to program in Java.
Added: Hey, what's with the downvotes? He started it! :P Besides - no matter if he wants to add or modify (the original text wasn't clear on this) the UI of a Java program, he will need to program in Java to bring his UI together with the code. There is no miracle tool that can allow you to draw an UI and it will suddenly do what you do.
Netbeans has a Swing GUI Builder. Quoting from their website. Let's hope this doesn't count has hidden advertising :)
Design Swing GUIs by dragging and
positioning GUI components from a
palette onto a canvas. The GUI builder
automatically takes care of the
correct spacing and alignment. Click
into JLabels, JButtons, ButtonGroups,
JTrees, JTextFields, ComboBoxes and
edit their properties directly in
place. You can use the GUI builder to
prototype GUIs right in front of
customers.
If you want to add a UI to your Java program there are tools to help you, such as the Swing GUI Builder inside of IntelliJ Idea. However, you're still going to have to write the appropriate code to hook into the UI.
It's just a website? Well depending on whether it uses CSS you might be able to just modify a .css file. This will only let you modify how the site looks as opposed to works.
See here for an example of how this technology works. However this depends on how css-dependent the website is and it's possible you may still run into some difficulties.
You want to use a Java framework to help you with the UI. For example, you can use JSF (Javaserver faces), which allows you to drag and drop components for a UI onto the site. Otherwise, you can use web programs such as Dreamweaver to design the UI, before coding the backend logic yourself in java.