Author Topic: Noob: Cannot get OGL hello world to run :/  (Read 2494 times)

Offline D4NM4N

  • byte
  • *
  • Posts: 15
    • View Profile
Noob: Cannot get OGL hello world to run :/
« on: January 11, 2011, 11:56:16 pm »
Hi everyone, new here  ;D

I have been playing around with the examples but cannot seem to get the OGL versions working. (SW versions work ok)

I get a grey screen with:

"WARNING: displayGLOnly() shouldn't be called without OpenGL support being (solely) used"

in the output.

I am using Ubuntu and I have an intel card HWRendering yes and ogl v1.4 in glx info. Is this enough or is it 2.0+ only?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: Noob: Cannot get OGL hello world to run :/
« Reply #1 on: January 12, 2011, 09:31:45 am »
Try to disable the software renderer. If you don't, both are active, which usually isn't what you want.

Offline D4NM4N

  • byte
  • *
  • Posts: 15
    • View Profile
Re: Noob: Cannot get OGL hello world to run :/
« Reply #2 on: January 17, 2011, 10:36:03 pm »
I am using the out of the box example doesn't line 3 do that?

Code: [Select]
   private void loop() throws Exception {
        buffer = new FrameBuffer(800, 600, FrameBuffer.SAMPLINGMODE_NORMAL);
        buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
        buffer.enableRenderer(IRenderer.RENDERER_OPENGL, IRenderer.MODE_OPENGL);
int a=1;
        while (a!=2) {
            box.rotateY(0.01f);
            buffer.clear(java.awt.Color.BLUE);
            world.renderScene(buffer);
            world.draw(buffer);
            buffer.update();
            buffer.displayGLOnly();
            Thread.sleep(10);
        }
        buffer.disableRenderer(IRenderer.RENDERER_OPENGL);
        buffer.dispose();
        System.exit(0);
    }

Here is my glxinfo:
Code: [Select]
name of display: :0.0
display: :0  screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.2
server glx extensions:
    GLX_ARB_multisample, GLX_EXT_import_context, GLX_EXT_texture_from_pixmap,
    GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_MESA_copy_sub_buffer,
    GLX_OML_swap_method, GLX_SGI_make_current_read, GLX_SGI_swap_control,
    GLX_SGIS_multisample, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer,
    GLX_SGIX_visual_select_group
client glx vendor string: Mesa Project and SGI
client glx version string: 1.4
client glx extensions:
    GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_import_context,
    GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_MESA_allocate_memory,
    GLX_MESA_copy_sub_buffer, GLX_MESA_swap_control,
    GLX_MESA_swap_frame_usage, GLX_OML_swap_method, GLX_OML_sync_control,
    GLX_SGI_make_current_read, GLX_SGI_swap_control, GLX_SGI_video_sync,
    GLX_SGIS_multisample, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer,
    GLX_SGIX_visual_select_group, GLX_EXT_texture_from_pixmap
GLX version: 1.2
GLX extensions:
    GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_import_context,
    GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_MESA_copy_sub_buffer,
    GLX_MESA_swap_frame_usage, GLX_OML_swap_method, GLX_SGI_make_current_read,
    GLX_SGI_video_sync, GLX_SGIS_multisample, GLX_SGIX_fbconfig,
    GLX_SGIX_pbuffer, GLX_SGIX_visual_select_group,
    GLX_EXT_texture_from_pixmap
OpenGL vendor string: Tungsten Graphics, Inc
OpenGL renderer string: Mesa DRI Intel(R) 945GM GEM 20091221 2009Q4
OpenGL version string: 1.4 Mesa 7.7.1
OpenGL extensions:

Does Mesa mean that it is limited to software at the OS level? On my other machine it seems to work ok.
« Last Edit: January 17, 2011, 10:37:35 pm by D4NM4N »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: Noob: Cannot get OGL hello world to run :/
« Reply #3 on: January 17, 2011, 10:43:18 pm »
Yes, line 3 disables it. However, the log messages indicates that either the software renderer in active (obviously not) or that the opengl renderer isn't. Maybe it can't initialize correctly. Do you have the complete log?

I'm not sure right now, but i think MESA blah blah is ok for Intel chips on Linux.

Offline D4NM4N

  • byte
  • *
  • Posts: 15
    • View Profile
Re: Noob: Cannot get OGL hello world to run :/
« Reply #4 on: January 17, 2011, 11:32:03 pm »
Ok thanks :)

While i am at it, is there any reason why the SW version of hello world uses a jframe and the OGL one doesn't?
Also are there any tutorials about for this?

edit: i just noticed this at the top of the log (did not see it before because it scrolled out):
[ Mon Jan 17 23:46:30 CET 2011 ] - ERROR: Using a native GL renderer isn't possible when using JOGL! Remove glfacade.jar from the classpath!

i removed that and now getting:
Code: [Select]
run:
Loading Texture...box.jpg
Java version is: 1.6.0_20
-> support for BufferedImage
Version helper for 1.5+ initialized!
-> using BufferedImage
Software renderer (OpenGL mode) initialized
Software renderer disposed
Exception in thread "main" java.lang.NoClassDefFoundError: org/lwjgl/opengl/Display
        at com.threed.jpct.GLHelper.findMode(Unknown Source)
        at com.threed.jpct.GLHelper.findMode(Unknown Source)
        at com.threed.jpct.GLHelper.init(Unknown Source)
        at com.threed.jpct.GLRenderer.init(Unknown Source)
        at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
        at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
        at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
        at HelloWorldOGL.loop(HelloWorldOGL.java:40)
        at HelloWorldOGL.main(HelloWorldOGL.java:18)
Caused by: java.lang.ClassNotFoundException: org.lwjgl.opengl.Display
        at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
        ... 9 more
Java Result: 1
BUILD SUCCESSFUL (total time: 1 second)
« Last Edit: January 17, 2011, 11:56:43 pm by D4NM4N »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: Noob: Cannot get OGL hello world to run :/
« Reply #5 on: January 18, 2011, 07:50:00 am »
You are mixing some thing here...jPCT has basically 4 output modes.

  • Software rendering: This is done into an image, hence the usage of JFrame
  • LWJGL based hardware rendering: This is done into a native window provided by LWJGL. Swing/AWT aren't used here.
  • LWJGL based hardware rendering on top of AWT: This is done into a special canvas provided by LWJGL. You have to enable it by using http://www.jpct.net/doc/com/threed/jpct/FrameBuffer.html#enableGLCanvasRenderer().
  • JOGL based hardware rendering: This is done by routing all calls to LWJGL to JOGL. You need to have JOGL as well as the GLFacade in the classpath. Enable it like LWJGL's AWT support. You can't use the native window (i.e. the non-AWT-based renderer with that, which is why you get the error message.

In your case, i suggest to go with LWJGL (which is jPCT's "native" binding). Remove glfacade.jar (maybe jogl is present) from the classpath and add the lwjgl jars and SOs instead. A brief overview can be found here: http://www.jpct.net/wiki/index.php/How_to_install

Offline D4NM4N

  • byte
  • *
  • Posts: 15
    • View Profile
Re: Noob: Cannot get OGL hello world to run :/
« Reply #6 on: January 18, 2011, 11:21:10 pm »
Tht explains a few things, I think i am after option 2 with an optional software mode.

Are there examples/tutorials that show the initialisation and exactly which jars i need to include for all of these 4 modes.
I have looked and googled but cannot find any tuts for jpct at all.

I am a fairly experienced C# and C++ programmer but Java is fairly new to me and although it is very similar to C# and i am picking up the syntactical differences, i am still trying to get my head around the whole package/namespace/include system that Java uses (it seems to be very different to c# in this respect)

-so you will have to forgive my idiot questions.  ;D

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: Noob: Cannot get OGL hello world to run :/
« Reply #7 on: January 18, 2011, 11:30:58 pm »
Some people started with kind of tutorials, but never really finished them. The wiki is what comes closest to a tutorial. HelloWorld and the Advanced Example are explained in a little more detail there. Maybe that helps.