Example usage for org.lwjgl.opengl GL11 glClearColor

List of usage examples for org.lwjgl.opengl GL11 glClearColor

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 glClearColor.

Prototype

public static void glClearColor(@NativeType("GLfloat") float red, @NativeType("GLfloat") float green,
        @NativeType("GLfloat") float blue, @NativeType("GLfloat") float alpha) 

Source Link

Document

Sets the clear value for fixed-point and floating-point color buffers in RGBA mode.

Usage

From source file:edu.csun.ecs.cs.multitouchj.ui.graphic.WindowManager.java

License:Apache License

protected void initializeOpenGl() {
    DisplayMode displayMode = displayManager.getCurrentDisplayMode();

    GL11.glEnable(GL11.GL_DEPTH_TEST);//from   w ww. j a  va2  s  . c o  m
    GL11.glClearDepth(1.0f);
    GL11.glDepthFunc(GL11.GL_LEQUAL);

    GL11.glViewport(0, 0, displayMode.getWidth(), displayMode.getHeight());
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();

    //GLU.gluPerspective(45.0f, (float)SCREEN_WIDTH/(float)SCREEN_HEIGHT, 4.0f, 4000.0f);
    GLU.gluPerspective(45.0f, (float) displayMode.getWidth() / (float) displayMode.getHeight(), 1.0f, 100.0f);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();

    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    //GL11.glClearDepth(1.0f);

    //GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
    //GL11.glHint(GL11.GL_POLYGON_SMOOTH_HINT, GL11.GL_NICEST);

    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glCullFace(GL11.GL_BACK);
}

From source file:engine.gui.EmptyWindow.java

License:Open Source License

@Override
public void draw(Graphics g) {

    GL11.glClearColor(0.5f, 0.1f, 0.1f, 0.5f);

    // Draw the widgets
    for (Widget w : widgetList) {
        w.draw(g);//  w  w  w .j av a2 s .c  o  m
    }

    GL11.glClearColor(0.1f, 0.1f, 0.1f, 0);
}

From source file:espresso3d.engine.E3DEngine.java

License:Open Source License

private void initGL() {
    logger.writeLine(E3DEngineLogger.SEVERITY_INFO, "Initializing OpenGL");

    GL11.glShadeModel(GL11.GL_SMOOTH); // Enable Smooth Shading
    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background  
    GL11.glClearDepth(1.0); // Depth Buffer Setup
    GL11.glEnable(GL11.GL_DEPTH_TEST); // Enables Depth Testing
    GL11.glDepthFunc(GL11.GL_LEQUAL); // The Type Of Depth Testing To Do
    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); // Set Perspective Calculations To Most Accurate
}

From source file:eu.over9000.veya.gui.Gui.java

License:Open Source License

private static void setUpStates(final int width, final int height) {
     try {/*from  w ww.ja v  a2  s .  c o m*/
         Display.setDisplayMode(new DisplayMode(width, height));

         Display.create();
         //Display.create(new PixelFormat().withSamples(4).withDepthBits(24), new ContextAttribs(3, 3));
         Display.setVSyncEnabled(true);
     } catch (final LWJGLException e) {
         e.printStackTrace();
         System.exit(0);
     }

     GL11.glEnable(GL11.GL_TEXTURE_2D);
     GL11.glShadeModel(GL11.GL_SMOOTH);
     GL11.glDisable(GL11.GL_DEPTH_TEST);
     GL11.glDisable(GL11.GL_LIGHTING);

     GL11.glClearColor(0.0f, 0.3f, 0.0f, 0.0f);
     GL11.glClearDepth(1);

     GL11.glEnable(GL11.GL_BLEND);
     GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

     GL11.glViewport(0, 0, width, height);
     GL11.glMatrixMode(GL11.GL_MODELVIEW);

     GL11.glMatrixMode(GL11.GL_PROJECTION);
     GL11.glLoadIdentity();
     GL11.glOrtho(0, width, height, 0, 1, -1);
     GL11.glMatrixMode(GL11.GL_MODELVIEW);
 }

From source file:eu.over9000.veya.Veya.java

License:Open Source License

private static void init() throws LWJGLException {
    final Canvas canvas = new Canvas();
    frame = new Frame();
    frame.add(canvas);//w w w .  j  a v a2  s  . c  om
    frame.setSize(1280, 720);
    frame.setLocationByPlatform(true);
    frame.setVisible(true);
    frame.setExtendedState(Frame.MAXIMIZED_BOTH);
    frame.setIconImage(loadIcon());

    Display.setParent(canvas);
    Display.create(new PixelFormat().withSamples(4).withDepthBits(24), new ContextAttribs(3, 3));

    System.out.println("OpenGL version: " + GL11.glGetString(GL11.GL_VERSION));
    System.out.println("Java version: " + System.getProperty("java.version"));
    System.out.println("graphics adapter: " + Display.getAdapter());

    Veya.program_normal = new Program("normal",
            new String[] { "modelMatrix", "viewMatrix", "projectionMatrix", "lightPosition", "lightColor",
                    "lightFactors", "colorSwitch", "aoSwitch", "cameraPosition", "lightSpaceMatrix",
                    "textureData", "shadowMap" });
    Veya.program_shadow = new Program("shadow", new String[] { "modelMatrix", "lightSpaceMatrix" });
    Veya.program_debug = new Program("debug", new String[] { "near_plane", "far_plane" });

    Util.checkGLError();

    Veya.camera = new Camera(-40, 120, -40);
    Veya.scene = new Scene(1337);

    Util.checkGLError();

    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glLineWidth(2.5f);

    Util.checkGLError();

    GL11.glEnable(GL31.GL_PRIMITIVE_RESTART);
    GL31.glPrimitiveRestartIndex(Veya.RESTART);
    GL11.glViewport(0, 0, Display.getWidth(), Display.getHeight());
    GL11.glClearColor(124f / 255f, 169f / 255f, 255f / 255f, 1.0f);

    Mouse.setGrabbed(true);

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    Console.start();
}

From source file:eu.over9000.veya.Veya.java

License:Open Source License

private static void run() {
    Util.checkGLError();//w w  w. jav  a 2 s . co  m

    Veya.program_normal.use(true);
    Veya.camera.updateProjectionMatrix(Display.getWidth(), Display.getHeight());
    Veya.camera.updateViewMatrix();
    Veya.scene.init();

    Veya.program_normal.use(false);

    program_normal.use(true);
    GL20.glUniform1i(Veya.program_normal.getUniformLocation("colorSwitch"), Veya.colorSwitch ? 1 : 0);
    program_normal.use(false);

    program_normal.use(true);
    GL20.glUniform1i(Veya.program_normal.getUniformLocation("aoSwitch"), Veya.aoSwitch ? 1 : 0);
    program_normal.use(false);

    Util.checkGLError();

    long start = Sys.getTime();
    long lastTime = start;
    long count = 0;

    while (!Display.isCloseRequested() && !shutdown) {
        final long time = Sys.getTime();
        final float dt = (time - lastTime) / 1000.0f;
        lastTime = time;

        checkResize();

        handleMovementKeys(dt);
        handleOtherKeys();
        handleMouseInput();

        if (gravitySwitch) {
            Veya.camera.applyGravity(dt);
        }

        Veya.camera.performMove();

        GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

        Veya.program_normal.use(true);

        if (ENABLE_DAY_NIGHT) {
            final float posX = (float) Math.sin(System.currentTimeMillis() / 10000.0) * 512;
            final float posY = (float) Math.cos(System.currentTimeMillis() / 10000.0) * 512;
            // final float posZ = (float) Math.cos(System.currentTimeMillis() / 1500.0) * 20f;
            ambient = 0.25f + MathUtil.scale(posY, -1024, 1024, 0, 0.55f);
            diffuse = MathUtil.scale(posY, -1024, 1024, 0, 0.5f);
            specular = MathUtil.scale(posY, -1024, 1024, 0, 0.5f);
            final float kek = (posY / 1024f + 1) / 2;

            GL11.glClearColor(kek * 124f / 255f, kek * 169f / 255f, kek * 255f / 255f, 1.0f);
            Veya.scene.getLight().updateLightPosition(posX + Veya.camera.getPosition().getX(), posY,
                    1 + Veya.camera.getPosition().getZ());
        }

        //Veya.scene.getLight().updateLightPosition(Veya.camera.getPosition().getX() + 1, 500, Veya.camera.getPosition().getZ() + 250);

        Veya.camera.updateViewMatrix();
        Veya.camera.updateCameraPosition();
        Veya.scene.getLight().updateLightFactors(Veya.ambient, Veya.diffuse, Veya.specular);
        Veya.scene.render();

        Util.checkGLError();

        Veya.program_normal.use(false);

        Display.update();
        // Display.sync(60);
        Util.checkGLError();

        final long end = Sys.getTime();
        if (end - start > 1000) {
            start = end;
            frame.setTitle("VEYA | fps: " + count + " | pos: x=" + Veya.camera.getPosition().x + ", y="
                    + Veya.camera.getPosition().y + ", z=" + Veya.camera.getPosition().z
                    + " | #chunks displayed: " + Veya.scene.getChunkCount() + " | lightFactors: A="
                    + Veya.ambient + ", D=" + Veya.diffuse + ", S=" + Veya.specular + " | chunk updates: "
                    + scene.chunkUpdateCounterInRender.get() + "/" + scene.chunkUpdateCounterOffRender.get()
                    + " | selected block: " + scene.placeBlockType);
            count = 0;
            scene.chunkUpdateCounterInRender.set(0);
            scene.chunkUpdateCounterOffRender.set(0);

        } else {
            count++;
        }
    }
}

From source file:fable.framework.ui.views.chiPlotView.java

License:Open Source License

/**
 * This is a callback that will allow us to create the viewer and initialize
 * it.//from  ww w  .j ava 2s  .com
 */
/*
 * (non-Javadoc)
 * 
 * @see
 * org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets
 * .Composite)
 */
/*
 * (non-Javadoc)
 * 
 * @see
 * org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets
 * .Composite)
 */
public void createPartControl(Composite parent) {

    // logger = FableLogger.getLogger();
    console = new FableMessageConsole("Peaksearch console");
    ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] { console });
    console.displayOut("Welcome to chiplotview " + ToolBox.getPluginVersion(Activator.PLUGIN_ID));

    IOConsoleOutputStream stream = console.newOutputStream();

    // console_debug = new ConsoleLineTracker();

    System.setOut(new PrintStream(stream, true));
    System.setErr(new PrintStream(stream));

    thisView = this;
    parent.setLayout(new GridLayout());
    Composite controlPanelComposite = new Composite(parent, SWT.NULL);
    GridLayout controlGridLayout = new GridLayout();
    controlGridLayout.numColumns = 8;
    controlPanelComposite.setLayout(controlGridLayout);
    controlPanelComposite.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
    freezeButton = new Button(controlPanelComposite, SWT.CHECK);
    freezeButton.setText("Freeze");
    freezeButton.setToolTipText("freeze 3d relief, disable rotation");
    freezeButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            if (freezeButton.getSelection())
                freeze = true;
            else
                freeze = false;
        }
    });
    resetButton = new Button(controlPanelComposite, SWT.NULL);
    resetButton.setText("Reset");
    resetButton.setToolTipText("reset 3d projection to be flat and fill the canvas");
    resetButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            grip.init();
        }
    });
    autoscaleButton = new Button(controlPanelComposite, SWT.CHECK);
    autoscaleButton.setText("Autoscale");
    autoscaleButton.setToolTipText("autoscale 3d relief between minimum and mean");
    autoscaleButton.setSelection(true);
    autoscaleButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            if (autoscaleButton.getSelection()) {
                if (!autoscale) {
                    autoscale = true;
                    scaleImage();
                    drawReliefList();
                }
                minimumSpinner.setEnabled(false);
                maximumSpinner.setEnabled(false);
            } else {
                if (autoscale) {
                    autoscale = false;
                    scaleImage();
                    drawReliefList();
                }
                minimumSpinner.setEnabled(true);
                maximumSpinner.setEnabled(true);
            }
        }
    });
    Label minLabel = new Label(controlPanelComposite, SWT.NULL);
    minLabel.setText("Minimum");
    minimumSpinner = new Spinner(controlPanelComposite, SWT.NULL);
    minimumSpinner.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
    minimumSpinner.setMinimum(0);
    minimumSpinner.setMaximum(Integer.MAX_VALUE);
    minimumSpinner.setEnabled(false);
    Label maxLabel = new Label(controlPanelComposite, SWT.NULL);
    maxLabel.setText("Maximum");
    maximumSpinner = new Spinner(controlPanelComposite, SWT.NULL);
    maximumSpinner.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
    maximumSpinner.setMinimum(0);
    maximumSpinner.setMaximum(Integer.MAX_VALUE);
    maximumSpinner.setEnabled(false);
    updateButton = new Button(controlPanelComposite, SWT.NULL);
    updateButton.setText("Update");
    updateButton.setToolTipText("redraw 3d relief plot");
    updateButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            scaleImage();
            drawReliefList();
            drawRelief();
        }
    });
    Composite comp = new Composite(parent, SWT.NONE);
    comp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    comp.setLayout(new FillLayout());
    GLData data = new GLData();
    data.doubleBuffer = true;
    canvas = new GLCanvas(comp, SWT.NONE, data);
    canvas.setSize(comp.getSize());
    canvas.setCurrent();
    // context =
    // GL11.GLDrawableFactory.getFactory().createExternalGLContext();
    canvas.addListener(SWT.Resize, new Listener() {
        public void handleEvent(Event event) {
            Rectangle bounds = canvas.getBounds();
            canvas.setCurrent();
            try {
                GLContext.useContext(canvas);
            } catch (LWJGLException e) {
                e.printStackTrace();
            }
            GL11.glViewport(0, 0, bounds.width, bounds.height);
            GL11.glMatrixMode(GL11.GL_PROJECTION);
            GL11.glLoadIdentity();
            // GLU glu = new GLU();
            // aspect = (float) imageWidth / (float) imageHeight;
            // gl.glMatrixMode(GL.GL_MODELVIEW);
            // gl.glLoadIdentity();
            drawRelief();
            canvas.swapBuffers();
        }
    });
    try {
        GLContext.useContext(canvas);
    } catch (LWJGLException e) {
        e.printStackTrace();
    }

    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    GL11.glColor3f(1.0f, 0.0f, 0.0f);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();

    // gl.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);
    // gl.glClearDepth(1.0);
    // gl.glLineWidth(2);
    // / gl.glEnable(GL.GL_DEPTH_TEST);
    GL11.glOrtho(0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f);

    // create the grip for users to change the orientation, translation and
    // zoom
    grip = new SceneGrip();
    canvas.addMouseListener(grip);
    canvas.addMouseMoveListener(grip);
    canvas.addListener(SWT.MouseWheel, grip);
    canvas.addKeyListener(grip);
    // apparently opengl has to be redrawn constantly (why ?)
    Display.getCurrent().asyncExec(new Runnable() {

        public void run() {
            if (!canvas.isDisposed()) {
                canvas.setCurrent();
                // Rectangle bounds = canvas.getBounds();
                /*
                 * canvasWidth = bounds.width; canvasHeight = bounds.height;
                 */
                // context.makeCurrent();
                // GL gl = context.getGL ();
                // gl.glClear(GL.GL_COLOR_BUFFER_BIT |
                // GL.GL_DEPTH_BUFFER_BIT);
                // gl.glClearColor(.0f, .0f, .0f, 1.0f); // black
                // background*/
                drawRelief();
                canvas.swapBuffers();

            }
        }
    });
}

From source file:fable.imageviewer.views.ReliefView.java

License:Open Source License

@Override
public void createPartControl(Composite parent) {

    thisView = this;
    parent.setLayout(new GridLayout(1, false));
    GridUtils.removeMargins(parent);//from w w  w . j  a  v a 2s . c o m

    createActions();

    Composite comp = new Composite(parent, SWT.NONE);
    comp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    comp.setLayout(new FillLayout());
    GLData data = new GLData();
    data.doubleBuffer = true;
    canvas = new GLCanvas(comp, SWT.NONE, data);
    canvas.setSize(comp.getSize());
    canvas.setCurrent();
    try {
        GLContext.useContext(canvas);
    } catch (LWJGLException ex) {
        FableUtils.excMsg(ReliefView.class, "Error in createPartControl using GLContext.useContext", ex);
    }
    // context = GLDrawableFactory.getFactory().createExternalGLContext();
    canvas.addListener(SWT.Resize, new Listener() {
        public void handleEvent(Event event) {
            Rectangle bounds = canvas.getBounds();
            // float fAspect = (float) bounds.width / (float) bounds.height;
            canvas.setCurrent();
            try {
                GLContext.useContext(canvas);
            } catch (LWJGLException ex) {
                FableUtils.excMsg(ReliefView.class, "Error in resize listener using GLContext.useContext", ex);
            }
            // context.makeCurrent();
            // GL11 gl = context.getGL ();
            GL11.glViewport(0, 0, bounds.width, bounds.height);
            GL11.glMatrixMode(GL11.GL_PROJECTION);
            GL11.glLoadIdentity();
            // GLU glu = new GLU();
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glLoadIdentity();
            drawRelief();
            canvas.swapBuffers();
            // context.release();
        }
    });
    canvas.setCurrent();
    try {
        GLContext.useContext(canvas);
    } catch (LWJGLException ex) {
        FableUtils.excMsg(ReliefView.class, "Error in createPartControl using GLContext.useContext", ex);
    }
    // GL11 gl = context.getGL ();
    GL11.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
    GL11.glColor3f(1.0f, 0.0f, 0.0f);
    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
    GL11.glClearDepth(1.0);
    GL11.glLineWidth(2);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    // context.release();
    // create the grip for users to change the orientation, translation and
    // zoom
    grip = new SceneGrip(canvas, this);
    canvas.addMouseListener(grip);
    canvas.addMouseMoveListener(grip);
    canvas.addListener(SWT.MouseWheel, grip);
    canvas.addKeyListener(grip);
    // apparently opengl has to be redrawn constantly (why ?)
    Display.getCurrent().asyncExec(new Runnable() {
        // int rot = 0;
        public void run() {
            if (canvas == null)
                return;
            if (!canvas.isDisposed()) {
                canvas.setCurrent();
                Rectangle bounds = canvas.getBounds();
                grip.setBounds(bounds);
                canvas.setCurrent();
                try {
                    GLContext.useContext(canvas);
                } catch (LWJGLException ex) {
                    FableUtils.excMsg(ReliefView.class,
                            "Error in createPartControl using " + "GLContext.useContext", ex);
                }
                // GL11 gl = context.getGL ();
                GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
                GL11.glClearColor(.0f, .0f, .0f, 1.0f); // black background
                drawRelief();
                canvas.swapBuffers();
                // context.release();
                Display.getCurrent().timerExec(200, this);
            }
        }
    });

    createImageInformationPanel(parent);
}

From source file:fr.def.iss.vd2.lib_v3d.V3DCanvas.java

License:Open Source License

/**
 * Sets up the screen./*from  w w  w . j av  a2 s .com*/
 *
 * @see javax.media.openGL11.GLEventListener#init(javax.media.openGL11.GLAutoDrawable)
 */
public void init() {
    try {

        frame = new JFrame("Space agencies");
        //frame.setSize(width,height);
        //frame.setUndecorated(true);  //here
        frame.setVisible(true);
        //frame.setAlwaysOnTop(true);
        frame.setLocation(0, 0);
        Canvas canvas = new Canvas();
        canvas.setMinimumSize(new Dimension(800, 600));
        canvas.setPreferredSize(new Dimension(width, height));
        frame.add(canvas);
        frame.pack();
        frame.addWindowListener(generateWindowListener());

        frame.getContentPane().addHierarchyBoundsListener(new HierarchyBoundsListener() {

            @Override
            public void ancestorMoved(HierarchyEvent e) {
            }

            @Override
            public void ancestorResized(HierarchyEvent e) {
                width = frame.getContentPane().getWidth();
                height = frame.getContentPane().getHeight();
                reshape(0, 0, width, height);
            }
        });

        Display.setDisplayMode(new DisplayMode(width, height));
        //Display.setFullscreen(true);
        Display.setVSyncEnabled(false);
        Display.setTitle("Space agencies");
        Display.setParent(canvas);
        Display.create();
        canvas.requestFocus();
    } catch (Exception e) {
        System.out.println("Error setting up display" + e);
        System.exit(0);
    }

    // Enable z- (depth) buffer for hidden surface removal.
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthFunc(GL11.GL_LEQUAL);

    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glEnable(GL11.GL_POINT_SMOOTH);

    if (polygonOffset) {
        GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL);
        GL11.glPolygonOffset(1.0f, 1.0f);
    }
    GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
    GL11.glHint(GL11.GL_POLYGON_SMOOTH_HINT, GL11.GL_NICEST);

    GL11.glClearDepth(1.0); // Enables Clearing Of The Depth Buffer
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_BLEND);

    // Enable smooth shading.
    GL11.glShadeModel(GL11.GL_SMOOTH);

    // Define "clear" color.
    GL11.glClearColor(0f, 0f, 0.4f, 0f);

    // We want a nice perspective.
    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    GL11.glFlush();

    TextureManager.clearCache();
    initied = true;

    //        new LWJGLBinding();

}

From source file:fr.def.iss.vd2.lib_v3d.V3DCanvas.java

License:Open Source License

/**
 * The only method that you should implement by yourself.
 *
 * @see javax.media.openGL11.GLEventListener#display(javax.media.openGL11.GLAutoDrawable)
 *///from  w ww  .  ja v a  2  s. c  o  m
public void display() {

    GL11.glClear(GL11.GL_ACCUM_BUFFER_BIT);

    for (V3DCameraBinding binding : cameraList) {

        GL11.glViewport(binding.x, binding.y, binding.width, binding.height);

        //Clean Background
        I3dColor color = binding.camera.getBackgroundColor();
        GL11.glClearColor(color.r, color.g, color.b, color.a);

        GL11.glScissor(binding.x, binding.y, binding.width, binding.height);
        GL11.glEnable(GL11.GL_SCISSOR_TEST);
        if (color.a == 1.0f) {
            GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
        } else {
            GL11.glMatrixMode(GL11.GL_PROJECTION);
            GL11.glLoadIdentity();
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glLoadIdentity();
            GL11.glOrtho(0, binding.width, 0, binding.height, -2000.0, 2000.0);

            GL11.glDisable(GL11.GL_DEPTH_TEST);
            GL11.glColor4f(color.r, color.g, color.b, color.a);
            GL11.glBegin(GL11.GL_QUADS);
            GL11.glVertex3f(0, 0, 0);
            GL11.glVertex3f(binding.width, 0, 0);
            GL11.glVertex3f(binding.width, binding.height, 0);
            GL11.glVertex3f(0, binding.height, 0);
            GL11.glEnd();
            GL11.glEnable(GL11.GL_DEPTH_TEST);
            GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
        }
        GL11.glDisable(GL11.GL_SCISSOR_TEST);

        binding.camera.display(binding.width, binding.height);

        GL11.glDisable(GL11.GL_DEPTH_TEST);
        //            binding.getGui().display();
        GL11.glEnable(GL11.GL_DEPTH_TEST);

        if (select && binding == focusCamera) {
            GL11.glMatrixMode(GL11.GL_PROJECTION);
            GL11.glLoadIdentity();
            //glu.gluPerspective(45.0f, h, 0.1, 2000.0);
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glLoadIdentity();
            binding.camera.select(mouseX, mouseY);
            context.setMouseOverCameraBinding(binding);
        }
    }
    GL11.glFlush();
    select = false;
}