I'm trying to write a small platformer game in Java. Nothing big, more of a practice exercise for other things. However, I keep running into an issue trying to use OpenGL for graphics. My IDE is Netbeans v.8.2, and I'm using LWJGL to access OpenGL. When I try to run the basic 'test' code LWJGL provides(https://www.lwjgl.org/guide) it won't run. The error I'm getting is:
[LWJGL] GLFW_API_UNAVAILABLE error
Description : WGL: The driver does not appear to support OpenGL
This is really weird though, as I know my GC and driver do support OpenGL. I can run Minecraft which uses it(not the best test I know), and I've confirmed using GPU Caps Viewer that my driver( Intel(R) HD Graphics) supports OpenGL 3.1. It's driving me crazy, and I've spent days looking for anything like this online, but all I can find are extrememly outdated posts and sources that don't seem to apply to my situation. OpenGL seems to be the perfect tool for the graphics of this project, and I'd really rather not switch over to something else, or re-write the program in something like C++ just to use it. So I'm turning to the brilliance of StackOverFlow. Any ideas?
With the information available in the question, this is most likely the second of the two cases here: https://github.com/LWJGL/lwjgl/issues/119#issuecomment-138078724
To reiterate, Intel dropped support for their HD Graphics 2000/3000 GPUs, and it looks like something in Java 8u60 broke support. I would first try making sure everything is up to date (GPU drivers, Java, LWJGL), and if that doesn't work, try downgrading below 8u60.
It looks like there's also a driver-side patch from Marcinosoft at the bottom of that issue that you can try installing as well before downgrading.
Related
I originally posted this question on GameDev stackexchange however I'll also ask the question here to try and get more outreach, especially since I wasn't sure my problem was specific to game development since it's a problem with a Java native call.
For the past months I've been working on creating my own game engine for personal use in LWJGL using pieces here and there, especially from developer ThinMatrix's rightfully credited code, to learn as much as I can while building it. Only recently there has been strange behavior happening when I launch the engine from IntelliJ for testing:
After about 6-10 individual times I click run, all subsequent runs suddenly take about 60 seconds for the window to appear.
Whenever I restart my PC this hanging resets and I have another 6-10 runs before it hangs everytime again.
I located the issue to glfwInit, more specifically at the call to the native method:
#NativeType("int")
public static boolean glfwInit() {
long __functionAddress = Functions.Init;
return invokeI(__functionAddress) != 0; // Right here
}
I also noticed that this issue only started when I attempted to implement text support in my engine using the STBTrueType library. It was perfectly fine before that. I tried removing the TrueType code but it didn't fix it.
Here's a list of things I've tried:
Clearing my temp folder in case a buggy or corrupted file was present.
Recompiling and rebuilding the entire LWJGL jars twice.
Building glfw.dll from the GLFW sources and replacing the glfw.dll in the native jars with the former.
Reinstalling Java and actually upgrading JDK versions (from 13.0.2 to 14.0.2)
Switching IDEs even if I suspected it wouldn't work.
Updating my NVIDIA drivers, and reinstalling them.
I'm quite confused as to what it could be, and I'd be more than happy to share code, thread dumps, or debug info if you deem it necessary. Here is the Github repository with the latest, "faulty" code (fault in quotes because I'm not too sure the code is the problem.)
Thank you very much for any guidance.
P.S: Please tell me if this is better asked in StackOverflow instead of here.
So I fixed the issue, it turns out it wasn't even related to anything to do with programming, or STBTrueType, or the library itself. The problem was as pointed out in this StackOverflow post, where this hanging behavior was due to a faulty driver or, in my case, my keyboard USB being plugged in the "wrong" USB port. I moved my computer at the same time I started working on text in my engine, hence why I wrongly linked the issue with the TrueType library. If you're having the same issue, look at the aforementioned post or if that doesn't work, look for a peripheral that might cause interference.
I have an Application based heavily based on SLD2, and I would like to port it on Android(Its currently available for Windows, Linux, MacOS and iOS).
After doing a lot of research the cleanest way I have found was to use the Android Native activity and start my C++ code from there. That worked great, my next step was to build SDL2 as a dynamic library and included in the project which also worked fine. Although when I tried to Initialise SDL video, sound etc. I found out that SDL2 can only be Initialised inside the SDL_Activity provided by the SDL source code.
Is that true?
Is there a way to do what I am trying to do?
My code base is quiet big and replacing the main class that takes care of the SDL rendering, with a java class will affect a lot of my base code.
Is there an other alternative or a guide to get inspiration?
I have been working on a simple LWJGL practice project for a bit and just recently stumbled into a new issue. Now with every project i due i save working backups in multiple places. I was running a Windows 8.1 OS and recently upgraded to Windows 10 and suddenly all of my backups and current program have the rendering error as seen below. I've tried to run my program on a windows 8.1 OS and it works fine there.
Is there some new windows driver update that could be causing this rendering issue?
Or is there some incompatibility with windows 10 and LWJGL i havn't been able to find out about?
Try this:
before you render any objects into your world, make sure you are using the inbuilt depth testing, this can be done by using this line of code:
GL11.glEnable(GL11.GL_DEPTH_TEST);
This should work for you, as it is forgotten in most cases that this happens!
-Kore
EDIT:
Also dont forget to clear the buffer aswell!!
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT|GL11.GL_DEPTH_BUFFER_BIT);
I want to build a Image editing application. I've gone through convolution matrix for creating basic color filters but I want the app to also have advanced editing capabilities like highlight/shadow adjustment, vignette, curves adjustments etc.
Any chances that I might find some examples for the same to learn more about it. Also, any kind of helpful resources would be a great help.
P.S. If there is an existing image editing library/sdk that can get the job done, that would be great too
You should look at opencv and vxl. They are libraries of computer vision functions and have open source community around them. Opencv is a big library/community. I was looking into image processing libraries for some ideas I have (permanantly stuck in pre-development due to lack of time) and I have played with them a bit on linux. I'm still very much an opencv/vxl n00b though.
https://en.wikipedia.org/wiki/OpenCV
I found vxl a bit faster to get started with.
https://en.wikipedia.org/wiki/VXL
There is support for opencv on Android:
http://opencv.org/platforms/android.html
There is not support for vxl on android as far as I can see.
Now, both of these are pretty big projects. I would say there is ALOT to learn and it will take a while. But I think it is probably well worth-while learning. There are many tutorials and examples.
Get the source code first:
$ git clone https://github.com/Itseez/opencv
$ git clone http://git.code.sf.net/p/vxl/git vxl
Especially for a mobile platform it will be important to get the use of image processing right - so that it doesn't kill battery of device - so . . . lots of experimenting and testing and learning to do!
Have fun!
I have recently found out that anything Swing(NetBeans, IDEA) is excruciatingly slow to paint the UI over Remote Desktop(RDP).
Can you guys give me any suggestion for something that will work properly over RDP?
Actually, contrary to everything I've seen - mostly the "Dsun.java2d.noddraw=true", which is mentioned in a number of places, it is actually setting it to false that fixed the drawing issues(for me at least). Go figure.
RDP is optimized for native Windows apps and, regrettably, newer versions of RCP (like Vista/Win7's default RDP) is even more hostile to non-native apps than older (XP/Server 2003) versions. Here's a good link:
http://devnet.jetbrains.net/thread/280673
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4204845
One workaround is to get a screaming fast CPU/graphics board, tons and tons of memory and a super high-speed network connection :)
Another is to:
Select "32-bit true color" in your Terminal Services settings
Select "Modem"
Reduce screen resolution (heck, use 1024x768 if possible)
Here are some additional tips:
http://www.codinghorror.com/blog/2006/04/remote-desktop-tips-and-tricks.html
Try setting "Dsun.java2d.noddraw=true"
http://ubuntuforums.org/archive/index.php/t-1129187.html
http://www.mindfiresolutions.com/Solving-DIRECT-DRAW-ddraw-problems-in-Java-Swing-730.php
I am launching a java swing application from Linux, and display it as a Windows frame thanks to MobaXterm.
If you haven't done it already, please have a look at the following documentation :
https://docs.oracle.com/javase/8/docs/technotes/guides/2d/flags.html
Using -Dsun.java2d.noddraw=true did not fixed my issue, but setting xrender to true did.
So here's the code I used on Linux :
export _JAVA_OPTIONS='-Dsun.java2d.xrender=true'
java -jar my_java_application.jar
Maybe it's not only Swing that paints slow over Remote Desktop. However, Eclipse is based on SWT, based on native widgets, so it is not Swing.
You should give JavaWIDE a try. It is an IDE designed for access to a JDK without it installed on a system, with a built-in storage system so you just need access to the internet. It's not exactly a program for accessing everything on the computer but it will do a good job with your programming. It may take a while however, as the compiling is done on a separate server.