Problems with b237 and b243
Posted by km on Dec 04, 2010; 12:00pm
URL: https://forum.jogamp.org/Problems-with-b237-and-b243-tp2017928.html
Hello guys,
I'm facing some issues with JOGL2 b237/b243, while b211 works perfectly.
Basically I'm using the createExternalGLContext() method to create an external OpenGL context which I used in the QtGLWidget of Qt Jambi. This works nicely in b211, today I wanted to upgrade to a newer build once again and I noted that OpenGL is not drawing anymore.
I don't see any exceptions or similar, but I have a part in my code which does this:
logger_.info("OpenGL: vendor = " + gl.glGetString(GL2.GL_VENDOR)
+ ", renderer = " + gl.glGetString(GL2.GL_RENDERER)
+ ", version = " + gl.glGetString(GL2.GL_VERSION));
At runtime this results in the following output:
12:55:04,410 INFO main [GLDrawingEngine:102] OpenGL: vendor = null, renderer = null, version = null
Which is obviously not correct at all... in the past this used to be:
12:55:04,410 INFO main [GLDrawingEngine:102] OpenGL: vendor = ATI Technologies Inc., renderer = ATI Radeon HD 4800 Series, version = 2.1.9116
Now I did some tests to try to reproduce this issue without QtJambi in a simple AWT context. At this stage I also saw some strange issues:
In b211 I get for this output:
OpenGL: vendor = ATI Technologies Inc., renderer = ATI Radeon HD 4800 Series, version = 3.1.9116
While with b237 or 243 I get this output:
OpenGL: vendor = Microsoft Corporation, renderer = GDI Generic, version = 1.1.0
So somehow it switches back to the Software Renderer?
For the simple test, I used the following code:
public class Map implements GLEventListener
{
public static void main(final String[] args)
{
GLProfile.initSingleton(true);
GLProfile glp = GLProfile.getDefault();
GLCapabilities caps = new GLCapabilities(glp);
GLCanvas canvas = new GLCanvas(caps);
Frame frame = new Frame("AWT Window Test");
frame.setSize(300, 300);
frame.add(canvas);
frame.setVisible(true);
// by default, an AWT Frame doesn't do anything when you click
// the close button; this bit of code will terminate the program when
// the window is asked to close
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(final WindowEvent e) {
System.exit(0);
}
});
canvas.addGLEventListener(new Map());
FPSAnimator animator = new FPSAnimator(canvas, 60);
animator.add(canvas);
animator.start();
}
private double theta = 0;
private double s = 0;
private double c = 0;
@Override
public void display(final GLAutoDrawable drawable) {
update();
render(drawable);
}
@Override
public void dispose(final GLAutoDrawable drawable) {
}
@Override
public void init(final GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
System.err.println("OpenGL: vendor = " + gl.glGetString(GL2.GL_VENDOR)
+ ", renderer = " + gl.glGetString(GL2.GL_RENDERER)
+ ", version = " + gl.glGetString(GL2.GL_VERSION));
}
@Override
public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int w, final int h) {
}
private void update() {
theta += 0.01;
s = Math.sin(theta);
c = Math.cos(theta);
}
private void render(final GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
// draw a triangle filling the window
gl.glBegin(GL.GL_TRIANGLES);
gl.glColor3f(1, 0, 0);
gl.glVertex2d(-c, -c);
gl.glColor3f(0, 1, 0);
gl.glVertex2d(0, c);
gl.glColor3f(0, 0, 1);
gl.glVertex2d(s, -s);
gl.glEnd();
}
}
Anybody ideas? Did something change here recently? Or is this still a work in progress?
Thanks,