I really need a simple camera that i could use with my application. I would like to be able to control the movement of the camera with the keyboard. I only really require that it moves forwards and backwards and rotates with respect to the y-axis.
thanks in advance for any help as i don't know where to start with this one. Many tutorials around on google, but not for jogl :/
among the files included with downloading the official jogl things you can download (demos, tutorials, etc) is included the 'gleem' package, which I've used and quite like.
gleem stands for: GL-E-E-M: GL Extremely Easy-to-use Manipulators
here's the original page for gleem: http://alumni.media.mit.edu/~kbrussel/gleem/#DEMOS (with some pretty images, and context for)
link to source downloads within the offical-ish jogl page: http://java.net/projects/jogl
anyway, however you get it, amongst the file check out these specific options:
gleem.TestExaminerViewer.java
gleem.TestHandleBox.java
gleem.TestMultiWin.java
gleem.TestTranslate1.java
gleem.TestTranslate2.java
gleem.Translate1Manip.java
gleem.Translate2Manip.java
and, I'd expect you'll find what you're looking for. gl
PS - I'm boldy guessing/assuming that you want to control some sort of 'camera' that can be seen, vs. per-say just updating the model_matrix stack (if the later, of course just tie your key bindings to the different values you pass in as you call to update the matrix stack, ala using 'gluLookAt' ... etc)
Related
I'm wondering if it's possible to add some custom screen GUI's to my Bukkit server. So I can display a lot of text on someone's screen. Or do I need to find another option to do this?
Thanks!
The only practical way is to use an Inventory using blocks with name and lore for users to click on as can be seen here
As Cole Nelson mentioned, a custom inventory with lore displayed might work. A good guide for that can be found on the bukkit forums, and although it's a bit outdated it should still provide useful information.
Another possibility would be to utilize title screens; obviously those can't hold a ton of information, but the player is pretty much guaranteed to notice them immediatly.
I recommend using Title Api, as it's a bit tedious to directly work with packets.
Once you added the jar to your project and set the dependency, simply use:
TitleAPI.sendTitle(player,fadeIn,stay,fadeOut,"Title","Subtitle");
to send a title with all corresponding attributes.
Example result:
I was working on creating a weather application in Java using Weather Underground and I found that it does have data for some cities.
Initially, I was planning on using GeopIP to get the user's location automatically but since the support for cities is limited I decided to let the user choose the city every time the program starts.
I want the user to be able to choose a city from one that is supported by Weather Underground. The user will enter the name and as he/she enters the name, the possible locations will be displayed in a way similar to the one shown in the picture.
My question is:
How do I implement this search feature ?
My initial guess was to create a Vector containing all the names of the cities and then use brute force to find the match and display in a JPopup or a JWindow containing a JList but I guess there has to be a better method
Rephrase:
What I do not understand is WHAT INFO do I keep in the data structure I must use ? Should I manually create a list of cities that Weather Underground supports or is there another way to do it ?
Take a look at the Trie data structure (also known as digital tree or prefix tree). Autocompletion is one of the most common examples of it's usefulness.
The following article has a nice an very approachable explanation:
Roll your own autocomplete solution using Tries.
if you google autosuggestcombobox you will get some interesting results:
This one is written in JavaFX - I have used and extended it myself already. It is quite useful. What you get "for free" with JavaFX: a context menu with right-mouse click which is auto-generated containing some of the usual "stuff", like cut, copy & paste and even undo! So, I can recommend that solution. To get into JavaFX isn't so hard - and I think it is much easier to learn than Swing - and looks so much cooler! However this implementation has some drawbacks - especially when the layout is not left-aligned, because it is simply a text field on top of a combobox.
OK - but if you want to stick to Swing - you could probably use this one. I haven't used that myself, but the code looks quite straightforward and pretty clean - cleaner than the implementation for JavaFX I must admit (but that had some nice features). So - maybe you try - and extend it? It is built simply on JComboBox.
I want to try to create a learning chess application as a school project. My first plan was to simply pit this AI against itself, but to really show if it has been succesful it needs to be able to show how well it progresses. In order to do this, i want it to play rated games on sites such as chess.com. However, they do not (yet) have a public API, i believe.
Therefore, i wanted to make a program in java that recognizes colors and images. It keeps an internal 2-dimensional array of all the positions, and recognizes the pieces on the board. I think i have found a way to do this in a window using something like the Java Robot Class.
What i would like it to do, however, is to open this webpage in an internal window and keep doing this in the background. Is there a way to recognize colors within the own window, without needing to be in the foreground?
Edit: I'm planning on using this browser component i just found. I noticed that it is possible to create a full-page snapshot of the page and save it as a BufferedImage(?). Would this make it easier to do this?
Edit 2: I just read that 'Outside assistance from other people, computers/chess engines, or endgame tablebases is entirely prohibited'. I suppose letting a computer do all the playing does certainly include in that. So i might try using another site, so answers that are specific for chess.com won't cut it!
I don't know it it helps but may be you can have a look at the Sikuli project.
http://sikuli.org/
Sikuli is a program (and an API) to handle the interactions with the User Interface. For instance, you can write a script to click on an image or a button in certain conditions.
Especially interesting for you, there is a Java integration: http://sikuli.org/docx/faq/030-java-dev.html
Here is an extract of the website to give you an idea of the code you can write.
EDIT: in this code it is important to notice that you are defining new Patterns with the images. Sikuli will be able to find matching patterns.
import org.sikuli.script.*;
public class TestSikuli {
public static void main(String[] args) {
Screen s = new Screen();
try{
s.click("imgs/spotlight.png", 0);
s.wait("imgs/spotlight-input.png");
s.type(null, "hello world\n", 0);
}
catch(FindFailed e){
e.printStackTrace();
}
}
}
You should consider playing on a chess server where an API is avaible and chess engines are allowed. There is The Internet Chess Club (ICC) where you must pay to have a human account and then you can get a free computer account for your engine. There is also the Free Internet Chess Server (FICS) where you and your engine can get free accounts.
The ICC is usually prefered because the level of players is higher there with lots of international masters and chess masters playing there.
The best way to Interface with theses sites is to implement the xboard protocol. This will allow your engines to play through the Winboard or XBoard interface (among others) and theses interface can be used to connect on FICS or ICC and automatically play there.
I hope this help, even if it does not directly answer the question.
I'm not sure what your input is but you have two options:
You can work an a PNG image. Load the image into a BufferedImage (docs) object and examine it there. You can use a screen shot tool to create those.
It seems chess.com uses HTML with JavaScript. You can download the HTML using HttpComponents and examine it to see where the pieces are. This has the additional benefit that you don't have to guess which piece goes where since the HTML contains the source information.
I need to add an odontogram to my webpage.
It looks like this:
I would like to know if there is already some kind of open source odontogram.
I am using spring-mvc so it has to be in java
If it's web based I'd think you'd just want to return an SVG from a servlet.
If it must be interactive, I'd do this as an Applet or JWS application, with each tooth represented by an instance extending JComponent and containing five Polygons. The latter would make filling and hit testing relatively easy. A simple data model containing surface (proximal, distal, lingual, labial, occlusal) and color-code would also be useful. See also ImageTooth.
Addendum: You may want to plan on consulting a subject matter expert regarding the clinical correlation of the numbers, colors and locations.
I have been browsing around your many sites about BIRT and specially for Interactivity or scripting related subjects.
But (it would be sooo nice to live in a flawless world) trying to perform some examples (like this one http://kickjava.com/src/org/eclipse/birt/chart/examples/api/interactivity/InteractivityCharts.java.htm) which is supposed to make interactive charts I get nothing ... well yes I get something : charts (very nice ones by the way ;p) but I have searched for the interactivity aaaaaand it's gone ... may be to the swimming pool or at the laundry but certainely not there ... If you want I can send you the code I used to display the charts or anything you'd like but I really need to make my charts interactives and feel quite helpless and distraught (I'd prefer dazed and confused ...).
The easiest path to interactivity for BIRT-based content is the Interactive Viewer. Have a look at the specs here: http://www.birt-exchange.com/be/products/birt-report-viewers/actuate-interactive-viewer/features/
right after declaring your IDeviceRenderer
you must
idr.setProperty( IDeviceRenderer.UPDATE_NOTIFIER, anyclass that implements IUpdateNotifier );
Then you have plenty of documentations on
http://www.birt-exchange.org/documentation/BIRT_220/ChartJavadoc/chart/api/org/eclipse/birt/chart/device/IUpdateNotifier.html
And forever Google is your friend ^^