2
votes

I am working on an lwjgl project that has the following code:

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).withForwardCompatible(true).withProfileCore(true);

        try {
            Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
            Display.create(new PixelFormat(), attribs);
        } catch (LWJGLException ex) {
             Logger.getLogger(DisplayManager.class.getName()).log(Level.SEVERE, null, ex);
        }

        GL11.glViewport(0,0,WIDTH,HEIGHT);
    }

    public static void updateDisplay() {
        Display.sync(FPS_CAP);
        Display.update();
    }

    public static void closeDisplay() {
        Display.destroy();
    }
}

I am getting the following error message:

org.lwjgl.LWJGLException: Could not create context (WGL_ARB_create_context) at org.lwjgl.opengl.WindowsContextImplementation.nCreate(Native Method) at org.lwjgl.opengl.WindowsContextImplementation.create(WindowsContextImplementation.java:50) at org.lwjgl.opengl.ContextGL.(ContextGL.java:132) at org.lwjgl.opengl.Display.create(Display.java:850) at org.lwjgl.opengl.Display.create(Display.java:797) at javaapplication15.DisplayManager.createDisplay(DisplayManager.java:34) at javaapplication15.engineTester.MainGameLoop.main(MainGameLoop.java:21)

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.glViewport(GL11.java:3261) at javaapplication15.DisplayManager.createDisplay(DisplayManager.java:41) at javaapplication15.engineTester.MainGameLoop.main(MainGameLoop.java:21) Java Result: 1

2
Looks like it might be telling you that your system does not support OpenGL 3.2. Are you sure that it does?Reto Koradi
Intel Pentium with HD Graphics, I searched the web and it looks like it doesn't support it. Thanks.ScottM

2 Answers

3
votes

It may not answer your question, but my solution may be a help to others. If your laptop has integrated graphics card and additional more powerful graphics card it is likely that you will get this error. It is because your created program uses integrated graphics card, which does not support OpenGL 3.2. However if you will switch to your second, more powerful, graphics card your program will work fine.

0
votes

Could not create context (WGL_ARB_create_context)

I know that the question is not years ago but in case it helps

You solved the same problem and solved it by deleting the enter parameters of create ()

Display.create(new PixelFormat(), attribs); //before

Change for:

 Display.create();

and run