OpenGL 3D Game Tutorial 1: The Display
Вставка
- Опубліковано 30 вер 2024
- LWJGL 2 tutorial series on how to create a 3D Java game with OpenGL!
Tutorial about setting up the project:
• Setting up a LWJGL Pro...
Full code:
github.com/The...
Common Problems:
-In case you had annotations off, you need to do the ContextAttribs stuff all in one line like this:
ContextAttribs attribs = new ContextAttribs(3, 2).withForwardCompatible(true).withProfileCore(true);
-If you get the following error: org.lwjgl.LWJGLException: Could not create context (WGL_ARB_create_context) then your computer may not support the version of OpenGL that we're trying to use (version 3.2). Try removing the parameters from the Display.create() method and try again.
- Make sure you didn't miss the "!" in the "(!Display.isCloseRequested())" part.
LWJGL Wiki: lwjgl.org/wiki/...
My UA-cam Channel: / thinmatrix
Follow me on Twitter: / thinmatrix
Check out my game on IndieDB: www.indiedb.com...
Beginner game developer: *exists*
ThinMatrix: "I'm about to start this man's whole career."
that's something
extremely underrated comment
this is not for game developers
deop deop um yes it is?
@@linuxterm7622 ¿Como?
This is what I have been looking for!
Love your tutorial series TM! So helpful! Can't wait for the next one!!
Thanks so much for this series!!
OMG MAN YOUR AMAZING THANK YOU SOO MUCH IF I MAKE MY GAME WELL U WILL HAVE ALLOT OF SHOUT OUTS
i set up the java from the other video, but when i went back to your video to continue, i dont know where u got all the other folders and classes from. Do you have another video before this one? i only have "JGame" and like 5 items (folders) under it. What am i missing? please help
+swolyjr Sorry for the confusion, the "JGame" project in my eclipse is my personal project. The project I'm using for this tutorial series is called "gameEngine" which doesn't have any extra classes or folders.
You mentioned somewhere that you are working full time on your game, and not working a full time job. Just out of curiosity, how are you managing that? Are you getting donations to support development of your game? Or maybe just working out-of-pocket from savings?
Gaxx Sama A couple of years ago I worked for a year in Berlin and saved up a decent amount of money. Now I'm just working my way through those savings! I'm hoping to do a kickstarter campaign or some other fundraising next year when I start running out of money, so that I can continue development :)
***** Wow. Good luck! I'll certainly donate when I can. And you could set up a tipjar when UA-cam Sets that up.
Battlefrog Thank you :)
*****
Welcome.
So I was having problems initializing OpenGL but then i deleted the new PixelFormat(), attribs in the display.create() line and it worked perfectly... Will this cause errors later in the project?
Can you please create a new 3D game development series using LWGL3?
if you really need to learn lwjgl 3 just learn lwjgl2 in this series and from then on it's easy to switch to 3
TO ANYONE DOING THIS TUTORIAL IN 2021! LISTEN UP! Be sure to set the Java version to 1.8 or else your project will not work.
i have java16 and its works
Hey! You're seeing this for the first time. Let me warn you: this is gonna be a epic journey, enjoy!
thanks, I will come back to this when i finish the series xD
@@rae4652 You finish it?
yup, i'm really excited to get this goin, don't think i'll get bored out of it.
ikr im so pumped
VALEU POR AVISAR!
If you get the error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/lwjgl/LWJGLException
at engineTester.MainGameLoop.main(MainGameLoop.java:10)
Caused by: java.lang.ClassNotFoundException: org.lwjgl.LWJGLException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 1 more
make sure you added the libraries under classpath, not ModulePath
thanks so much!
You are a super hero!!!
On the good side, I did get my driver updated trying to figure this one out, lol.
Hey - these look great, thanks so much for your efforts! A quick question before diving in: These were released in 2014. I see from some other comments (several years old themselves) that this material is still relevant, the main areas of concern being GFLW is used now for window display and input and for math we can use JOML. Is that still the case? I am a bit confused because some comments indicate that you are using version 2 of LWJGL but here in this first video you are using 3.0. Can I follow these with the latest release? Thanks for your input. Cheers :)
The main aim of the tutorials is to teach OpenGl. OpenGl is the API that allows us to render 3D graphics. In these videos I use OpenGL 3+, which is still relevant today (and I use for my games).
LWJGL is the Java library that gives us access to the OpenGL API. It also handles other useful things, such as window creation and user inputs. In the videos I use LWJGL 2, but the current version available today is LWJGL 3. All the OpenGL code is the same, all the gamedev concepts I teach are still relevant, it's just the things specific to LWJGL 3 that are different. As mentioned, these primarily include setting up the display and handling user inputs. So if you can learn how to do those two things with LWJGL 3 elsewhere, then you can follow these tutorials for everything else.
@@ThinMatrix Thank you! Cheers :)
Had the same concern, glad you got a reply! By any chance, do you know how to pack a game made in Java utilising OpenGL for the Web?
@@ItsMeChillTyme at the end of this guys series packaging is discussed: ua-cam.com/video/VyKE7vz65rY/v-deo.html
@@staticvoidsolutions4998 thank you so much!
Back to the start again. Going to redo all these tutorials probably will take less time then they did before and also will comment everything so I understand it. Today is the day I start a game not just props for a game :D
Great Video! , it would be great if you remade this series with LWJGL 3.
*Common Problems and Solutions:*
If you get the following error: *org.lwjgl.LWJGLException: Could not create context (WGL_ARB_create_context)* or *Pixel format not accelerated* then your computer may not support the version of OpenGL that we're trying to use (version 3.2). Try removing the parameters from the *Display.create()* method and try again. You may have trouble on the later tutorials however, depending on exactly which version of OpenGL your computer supports.
Also, in case you had annotations off, you need to do the ContextAttrib stuff all in *one line* like this:
ContextAttribs attribs = new ContextAttribs(3, 2).withForwardCompatible(true).withProfileCore(true);
If the display opens and closes straight away without an error then make sure you didn't miss the *!* in the *(!Display.isCloseRequested())* part.
+ThinMatrix why won't you show us how to make a socuwan type-game?
+Geometry Dash Adrian That's exactly what this series is doing. In this tutorial series I've now covered almost all the OpenGL concepts that I used in Socuwan. In fact, a lot of the stuff I've shown in this series is better than in Socuwan because when I was implementing this stuff in Socuwan I was doing it for the first time.
+ThinMatrix OK, but you didn't upload Episode 40
Geometry Dash Adrian I only just uploaded episode 39 a couple of weeks ago :P The Opengl tutorials go out every 2 weeks, so the next one will be out tomorrow.
+ThinMatrix Hope u promise bro :)
hi from 2019 new years night! so basically I am in 2020
20/02/2020 :)
@@noon453gf 29/02/2020
@@chelovekchelovekov5134 hhhh thats good
Oh boy well wait till you see what's in store for you!
you don't want to be in 2020 stay in 2019
Hey, mine throws this: `Exception in thread "main" java.lang.NoClassDefFoundError: sun/misc/Unsafe`, what can i do?
same. I really don't know what to do here.
okay, i found a solution from somebody else. you move all 3 jar files to classpath and delete modle-info file.
@@therealmemernet thanks! I'm gonna try it
@@skywalker778 no problem!
@Kürassier1806 Damn, it's been 8 months since I posted that(it feels like yesterday). I'm glad my solution helped you!
Note that the author used the eighth java. In no case try to follow the instructions if you have a different Java, for example 16. I have been looking for the cause of the errors for a very long time, until I changed the Java to an older one.
I have java 16 and its works
Do note that in LWJGL 3 the "Display" class has been replaced with "GLFW" class.
So everything that says "Display" i have to replace it with "GLFW"?
+Bandit Leader No. If you're switching to LWJGL 3, you would have to. But this tutorial series is still for version 2(.93). I'm still working with the "old" version myself, the major change in the newer one is that the developers thought it was becoming to big so they removed a few things. It's now e.g. using a different library for managing the display (GLFW) and there are some elements missing you would have to implement yourself (the mathmatical classes in the util package).
Of course you can still use the "old" version, it's the same OpenGL, and you can follow this really awesome series easier.
+Geosearchef Please don't switch to LWJGL 3 because I was using that (LWJGL 3.0.0b build 64) until I got stuck in input camera.
i can't get position normal or delta from the mouse class, so now I'm redoing all the work but with LWJGL 2.9.3 because the 3 version is a pain in the ass XD.
thanks, I was freaking out, thought something was wrong with autocompletion
:P thank goodness i got v2 of LWJGL '':{
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Display cannot be resolved
at game/engineTester.MainGameLoop.main(MainGameLoop.java:22)
My line 22: while (!Display.isCloseRequested()) {
I've been looking for a tutorial like this for a couple years, glad I finally found it. So many tutorials talk about the java language itself which bores me and I have to "try" and skip ahead but miss things. I'm already highly experienced in Java as a whole, just not game development. Thank you for making this. I will start watching and going through these in my free time. :)
"We are using LWJGL and OpenGL 3+"
subscribed!
@Kamey im working on it
After hours of searching, I FINALLY found the problem. Even after updating drivers and looking up what version of Opengl my driver supported (which was 4.4) it still did not work. If you are having this problem you are most likely on a laptop.
Apparently, on most laptops there are 2 GPU's: the Intel(R) HD Graphics one and the NVIDIA Geforce one. For most PC use, the onboard Intel graphics hardware is just fine. You will not notice a difference between onboard and discrete graphics when using desktop applications. There is a difference, however - integrated Intel graphics use much less power than NVIDIA graphics. By using the low-power onboard graphics when a high-power dedicated graphics card isn’t necessary, laptops can save power and increase battery life.
When you launch an application that needs high-powered 3D graphics, such as a PC game, the laptop powers on the NVIDIA graphics hardware and uses it to run the application. This increases 3D performance dramatically, but takes more power - which is fine if your laptop is plugged into an outlet.
When you go to Control Panel > Hardware and Sound > Device Manager > Display Adapters there you can see the two GPU's.
The problem is that eclipse is run with the Intel GPU, which for me had Opengl version 3.1.
When doing:
Display.create();
String version = GL11.glGetString(GL11.GL_VERSION);
System.out.println(version);
I get " 3.1.0 - Build 9.17.10.2932"
To make your pc use the NVIDIA GPU for Eclipse, go to Control Panel > Hardware and Sound > NVIDIA Control Panel > Manage 3D Settings:
Option1: Either change "Preferred graphics processor" to "High-performance NVIDIA processor" to make your laptop always use the NVIDIA GPU.
Option2: OR go to program settings > add > select the eclipse.exe in your eclipse installation folder and change "Preferred graphics processor" to "High-performance NVIDIA processor".
Now I had a problem where the second option to only apply it for eclipse is not applied for some weird reason, so I just made my laptop use my NVIDIA GPU all the time. If you really don't want to do that you can right click the eclipse.exe and choose "Run with graphics processor" option. If anyone finds out why the second option does not work please tell me.
When doing:
Display.create();
String version = GL11.glGetString(GL11.GL_VERSION);
System.out.println(version);
I get "4.4.0 NVIDIA 344.48", you should now be able to make a new ContextAttribs(3, 2) without a problem.
I will show how to solve this problem if you use C++ and Windows. You can add these lines at the beginning of your main.cpp file. One line is for NVIDIA Geforce and another line is for AMD Radeon. After this your Exe file will use "High-performance NVIDIA processor" always.
#include
extern "C" _declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
extern "C" __declspec(dllexport) DWORD AmdPowerXpressRequestHighPerformance = 0x00000001;
hey, can someone help?
I dont really know why this happens...
Code:
package renderEngine;
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.ContextAttribs;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.PixelFormat;
public class DisplayManager {
private static final int WIDTH = 1280;
private static final int HEIGHT = 720;
private static final int FPS_CAP = 120;
public static void createDisplay() {
ContextAttribs attribs = new ContextAttribs(3,2);
attribs.withForwardCompatible(true);
attribs.withProfileCore(true);
try {
Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
Display.create(new PixelFormat(), attribs);
Display.setTitle("JGame WIN");
} catch (LWJGLException e) {
e.printStackTrace();
}
GL11.glViewport(0, 0, WIDTH, HEIGHT);
}
public static void updateDisplay() {
Display.sync(FPS_CAP);
Display.update();
}
public static void closeDisplay() {
Display.destroy();
}
}
Error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/lwjgl/LWJGLException
at engineTester.MainGameLoop.main(MainGameLoop.java:14)
Caused by: java.lang.ClassNotFoundException: org.lwjgl.LWJGLException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 1 more
Great job. I have no almost no prior java game coding knowledge, but so far this strongly motivates me to learn java. Also, you do a great job explaining so do understand this, even without knowing java, very well. Keep up the great work!
I know this is 7 years old but your real lucky I got many issues and I got out of ONE issue but got another one but good tutorial..
Mac users: In the closeDisplay method in the DisplayManager class, remember to add a System.exit(0); just after Display.destroy(). If you do not do this, the display will linger and just be annoying.
I recently started wondering if I would make a game engine just to have a better understanding of them. I always thought that you were awesome for always coding everything yourself. Yesterday I found your series, it may be a couple of years old but I'll still follow through everything ^^
Thank you for sharing your knowledge!
Hello if you get this error
at renderEngine.DisplayManager.createDisplay(DisplayManager.java:17)
at engineTester.MainGameLoop.main(MainGameLoop.java:11)
Caused by: java.lang.ClassNotFoundException: org.lwjgl.opengl.DisplayMode
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
then it means that in your eclipse in your project name the version is supposed to be javaSE-1.7
for me that worked on my mac
Hello! This is exactly the type of tutorial I would be incredibly interested in. However, before diving in, I wanted to ask if this is completely dependent on Java? I would much rather do all of this in C++!
+Frank Botos The majority of the code is OpenGL calls and GLSL shader code, which is pretty much the same in any language. The only big differences will be setting up the display and handling user inputs. I know that quite a few people have followed this tutorial series all the way through using C++.
Okay awesome! As long as it's stuff like mouse/keyboard input and window creation I believe I can figure that part out. Thanks a lot for sharing this knowledge, I am looking forward to learning!
First I had a weird red flickering of the game window. Solution was to insert glClear(GL_COLOR_BUFFER_BIT); in the while loop.
Could you explain what does it do?
what does it do? And the method doesn't exist :(
I got an error saying this:
'Exception in thread "main" java.lang.NoClassDefFoundError: org/lwjgl/LWJGLException
at engineTester.MainGameLoop.main(MainGameLoop.java:11)
Caused by: java.lang.ClassNotFoundException: org.lwjgl.LWJGLException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:636)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:182)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519)
... 1 more'
What do I do?
@DybaTubeMusic make sure to add the library in the classPath of your project
@@boulhemachraf873 GOD BLESS YOU
Didn't think anyone who wasn't Indian used Eclipse with a light theme.
Any Problems with Indians?
If you get the error "The type org.lwjgl.opengl.Display is not accessible" then go to the GameEngine folder -> open src folder -> delete module-info -> go back to eclipse and refresh project.
If you get stuck with "new DisplayMode(WIDTH,HEIGHT)" asking for 2 extra parameters -> remove the line "import java.awt.DisplayMode;" -> replace line with "import org.lwjgl.opengl.DisplayMode;", confusingly the opengl package used the same class name as awt package so you can accidently import the wrong one. If you used the ctrl + shift + o hotkey in eclipse you will import the wrong one as default
LWJGL seems to have "deprecated" the Display class. Now, I'm not even sure how to start the tutorial.
With people getting errors with unsatisfiedLinkError, right click on the JRE System Library in the package Explorer (assuming your using eclipse) - build path -> configure build path then double click on the native library location, that will bring up an explorer window and just point it to your lwjgl -> natives -> windows. it did the trick for me. i'm using version 2.9.2. hope that helps.
When I do this on my Mac, the code executes, but I get a red and black flashing screen. How do I fix this?
me too 😳😳
the LWJGLException class is missing
Wow, I'm amazed. For the 1st time ever, somthing showed in a programming tutorial I watched, works instantly without any errors xD
I'm getting better at this!
ThinMatrix: lets make a tutorial that shows people how to make a 3d world in Java!
90% of people: MINECRAFT
Wait a second did u say by the time you get to tutorial 25 we will have terrain gen, lighting, 3rd person player, fog, skybox, multipul light sources and multiplayer ok this is way to much you are the best UA-camr ever it normally takes people 100 episodes just to set up a terrain :D
Mohammed Qureshi other people eplain stuff
"이 강의가 없었다면 지금의 나는 없었다"
본질에 매우 충실한 강의.
대학생 시절, 컴퓨터공학을 전공했지만 늘 자신감이 없었던 나에게
엄청난 실력과 압도적인 자신감을 가져다준 유일한 강의입니다.
This is awesome, thanks for this, I will totally try to follow it :)
I really appreciate you zooming into your code as you walk us through. Thank you very much for doing that!
doing this tutorial on Scratch.MIT.edu right now. Tried Java and c++ but found them both far too limiting.
Lol
Java and C++ limiting when compared to scratch? Are you trolling?
thats what c# is for
try assembly and machine language
@@ryanwilson5079 Hard to read but not really limiting as if you're good enough you could build any C++ program in machine or asm. Would take forever though and good luck reading it lol
I have this problem "Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl64 in java.library.path" and the solution is put lwjgl64.dll under C:\Program Files\java\jdk…
It's works! The like button works!
it seems that version of lwjgl doesn't work for some, the 2.9.3 version should work if you have problems: sourceforge.net/projects/java-game-lib/files/Official%20Releases/LWJGL%202.9.3/
Just finished watching the whole video and thought it was great (I've only done simple pure java games), definitely can't wait for the next episode! Great job man
Thank you :)
Great, thanks for tutorial!!! And good luck with your multiplayer game.
Thanks :)
Don't get demotivated when you see Unity's logo.. You are here bcoz you love the whole process of programming, not just results😃
YES! It's finally here, thank you so much for doing a tutorial series. It will benefit me so much, thanks!
Is it possible to do this in a language that isn't java
not with lwjgl
Doing these tutorials in c++ now. Got through the first 40 episodes before but now I feel like java isn't the encouraged language to make a game in because of the speed. Java is still my favorite language and I love these tutorials.
I'd assume you're using GLFW instead, but I was curious to if I should be using c++ over java.
@@gravedigger7380 I don't think it's so hard to transform the code from Java to C++ cuz the opengl is basically the same and the steps are the same too. I think you just need a lil bit of logic :3
Good to know, thank you. :)
Hello, I am having trouble with the import statements. When I write import org.lwjgl.LWJGLException I get the error: the package org.lwjgl is accessible from more than one module lwjgl, lwjgl.util.
I tried, and got the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/lwjgl/LWJGLException
at engineTester.MainGameLoop.main(MainGameLoop.java:20)
Caused by: java.lang.ClassNotFoundException: org.lwjgl.LWJGLException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 1 more
I'm using java-11-openjdk.
I solved it using jre1.8.
Thanks I had the same issue
For those of you that get the "Could not create openGL context" error, call the Display.create() function with no parameters, then call GL11.glGetString(GL11.GL_VERSION); This will give you a string with your opengl version. You might not support opengl v3.2
カラス I'm getting this error but couldn't figure out how to fix it.
However, the window opens just fine, with no errors, if I use Display.create(), with no parameters, instead of the PixelFormat and attribs version of it.
I'm using a Linux Ubuntu 64bit, from a laptop (onboard videocard), if that information is useful.
*****
You have 4.5
353.30 is the version of your NVIDIA drivers.
Thanks for that advise.
Don't know if you still read the comments, but I was wondering if this is still relevant? It seems like the best tutorial on UA-cam. Should I stick with lwjgl 2 or go to lwjgl 3? What are the benefits of one versus the other?
yeah, you are not alone, i wonder the same myself :)
Try to follow it with lwjgl 3. I did this a while ago and besides from the first or maybe also second episode it works farely well
Edit: Some resources: github.com/LWJGL/lwjgl3-wiki/wiki/2.6.6-LWJGL3-migration github.com/JOML-CI/JOML/wiki/Migrating-from-LWJGL-2
@@profiluefter Thank you very much. I will stick with LWJGL 2 for now because I am a noob at this, but I might switch over later. With exams and everything lately, I am only on episode 10 or so ;)
Hello ThinMatrix can you please help me it always gives the same error
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The constructor ContextAttribs(int, int) is undefined
The method withForwardCompatible(boolean) is undefined for the type ContextAttribs
at renderEngine.DisplayManager.createDisplay(DisplayManager.java:19)
at engineTester.MainGameLoop.main(MainGameLoop.java:15)
I love these tutorials, I just wish that so much had not changed from then until now. I mean, I could always downgrade the programs to backtrack to this time, but would that affect dramatically the quality capable from LWJGL3 and Java 14?
Actualy, just a question becaus I am thinking about working with networking in java. Which library did you juse in Socuwan to do the Server and Client stuff or did you do it with the java inbuilt functions?
I just used stuff from the Java standard library.
In my console it leaves a message saying ‘Exception in thread ‘main’ java.lang.NoClassDefFoundError: sun/misc/Unsafe’ with then a bunch if lines starting with ‘at’
Could be a problem with jar and/or native linking. I had a similar exception then I messed around with my jars and natives until I fixed it.
@@nehr-dv6ye I'm getting the same issue on macOS, but my display will open and then close soon after. I checked that my jars/natives were linked correctly.
@@hippiedonut1 I've done this tutorial twice so far and both times I got this error and solved it by changing the jar and native linking. I think the error means that java is able to find the class definition during compile time but not during runtime. The first time I did this I was not using a module and ended up putting everything into the classpath. The second time I tried using modules but it refused to work for me no matter what I did so I just deleted the module info and moved everything back to the classpath. I'm using windows so I'm not 100% sure what you do on macOS but I think you need a folder in your lib folder called "macosx" with "libjinput-osx.dylib"; "liblwjgl.dylib"; and "openal.dylib" in it. Then in your build path under classpath under each of the jars you need to set your native library location to the macosx folder. That's kind of how I've got mine set up at the moment but with a windows folder instead of a macosx folder.
@@nehr-dv6ye Thanks a lot for the quick response. I just spent 2 hours on this so hopefully this comment helps someone. I spent a lot of time checking if the problem was the JRE version, but it wasn't. At least on macOS, a variant on what n17e said worked for me. Right-click the project (GameEngine), then do Build Path -> Configure Build Path, then drag the 3 jar files from under "Modulepath" to under "Classpath". Then, you might need to click on the JRE System Library in the same window, then click Edit... and select your JRE again. If one doesn't work, try another. I didn't need to make a "macosx" folder at all.
Here's what it should look like at the end: i.imgur.com/le60GAC.png
Thanks n17e and hope this helps someone else.
@@nehr-dv6ye thanks so much, you helped me a lot
You are so fast, I put you in 0.5 speed. LOL!
Can you still follow this tutorial if you use c++
THIS HAS RUN ERRORS ON MAC WHEN ALL THE CODE HAS NO CROSSES ANYONE HELP!
hey bro ! I don't know if you already fixed, but give it a shot ->
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
Paste this at the beggining of the GLFW file
not working errors
import org.lwjgl.opengl.Display;
this doest work
Hey, I think I had the same issue and here is how I solved it: I downloaded LWJGL 2.9.3 instead of the one linked in the setup tutorial video and I also made sure I was using Java 8 while creating a new project. Hope this helps. Good luck
someone help me please, for some reason my window is not opening. When i click run on eclipse, it replies with editor does not contain a main type.
someone help pleeez
I have the same error
So thankful for this
I have a problem. When I do "import org.lwjgl.LWJGLException;", the "org.lwjgl" is underlined red, and it says "The package org.lwjgl is accessible from more than one module: lwjgl, lwjgl.util". It causes a problem if I run the MainGameLoop.java.
Can I get some help?
Thanks
Here is the error I get when I run the program:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
LWJGLException cannot be resolved to a type
at renderEngine.DisplayManager.createDisplay(DisplayManager.java:26)
at engineTester.MainGameLoop.main(MainGameLoop.java:11)
I had the same issue. You have probably fixed it by now, but if you still need help:
The issue for me was when I added the jar files under buildpath>libraries I needed to click on the classpath instead of Modulepath. That is not the way it appears in the video, maybe because we are using a newer version of eclipse.
Thanks, really helped
LOL this is my 4th time watching this series because I am trying to learn it rather than just copying it. I want to be a software engineer or developer when I go to university. Cheers!
Can I follow the series translating it to C++?
I don't think so because it uses opengl which works with c++ but it also uses lwjgl which you can't use in c++
@@nialyavuzturk379 Yeah I just thought it's going to be very similar. I currently learn Java and I know some (maybe intermediate..) C++. Thanks for the answer.
@@liskov7983 No problem
Thank you so much for doing this again. It was so awesome :D PLEASE don't stop this mid way like most people. You're a great guy :)
Colin Allen Thanks! I'll do my best :)
if you get the UnsatisfiedLinkError in Netbeans, go to File>Project Properties>Run>Type into VM Options: -Djava.library.path=(location of the natives folder)
"org.lwjgl.LWJGLException: Pixel format not accelerated..."
constantly getting this error.Please someone help. I am not using any graphics card.
I have the same problem
I just shifted my code from lappy to desktop and all worked fine. My desktop has the same setup as lappy. Still dont know why it didn't work for lappy.
thanks a lot for taking the time to do this even though you we know you are so busy working on your game :)
Does the version of the IDE matter? I am using the latest version of eclipse and am wondering if that changes anything with the syntax itself or if it's just improving the interface.
No, it does not matter.
Wow, that comment seems SO MUCH OLDER than 3 weeks old.
Lol.
I was asking because the unity C# code constantly changing syntax has bothered me for years.
Oh yeah, I know how that feels I like programming in C# too, and it does get crazy when they change something.
How I can set the window to fullscreen mode?
You can try this:
DisplayMode[] modes = Display.getAvailableDisplayModes();
for (int i = 0; i < modes.length; i++)
{
if (modes[i].getWidth() == width
&& modes[i].getHeight() == height
&& modes[i].isFullscreenCapable())
{
Display.setDisplayModeAndFullscreen(modes[i]);
}
}
@@ThinMatrix still replying after 8 years lol
Nostalgia!!!! :D
What do the withForwardCompatable and withProfileCore technically do? Just wondering bc on another tutorial they just used create();
withForwardCompatable means that this program is, obviously, forward compatible, meaning if there is a computer that uses a higher version of OpenGL, this program will be able to run on it. The core profile is slightly more complex, but essentially the core profile is modern OpenGL structure, apart from the previous fixed pipeline structure
Just using create() without context attribs will use the legacy fixed function version of OpenGL (< 2.1). withForwardCompatible will make it forwards compatible with future OpenGL versions (> 3.2) and withProfileCore uses the new, core OpenGL profile rather than fixed function.
hype man
Hey if you guys are having any issues with a sun.misc.Unsafe error just go into your module-info.java file and add in "requires jdk.unsupported"
After hours of hair tugging, this one comment saved me. Thank you so much.
the while loop didnt work for me so i changed it to this
while(Display.isActive()) {
if(Display.isCloseRequested()) {
Display_Manager.closeDisplay();
}
//gamelogic (Update/tick)
//render
Display_Manager.updateDisplay();
}
Woah, si j'arrive à m'accrocher à ce tutoriel je vais en apprendre plus sur Java et la création d'un jeu 3D que je ne l'aurais jamais imaginé ! Wonderful and brilliant, you just speak a little bit fast but that's really nothing, i can keep up the pace :D . Great work !
Please update to lwjgl 3.
hi
can i use this tutorial in 2021 or is it too old?
I have the same question..
please help
java.lang.ClassNotFoundException
I will rewrite the code to TypeScript and WebGL 1.0. The result: 8observer8.github.io/WebGL/thin-matrix-engine-tutorial/index.html
if you have the following error : org.lwjgl.LWJGLException: Could not create context (WGL_ARB_create_context)
then try the code below at DisplayManager.java file :
package renderEngine;
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.ContextAttribs;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.PixelFormat;
public class DisplayManager {
private static final int WIDTH = 500;
private static final int HEIGHT = 500;
private static final int FPS_CAP = 120;
public static void createDisplay(){
//ContextAttribs attribs = new ContextAttribs(3,0).withForwardCompatible(true).withProfileCore(true);
//ContextAttribs attribs = new ContextAttribs();
//attribs.withForwardCompatible(true);
//attribs.withProfileCore(true);
try {
Display.setDisplayMode(new DisplayMode(WIDTH,HEIGHT));
Display.create(new PixelFormat());
} catch (LWJGLException e) {
e.printStackTrace();
}
GL11.glViewport(0,0,WIDTH,HEIGHT);
}
public static void updateDisplay(){
Display.sync(FPS_CAP);
Display.update();
}
public static void closeDisplay(){
Display.destroy();
}
}
thank you .
@ThinMatrix Which video does the multiplayer stuff?
Exception in thread "main" java.lang.IllegalArgumentException: Profiles are only supported on OpenGL version 3.2 or higher.
at org.lwjgl.opengl.ContextAttribs.withProfileCore(ContextAttribs.java:188)
at renderEngine.displayManeger.createDisplay(displayManeger.java:25)
at engineTester.MainGameLoop.main(MainGameLoop.java:12)
This error comes whenever I run the game . Plz help me.
Can i change 3, 4 to: ContextAttribs attribs = *new ContextAttribs(1, 4)* .withForwardCompatible(true).withProfileCore(true);
For those following along in 2020,
Display has been deprecated: stackoverflow.com/a/28525313/2887274
Hello ThinkMatrix, Is there a way to send a link for downloading LWJGL 2?
Okay, so blah this and blah that... I never thought making a game would be hard =w=) especially if it's 3D T.T), I was just in the mood to make a 3D game... Yet it's so hard... BTW! Does anyone know or played the game, or anime, SAO? Or Soul Worker? I want to be my game like that, it's graphic's I mean... Is it really hard for a graphic in-game to be like that?
Hello I get this error and my code is the same as yours please help. Error: Could not find or load main class engineTester.MainGameLoop
Caused by: java.lang.ClassNotFoundException: engineTester.MainGameLoop
1,234th liker :)
Can i get code from somewhere? I don't want to *copy* and *paste* the code all over my project's... That's not good for m8. (Sorrry for bad english, i'm from poland *XD*)
If you remove the parameters from the Display.create() method and still doesn't work, check out the error log to solve the problem: in my case I had to comment out the following line: //attribs.withProfileCore(true); .