Bug 24 - GLCanvas does not honor layout
Summary: GLCanvas does not honor layout
Status: VERIFIED FIXED
Alias: None
Product: Jogl
Classification: JogAmp
Component: core (show other bugs)
Version: 1
Hardware: All macosx
: P3 normal
Assignee: Sven Gothel
URL:
Depends on:
Blocks:
 
Reported: 2003-07-11 01:21 CEST by Sven Gothel
Modified: 2010-03-24 07:45 CET (History)
0 users

See Also:
Type: DEFECT
SCM Refs:
Workaround: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sven Gothel 2010-03-24 07:45:35 CET


---- Reported by chadseld 2003-07-11 13:21:17 ----

A GLCanvas occupies all the space in a Frame/JFrame. There is no way to place a GLCanvas 
inside or next to a Panel/JPanel and keep it in a specific area of a Frame. The GLCanvas will 
always display itself over the entire Frame. The following pseudo code example works with 
gl4java, and (I'm told) with jogl for Windows, but in broken in jogl for Mac OS X.

public class Panels implements GLEventListener
{
    private Frame frame;
    private JPanel panel = new JPanel();
    private JLabel label = new JLabel("foo");
    private GLCanvas canvas;
    
    public static void main(String[] args)
    {
        Panels app = new Panels();
    }
    
    
    public Panels()
    {
        try
        {
            // Create GL Canvas
            canvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities());
            canvas.addGLEventListener(this);
            
            // Frame
            frame = new Frame("Simple Test World");
            frame.setSize(1024,1024);
            panel.setPreferredSize(new Dimension(64, 400));
            frame.add(canvas, BorderLayout.CENTER);
            frame.add(panel, BorderLayout.EAST);
            frame.add(label, BorderLayout.SOUTH);
            frame.addWindowListener(new WindowAdapter() {
                public void windowClosing(WindowEvent e) {
                    System.exit(0);
                }
            });            
            frame.show();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }
    
    
    public void init(GLDrawable drawable)
    {
        GLFunc gl = drawable.getGL();
        
        // This Will Clear The Background Color To light blue
        gl.glClearColor(0.8f, 0.8f, 0.99f, 0.0f);
        gl.glClearDepth(1.0);
        
        // Misc
        ...
        
        // Set up the viewport
        gl.glViewport(0,0, 10,10);// Toying with these bounds doesn't change anything
                                                
        
        // Prep for first draw
        gl.glMatrixMode(GLEnum.GL_MODELVIEW);
        gl.glLoadIdentity();
        gl.glClear(GLEnum.GL_DEPTH_BUFFER_BIT);
    }
    
    public void reshape(GLDrawable drawable, int x, int y, int width, int height)
    {
        ...
    }

    public void display(GLDrawable drawable)
    {
        GLFunc gl = drawable.getGL();
        GLUFunc glu = drawable.getGLU();
        
        //Clear The Screen And The Depth Buffer
        gl.glClear(GLEnum.GL_COLOR_BUFFER_BIT | GLEnum.GL_DEPTH_BUFFER_BIT);
    }
}


The entire frame will be drawn a pleasant light blue.



---- Additional Comments From kbr 2003-07-14 22:54:31 ----

There's no difference at the AWT level between the GLCanvas on Mac OS X and the
GLCanvas on any other platform. It would be great if you could submit another
test case showing what the output should look like. Currently I'm not succeeding
in getting this test to run with a GLJPanel replacing the GLCanvas.




---- Additional Comments From kbr 2003-11-05 10:44:13 ----

The submitter has indicated that this issue has been fixed with the latest
version of Java on Mac OS X.




--- Bug imported by sgothel@jausoft.com 2010-03-24 07:45 EDT  ---

This bug was previously known as _bug_ 24 at https://jogl.dev.java.net/bugs/show_bug.cgi?id=24