Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (521)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (589)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  creating a GL3 object in QtJambi  (Read 1931 times)
0 Members and 1 Guest are viewing this topic.
Offline voodoogiant

Senior Newbie





« Posted 2010-10-08 03:42:04 »

I'm having some difficulty getting a GL3 context now that I've
switched to QtJambi.  When casting my gl object to GL using getGL3, it
throws the error "javax.media.opengl.GLException: Not a GL3
implementation".

This is my original code when I was using swing...
GLProfile profile = GLProfile.get(GLProfile.GL3)
GLCapabilities glCaps = new GLCapabilities(profile)
glCaps.setPBuffer(true)
GLPBuffer pbuffer =
GLDrawableFactory.getFactory(profile).createGLPbuffer(glCaps,

      new DefaultGLCapabilitiesChooser(),

      1, 1, null)
canvas = new GLCanvas(glCaps, new DefaultGLCapabilitiesChooser(),
PanelGL.pbuffer.getContext(), null)

Switch to QtJambi, I have the following code:


   GLProfile profile = GLProfile.get(GLProfile::GL3)
   GLCapabilities glCaps = GLCapabilities.new(profile)
   glCaps.setPBuffer(true)
   factory = GLDrawableFactory.getFactory(profile)
   ctx = factory.createExternalGLContext
   gl = ctx.getGL.getGL3

This last line throws an error.  I've seen this page
(http://www.java-gaming.org/index.php?action=printpage;topic=21064.0),
which solves the issue, but it's passing something to a GLCanvas
constructor, which is swing.  Is there an equivalent setup in QtJambi
to get me a GL3 object?
Offline gouessej
« Reply #1 - Posted 2010-10-08 10:34:47 »

Hi!

Don't cast your object, rather call GLContext.getCurrentGL().getGL3() (as you already do). DefaultGLCapabilitiesChooser does not depend on Swing:
1  
2  
3  
4  
5  
package javax.media.opengl;

import javax.media.nativewindow.Capabilities;
import javax.media.nativewindow.NativeWindowException;
import com.jogamp.opengl.impl.Debug;


Which build of JOGL 2 beta do you use?

Offline voodoogiant

Senior Newbie





« Reply #2 - Posted 2010-10-08 16:20:12 »

So you're saying GLContext.getCurrentGL().getGL3() provides different functionality than ctx.getGL.getGL3()?  Should I not be using an external context then?  I was hoping to eventually have the OpenGL context shared across multiple windows like I did with swing, but was trying to keep this simple for now.  Are there any QtJambi examples out there that use a GL3 implementation? 

I believe I'm using the latest nightly JOGL build.  Here are the jars I'm using...
http://code.google.com/p/sunshine/source/browse/#hg/lib/jogl-2.0-linux-i586
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline voodoogiant

Senior Newbie





« Reply #3 - Posted 2010-10-09 15:05:19 »

Adding GLContext.getCurrentGL().getGL3() at the end of my initializeGL function returns an error saying there's not context current

1  
Exception in thread "main" javax/media/opengl/GLContext.java:159:in `getCurrentGL': javax.media.opengl.GLException: No OpenGL context current on this thread (NativeException)


1  
2  
3  
4  
5  
6  
7  
8  
9  
  public void initializeGL() {
    profile = GLProfile.get(GLProfile.GL3)
    glCaps = GLCapabilities.new(profile)
    glCaps.setPBuffer(true)
    factory = GLDrawableFactory.getFactory(profile)
    ctx = factory.createExternalGLContext()
    gl = GLContext.getCurrentGL().getGL3()
    //gl = ctx.getGL.getGL3
}
Offline gouessej
« Reply #4 - Posted 2010-10-09 15:34:04 »

So you're saying GLContext.getCurrentGL().getGL3() provides different functionality than ctx.getGL.getGL3()?  Should I not be using an external context then?  I was hoping to eventually have the OpenGL context shared across multiple windows like I did with swing, but was trying to keep this simple for now.  Are there any QtJambi examples out there that use a GL3 implementation? 

I believe I'm using the latest nightly JOGL build.  Here are the jars I'm using...
http://code.google.com/p/sunshine/source/browse/#hg/lib/jogl-2.0-linux-i586
No, JOGL 2 is rather there:
http://jogamp.org/deployment/autobuilds/
I have no example of use with both JOGL 2 and QtJambi. Personally I use JOGL 2 with Ardor3D and/or Eclipse RCP/SWT, I have found a good tutorial about it:
http://wadeawalker.wordpress.com/2010/10/09/tutorial-a-cross-platform-workbench-program-using-java-opengl-and-eclipse/

Adding GLContext.getCurrentGL().getGL3() at the end of my initializeGL function returns an error saying there's not context current
initializeGL() seems to be called when the OpenGL context is not current, it should be called in the init method of GLEventListener.

Offline voodoogiant

Senior Newbie





« Reply #5 - Posted 2010-10-11 17:11:36 »

I'm not using a GLEventListener.  I'm using a QGLWidget.  I ended up having to call makeCurrent in the objects initializeGL call, which seemed to resolve the siutation.  I added notes of how to do it (in JRuby) in a blog post (http://strattonbrazil.blogspot.com/2010/10/incorporating-scala-java-sbt-jogl-qt.html).
Offline gouessej
« Reply #6 - Posted 2010-10-14 23:06:34 »

I'm not using a GLEventListener.  I'm using a QGLWidget.  I ended up having to call makeCurrent in the objects initializeGL call, which seemed to resolve the siutation.  I added notes of how to do it (in JRuby) in a blog post (http://strattonbrazil.blogspot.com/2010/10/incorporating-scala-java-sbt-jogl-qt.html).
Thank you very much for this tip  Grin

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xFryIx (57 views)
2014-11-13 12:34:49

digdugdiggy (35 views)
2014-11-12 21:11:50

digdugdiggy (29 views)
2014-11-12 21:10:15

digdugdiggy (23 views)
2014-11-12 21:09:33

kovacsa (46 views)
2014-11-07 19:57:14

TehJavaDev (50 views)
2014-11-03 22:04:50

BurntPizza (50 views)
2014-11-03 18:54:52

moogie (65 views)
2014-11-03 06:22:04

CopyableCougar4 (63 views)
2014-11-01 23:36:41

DarkCart (148 views)
2014-11-01 14:51:03
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!