How to video out java through DVI/HDMI? - java

For a project I have to create a music visualizer in java (I've decided on using www.processing.org to create the visuals) and then output it using DVI/HDMI to a spartan-6 board. I haven't been able to find much out there.
I'm fairly early in the project so I could change from processing if needed.

AFAIK, the type of screen or whether you use VGA, DVI or HDMI makes no difference to Java. You need to configure these devices in the OS and Java will use them.

Related

How to use WGLARB in LWJGL 3?

Previously in my game engine written in java, I have used lwjgl 2.9.3. I ran into an issue. I wanted lwjgl to run on another graphics card. So I researched and soon figured out, that it would be impossible using lwjgl 2.9.3. So I read about seeing if lwjgl's developers were going to add the option of choosing which graphics card you get to run on. I figured out that lwjgl 3 did have support for this. So I switched over to lwjgl 3. I got everything working and started to work on why I switched. I soon figured out that there is no documentation for changing which graphics card you use. So after hours of testing I figured out that you need to create a WGLARB context. I know you can just use the method: wglCreateContextAttribsARB(long hdc, long sharedContext, Byte/IntBuffer attribList). But it is unclear how to use this method. I am not sure if you use the windows DC Pointer or something else. I know you do not have to put anything in for the 'long sharedContext' so I put 'MemoruUtil.NULL'. So here are my questions:
How do you create a WGLARB context, or more specificly what do you specifically pass in, like do you put in an empty Int/Byte Buffer or do you put data into the buffer before you pass it in as a parameter. I do not know.
From there how do you use: WGLNVGPUAffinity.getInstance().wglCreateAffinityDCNV(gpuList); GPU list is either a PointBuffer or ByteBuffer how do I get this data to pass in in the first place?
Sorry about the long post, but I am very frustrated about the lack of documentation, Thank you in advance!
LWJGL 3 (through GLFW) handles OpenGL context creation. Which means you don't get to handle it. GLFW will create the context, though it does give you some options as to exactly how. But GLFW is cross-platform, so it doesn't give you Windows & NVIDIA-specific options.
However, that doesn't mean you don't get some control. LWJGL 3 also gives you access to the platform-specific APIs (GLX, WGL, etc), as well as extensions to them. So you can use WGL.wglGetCurrentContext to get the context, then use the WGLNVGPUAffinity functions to create affinity contexts. That extension provides all of the various tools for enumerating GPUs and creating new OpenGL contexts that target a specific GPU.
The extension specification is even nice enough to provide sample code for enumerating GPUs. Of course, it's NVIDIA only, but that clearly isn't a problem for you.

Coordinates of active window on the desktop with java

Is there any way to get the title and coordinates of the active window on the desktop? Window can belong to any process, not necessarily to the one that I'm developing. I'd like to do it on java, probably with the calls of some native API.
Someone correct me if i am wrong but you wont be able to use a native API with java if it isnt part of java already, meaning you wont be able to find a pure Java solution.
You can use JNI(Java Native Interface) to create a 'link' using C/C++ and that would allow you to use native API from Java.
EDIT: JNA(Java Native Access) is another possible solution i believe.
You could also use C# or VB.net which i believe that already have support for windows API.
The functions you are looking for might be
GetForegroundWindow to get the window itself.
GetWindowRect to get coordinates.
( note that these links are for C++, C#/VB might have access to those in some way )
For you to use Java you will have to ,as i said, somehow 'link' the native API with java because Java alone can't.
This question about getting window title might have answers that explain Java's limits for this type of things better.
Get current active window's title in Java

how can i make UI automation in java by which i can capture button or menu of any external application dynamically

I want to automate an external application, but I have several problems:
How can I recognize a button or other field of an external application in Java?
I use the Robot class in Java for making notepad automation where I open notepad, select file menu, and save or exit, etc.
The problem is, it needs X,Y coordinates for the mouse pointer to go to the proper location.
I want to make it more dynamic, i.e. it should recognize the file menu of a running notepad anywhere on the desktop.
How can this be done in Java? Is there any class in Java I can use to do this?
Thanks everyone to give me response, I want to be more specific i want to know how can i make ui automation by using any tool if it is not possible in java or using any api of java.automation tool must be freeware.....i am searching net for that i found AutoIt is like that.But if any one do this type of things please share his/her experiance means is it possible to do that in AutoIt or not possible if not then which tool do that kind of things.
It is easy to integrate Sikuli into a Java-application since it is written in Java. Sikuli uses image recognition to find elements visible on the screen like buttons and such. It is very easy to use and provides an alternative for tasks that are difficult to handle with static positioning, like finding moving windows and such.
Take a look at this: http://sikuli.org/docx/faq/030-java-dev.html
Hope this helps!
You should have a look at Sikuli. It takes as inputs images of the ui elements to select an area in the targeted app. It's a UI Automation Application
That's a bit difficult to install (at least on Debian/Ubuntu, where I tested it), as you'll need a recent version of OpenCV, a particular version of JXGrabKey but the quality of the program worth the trip. Good Luck
Java doesn't have an API to examine the UI of another application; that would be a very big security risk.
Which is why the Robot class can only record events (key presses, mouse movements and clicks) but not which UI element was involved in most cases.
It would be possible to do more if the external application was written in Java because then, you could analyze the objects in memory but for obvious reasons, this isn't possible for C++ or .NET applications.

How to implement file icon overlay in java, the way, e.g., turtoisesvn or dropbox do

I am looking for the best (fast and easy to implement, not necessary most robust) way to overlay file icons in Windows 7 Explorer from a prototype written in java. I have seen on SO questions on the icon overlaying in Net and Python, none for java.
I'm affraid this cannot be entirely done in java. You must create and register a COM object that implements the IExtractIcon interface among other things, and associate it with the files you want to manage. more info here
Look into JNA (https://github.com/twall/jna) - it will allow you to call native code - eg. from user32.dll, etc. - without the burden than JNI would put on you. We're using JNA to get other windows' titles for instance. If you find the information about making icon overlays from native code, you should be able to translate it into JNA quite easly.

How can I handle multiple mouse inputs in Java?

A friend of mine asked me to implement a blue and a red pointer to represent the inputs of two separate mice to expedite a mixing desk scenario for real time audio mixing. I'd love to, but as much as I think it is a great idea, I don't have a clue as to where to start looking for a possible solution.
Where should I start researching a viable method of implementing dual mouse inputs?
Look at jinput.
I have had multiple keyboards working with it, I am nearly certain it supports multiple mice too.
dont know about java.. but for C#/c++ you can try the
Microsoft Windows MultiPoint Software Development Kit
i've tried it on windows.. it works with 2 USB mice.
It depends on which operating system you intend to use.
On Windows, you can use:
CPNMouse - a driver+software combination, very flexible and allows to completely hide some of the mice from the operating system.
RawInput - an API provided by Windows XP only. You can use it to distinguish between two mouse inputs, draw the cursors yourself and hide the main cursor. Take a look at the code of SDGT, a C# usage of this API.
For both solutions you would have to build a JNI bridge to your application
If you are using X.Org (X11) server, there is patched version called MPX that should support multiple mice even for legacy applications. It should now be a part of the X.Org trunk, but I'm not very familiar with it. Anyway it has an API so you can use it via JNI bridge.
You can use multiple devices, but at the Java level, all mouse events are coalesced into a single stream. The event does not include which mouse it came from. You did say you wanted to mix audio, right? Well this mix might be interesting, but surely not what you want.
I'd suggest using the Java-supported midi interface and connecting some simple midi controller device with multiple knobs or trackballs. These will come in as midi events, and you can examine the state for the details you need.

Categories

Resources