Jump to content

Java LWJGL Issues

AlTech

Hi guys,

 

I'm trying to follow an LWJGL tutorial and i'm getting quite a few problems.

 

error1.PNG

 

 

 

Same again here:

error2.PNG

 

 

error4.PNG

 

The code is here:

package com.aluminiumtech.flappy;

import static org.lwjgl.glfw.GLFW.*;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.system.MemoryUtil.*;

import java.nio.ByteBuffer;

import org.lwjgl.glfw.GLFWVidMode;

public class Main implements Runnable{

	private int width = 1280;
	private int height = 720;
	
	private long window;
	
	private Thread thread;
	private boolean running = false;
	
	public void start()
	{
		thread = new Thread(this,"Game");
		thread.start();
	}
	public void run()
	{
		init();
		
	while(running)
	{
		update();
		render();
		
		if(glfwWindowShouldClose(window) == GL_TRUE)
		{
			running = false;
		}
	}
	
	}
	
	private void init() {
		if(glfwInit() != GL_TRUE)
		{
			return;
		}
		
		
		glfwWindowHint(GLFW_RESIZABLE,GL_TRUE);
		window = glfwCreateWindow(width,height,"Flappy",NULL,NULL);
		
		if(window == NULL)
		{
			return;
		}
		
		
		ByteBuffer vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor());
		glfwSetWindowPos(window,(GLFWVidMode.width(vidmode)- width) / 2,  (GLFWVidMode.height(vidmode) / 2));
		glfwMakeContextCurrent(window);
		glfwShowWindow(window);
		
		
	}
	private void update() {
		// TODO Auto-generated method stub
		
		glfwPollEvents();
	}
	private void render() {
		// TODO Auto-generated method stub
		
		glfwSwapBuffers(window);
		
		
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		
		
	}

}

 

Thanks :).

Judge a product on its own merits AND the company that made it.

How to setup MSI Afterburner OSD | How to make your AMD Radeon GPU more efficient with Radeon Chill | (Probably) Why LMG Merch shipping to the EU is expensive

Oneplus 6 (Early 2023 to present) | HP Envy 15" x360 R7 5700U (Mid 2021 to present) | Steam Deck (Late 2022 to present)

 

Mid 2023 AlTech Desktop Refresh - AMD R7 5800X (Mid 2023), XFX Radeon RX 6700XT MBA (Mid 2021), MSI X370 Gaming Pro Carbon (Early 2018), 32GB DDR4-3200 (16GB x2) (Mid 2022

Noctua NH-D15 (Early 2021), Corsair MP510 1.92TB NVMe SSD (Mid 2020), beQuiet Pure Wings 2 140mm x2 & 120mm x1 (Mid 2023),

Link to comment
Share on other sites

Link to post
Share on other sites

Check the docs to see what's the return type of every method and you'll find your answer on why you are getting such errors.

Why do you check explicitly in the conditionals?

From salty to bath salty in 2.9 seconds

 

Link to comment
Share on other sites

Link to post
Share on other sites

27 minutes ago, Pandalf said:

Check the docs to see what's the return type of every method and you'll find your answer on why you are getting such errors.

Why do you check explicitly in the conditionals?

I'm just following the tutorial...........I'm copying the code and listening to the explanation

Judge a product on its own merits AND the company that made it.

How to setup MSI Afterburner OSD | How to make your AMD Radeon GPU more efficient with Radeon Chill | (Probably) Why LMG Merch shipping to the EU is expensive

Oneplus 6 (Early 2023 to present) | HP Envy 15" x360 R7 5700U (Mid 2021 to present) | Steam Deck (Late 2022 to present)

 

Mid 2023 AlTech Desktop Refresh - AMD R7 5800X (Mid 2023), XFX Radeon RX 6700XT MBA (Mid 2021), MSI X370 Gaming Pro Carbon (Early 2018), 32GB DDR4-3200 (16GB x2) (Mid 2022

Noctua NH-D15 (Early 2021), Corsair MP510 1.92TB NVMe SSD (Mid 2020), beQuiet Pure Wings 2 140mm x2 & 120mm x1 (Mid 2023),

Link to comment
Share on other sites

Link to post
Share on other sites

36 minutes ago, AluminiumTech said:

I'm just following the tutorial...........I'm copying the code and listening to the explanation

Maybe the API has changed?

The tutorial may not be adapted to the latest version of lwjgl.

 

First 2 errors are fixed by replacing GL_TRUE with true.

Desktop: Intel i9-10850K (R9 3900X died 😢 )| MSI Z490 Tomahawk | RTX 2080 (borrowed from work) - MSI GTX 1080 | 64GB 3600MHz CL16 memory | Corsair H100i (NF-F12 fans) | Samsung 970 EVO 512GB | Intel 665p 2TB | Samsung 830 256GB| 3TB HDD | Corsair 450D | Corsair RM550x | MG279Q

Laptop: Surface Pro 7 (i5, 16GB RAM, 256GB SSD)

Console: PlayStation 4 Pro

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×