Problem Setting Up

Hi, I just started using LWJGL with eclipse recently and had no problem setting it up on my main computer but for some reason it is not working on my laptop. It’s the same project and everything the only difference I could think of is my main computer is 64bit and my laptop is 32bit, not that I think it would make a difference. I installed LWJGL into my java folder in program files and added the library for the project including the natives so I am at a complete loss. Then I was like hey I’ll just get all the stuff to make android games on my laptop and make java games on my other pc and that crap isn’t working right either… just my luck.

This is the compilation error.

Sep 18, 2013 4:22:27 PM com.base.engine.Main initDisplay
SEVERE: null
org.lwjgl.LWJGLException: Pixel format not accelerated
	at org.lwjgl.opengl.WindowsPeerInfo.nChoosePixelFormat(Native Method)
	at org.lwjgl.opengl.WindowsPeerInfo.choosePixelFormat(WindowsPeerInfo.java:52)
	at org.lwjgl.opengl.WindowsDisplay.createWindow(WindowsDisplay.java:252)
	at org.lwjgl.opengl.Display.createWindow(Display.java:306)
	at org.lwjgl.opengl.Display.create(Display.java:848)
	at org.lwjgl.opengl.Display.create(Display.java:757)
	at org.lwjgl.opengl.Display.create(Display.java:739)
	at com.webs.burningtreegames.engine.Main.initDisplay(Main.java:83)
	at com.webs.burningtreegames.engine.Main.main(Main.java:22)

Exception in thread "main" java.lang.RuntimeException: No OpenGL context found in the current thread.
	at org.lwjgl.opengl.GLContext.getCapabilities(GLContext.java:124)
	at org.lwjgl.opengl.GL11.glMatrixMode(GL11.java:2073)
	at com.webs.burningtreegames.engine.Main.initGL(Main.java:68)
	at com.webs.burningtreegames.engine.Main.main(Main.java:23)

Throw in the main class from the tutorial I’m doing and like I said its the same as on my gaming pc.

package com.base.engine;

import java.util.logging.Level;
import java.util.logging.Logger;

import org.lwjgl.LWJGLException;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;

import com.base.game.GameMain;

import static org.lwjgl.opengl.GL11.*;

public class Main 
{

	private static GameMain gameMain;
	
	public static void main(String[] Args)
	{
		initDisplay();
		initGL();
		initGame();
		
		gameLoop();
		cleanUp();
	}
	
	private static void initGame()
	{
		gameMain = new GameMain();
	}
	
	private static void gameLoop()
	{
		while(!Display.isCloseRequested())
		{
			getInput();
			update();
			render();
		}
	}
	
	private static void getInput()
	{
		gameMain.getInput();
	}

	private static void update()
	{
		gameMain.update();
	}
	
	private static void render()
	{
		glClear(GL_COLOR_BUFFER_BIT);
		glLoadIdentity();
		
		gameMain.render();
		
		Display.update();
		Display.sync(60);
	}
	
	private static void initGL()
	{
		glMatrixMode(GL_PROJECTION);
		glLoadIdentity();
		glOrtho(0,Display.getWidth(),0,Display.getHeight(),-1,1);
		glMatrixMode(GL_MODELVIEW);
		
		glDisable(GL_DEPTH_TEST);
		
		glClearColor(0,0,0,0);
	}
	
	public static void initDisplay()
	{
		
		try {
			Display.setDisplayMode(new DisplayMode(800,600));
			Display.create();
			Keyboard.create();
			Display.setVSyncEnabled(true);
		} catch (LWJGLException e) 
		{
			Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, e);
		}
	}
	
	private static void cleanUp()
	{
		Display.destroy();
		Keyboard.destroy();
	}
}

You most likely don’t have the latest driver for your video card or you have a super old card that doesn’t support OpenGL (not likely). Can you post your computer specs?

Yes, actually I just tried to play another game that uses lwjgl and got the same error in the console.

My laptop has an ati radeon 4100m and I am having a hard time finding a driver for it. Toshiba only has a 2010 driver for my L505d - S5985.

If you are just using opengl 1, then you should be able to just re-install the video drivers and it fix it.

NOW, besides that…consider lightening up on the static, maybe? It’s of no use in the code you’ve shown besides the main method.

Its from a tutorial so I don’t really know. I have never even used java the way he does. He mad like 3 packages and several classes. He did kinda make the game engine separate though so I don’t know.

I mean, I get what he’s doing, but that’s just not how anyone generally does it.

Anyway, back to your original problem, just re-install your drivers.

Alright well thanks guys for replying I finally found out what is going on with the drivers. There is something wrong with the latest catalyst drivers for some of these older cards. I got a 2012 version of catalyst control center and it cleared things up. Also for now I’m just gonna leave everything how he shows it. I don’t really care much I just want to learn ideas on how to do rpgs along with using lwjgl other than me just bashing away at it on my own.