javax.media.opengl.GL2 Java Examples

The following examples show how to use javax.media.opengl.GL2. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JoglDebugDraw.java    From jbox2d with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public void drawCircle(Vec2 center, float radius, Color3f color) {
  GL2 gl = panel.getGL().getGL2();
  gl.glPushMatrix();
  transformViewport(gl, zero);
  float theta = 2 * MathUtils.PI / NUM_CIRCLE_POINTS;
  float c = MathUtils.cos(theta);
  float s = MathUtils.sin(theta);
  float x = radius;
  float y = 0;
  float cx = center.x;
  float cy = center.y;
  gl.glBegin(GL2.GL_LINE_LOOP);
  gl.glColor4f(color.x, color.y, color.z, 1);
  for (int i = 0; i < NUM_CIRCLE_POINTS; i++) {
    gl.glVertex3f(x + cx, y + cy, 0);
    // apply the rotation matrix
    float temp = x;
    x = c * x - s * y;
    y = s * temp + c * y;
  }
  gl.glEnd();
  gl.glPopMatrix();
}
 
Example #2
Source File: JoglRenderer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void updateDisplayList(Mesh mesh) {
    GL gl = GLContext.getCurrentGL();
    if (mesh.getId() != -1) {
        // delete list first
        gl.getGL2().glDeleteLists(mesh.getId(), mesh.getId());
        mesh.setId(-1);
    }

    // create new display list
    // first set state to NULL
    applyRenderState(RenderState.NULL);

    // disable lighting
    setLighting(null);

    int id = gl.getGL2().glGenLists(1);
    mesh.setId(id);
    gl.getGL2().glNewList(id, GL2.GL_COMPILE);
    renderMeshDefault(mesh, 0, 1);
    gl.getGL2().glEndList();
}
 
Example #3
Source File: JoglRenderer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private int convertWrapMode(Texture.WrapMode mode) {
    switch (mode) {
        case BorderClamp:
            return GL2GL3.GL_CLAMP_TO_BORDER;
        case Clamp:
            return GL2.GL_CLAMP;
        case EdgeClamp:
            return GL.GL_CLAMP_TO_EDGE;
        case Repeat:
            return GL.GL_REPEAT;
        case MirroredRepeat:
            return GL.GL_MIRRORED_REPEAT;
        default:
            throw new UnsupportedOperationException("Unknown wrap mode: " + mode);
    }
}
 
Example #4
Source File: JoglPanel.java    From jbox2d with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public void reshape(GLAutoDrawable arg0, int arg1, int arg2, int arg3, int arg4) {
  GL2 gl2 = arg0.getGL().getGL2();

  gl2.glMatrixMode(GL2.GL_PROJECTION);
  gl2.glLoadIdentity();

  // coordinate system origin at lower left with width and height same as the window
  GLU glu = new GLU();
  glu.gluOrtho2D(0.0f, getWidth(), 0.0f, getHeight());

  gl2.glMatrixMode(GL2.GL_MODELVIEW);
  gl2.glLoadIdentity();

  gl2.glViewport(0, 0, getWidth(), getHeight());

  controller.updateExtents(arg3 / 2, arg4 / 2);
}
 
Example #5
Source File: JoglDebugDraw.java    From jbox2d with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public void drawTransform(Transform xf) {
  GL2 gl = panel.getGL().getGL2();
  getWorldToScreenToOut(xf.p, temp);
  temp2.setZero();
  float k_axisScale = 0.4f;

  gl.glBegin(GL2.GL_LINES);
  gl.glColor3f(1, 0, 0);

  temp2.x = xf.p.x + k_axisScale * xf.q.c;
  temp2.y = xf.p.y + k_axisScale * xf.q.s;
  getWorldToScreenToOut(temp2, temp2);
  gl.glVertex2f(temp.x, temp.y);
  gl.glVertex2f(temp2.x, temp2.y);

  gl.glColor3f(0, 1, 0);
  temp2.x = xf.p.x + -k_axisScale * xf.q.s;
  temp2.y = xf.p.y + k_axisScale * xf.q.c;
  getWorldToScreenToOut(temp2, temp2);
  gl.glVertex2f(temp.x, temp.y);
  gl.glVertex2f(temp2.x, temp2.y);
  gl.glEnd();
}
 
Example #6
Source File: JoglDebugDraw.java    From jbox2d with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void transformViewport(GL2 gl, Vec2 center) {
  Vec2 e = viewportTransform.getExtents();
  Vec2 vc = viewportTransform.getCenter();
  Mat22 vt = viewportTransform.getMat22Representation();

  int f = viewportTransform.isYFlip() ? -1 : 1;
  mat[0] = vt.ex.x;
  mat[4] = vt.ey.x;
  // mat[8] = 0;
  mat[12] = e.x;
  mat[1] = f * vt.ex.y;
  mat[5] = f * vt.ey.y;
  // mat[9] = 0;
  mat[13] = e.y;
  // mat[2] = 0;
  // mat[6] = 0;
  // mat[10] = 1;
  // mat[14] = 0;
  // mat[3] = 0;
  // mat[7] = 0;
  // mat[11] = 0;
  // mat[15] = 1;

  gl.glMultMatrixf(mat, 0);
  gl.glTranslatef(center.x - vc.x, center.y - vc.y, 0);
}
 
Example #7
Source File: Rhombus.java    From MeteoInfo with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void main(String[] args) {

        //getting the capabilities object of GL2 profile
        final GLProfile profile = GLProfile.get(GLProfile.GL2);
        GLCapabilities capabilities = new GLCapabilities(profile);

        // The canvas
        final GLCanvas glcanvas = new GLCanvas(capabilities);
        Rhombus b = new Rhombus();
        glcanvas.addGLEventListener(b);
        glcanvas.setSize(400, 400);

        //creating frame
        final JFrame frame = new JFrame(" Rhombus 3d");

        //adding canvas to it
        frame.getContentPane().add(glcanvas);
        frame.setSize(frame.getContentPane().getPreferredSize());
        frame.setVisible(true);
    }
 
Example #8
Source File: Rhombus.java    From MeteoInfo with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {

    // TODO Auto-generated method stub final
    GL2 gl = drawable.getGL().getGL2();
    if (height  <= 0)
        height = 1;

    final float h = (float) width / (float) height;
    gl.glViewport(3, 6, width, height);
    gl.glMatrixMode(GL2.GL_PROJECTION);
    gl.glLoadIdentity();

    glu.gluPerspective(45.0f, h, 1.0, 20.0);
    gl.glMatrixMode(GL2.GL_MODELVIEW);
    gl.glLoadIdentity();
}
 
Example #9
Source File: CefRenderer.java    From pandomium with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("static-access")
protected void render(GL2 gl2) {
    if (use_draw_pixels_ || view_width_ == 0 || view_height_ == 0) {
        return;
    }

    assert (initialized_context_ != null);

    final float[] vertex_data = {
            //tu,   tv,     x,     y,    z
            0.0f, 1.0f, -1.0f, -1.0f, 0.0f, 1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f };
    FloatBuffer vertices = FloatBuffer.wrap(vertex_data);

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

    gl2.glMatrixMode(gl2.GL_MODELVIEW);
    gl2.glLoadIdentity();

    // Match GL units to screen coordinates.
    gl2.glViewport(0, 0, view_width_, view_height_);
    gl2.glMatrixMode(gl2.GL_PROJECTION);
    gl2.glLoadIdentity();

    // Draw the background gradient.
    gl2.glPushAttrib(gl2.GL_ALL_ATTRIB_BITS);
    gl2.glBegin(gl2.GL_QUADS);
    gl2.glColor4f(1.0f, 0.0f, 0.0f, 1.0f);  // red
    gl2.glVertex2f(-1.0f, -1.0f);
    gl2.glVertex2f(1.0f, -1.0f);
    gl2.glColor4f(0.0f, 0.0f, 1.0f, 1.0f);  // blue
    gl2.glVertex2f(1.0f, 1.0f);
    gl2.glVertex2f(-1.0f, 1.0f);
    gl2.glEnd();
    gl2.glPopAttrib();

    // Rotate the view based on the mouse spin.
    if (spin_x_ != 0) {
        gl2.glRotatef(-spin_x_, 1.0f, 0.0f, 0.0f);
    }
    if (spin_y_ != 0) {
        gl2.glRotatef(-spin_y_, 0.0f, 1.0f, 0.0f);
    }

    if (transparent_) {
        // Alpha blending style. Texture values have premultiplied alpha.
        gl2.glBlendFunc(gl2.GL_ONE, gl2.GL_ONE_MINUS_SRC_ALPHA);

        // Enable alpha blending.
        gl2.glEnable(gl2.GL_BLEND);
    }

    // Enable 2D textures.
    gl2.glEnable(gl2.GL_TEXTURE_2D);

    // Draw the facets with the texture.
    assert (texture_id_[0] != 0);
    gl2.glBindTexture(gl2.GL_TEXTURE_2D, texture_id_[0]);
    gl2.glInterleavedArrays(gl2.GL_T2F_V3F, 0, vertices);
    gl2.glDrawArrays(gl2.GL_QUADS, 0, 4);

    // Disable 2D textures.
    gl2.glDisable(gl2.GL_TEXTURE_2D);

    if (transparent_) {
        // Disable alpha blending.
        gl2.glDisable(gl2.GL_BLEND);
    }
}
 
Example #10
Source File: JoglDebugDraw.java    From jbox2d with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void drawPoint(Vec2 argPoint, float argRadiusOnScreen, Color3f argColor) {
  Vec2 vec = getWorldToScreen(argPoint);
  GL2 gl = panel.getGL().getGL2();
  gl.glPointSize(argRadiusOnScreen);
  gl.glBegin(GL2.GL_POINTS);
  gl.glVertex2f(vec.x, vec.y);
  gl.glEnd();
}
 
Example #11
Source File: JoglDebugDraw.java    From jbox2d with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void drawPolygon(Vec2[] vertices, int vertexCount, Color3f color) {
  GL2 gl = panel.getGL().getGL2();
  gl.glPushMatrix();
  transformViewport(gl, zero);
  gl.glBegin(GL2.GL_LINE_LOOP);
  gl.glColor4f(color.x, color.y, color.z, 1f);
  for (int i = 0; i < vertexCount; i++) {
    Vec2 v = vertices[i];
    gl.glVertex2f(v.x, v.y);
  }
  gl.glEnd();
  gl.glPopMatrix();
}
 
Example #12
Source File: JoglDebugDraw.java    From jbox2d with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void drawCircle(Vec2 center, float radius, Vec2 axis, Color3f color) {
  GL2 gl = panel.getGL().getGL2();
  gl.glPushMatrix();
  transformViewport(gl, zero);
  float theta = 2 * MathUtils.PI / NUM_CIRCLE_POINTS;
  float c = MathUtils.cos(theta);
  float s = MathUtils.sin(theta);
  float x = radius;
  float y = 0;
  float cx = center.x;
  float cy = center.y;
  gl.glBegin(GL2.GL_LINE_LOOP);
  gl.glColor4f(color.x, color.y, color.z, 1);
  for (int i = 0; i < NUM_CIRCLE_POINTS; i++) {
    gl.glVertex3f(x + cx, y + cy, 0);
    // apply the rotation matrix
    float temp = x;
    x = c * x - s * y;
    y = s * temp + c * y;
  }
  gl.glEnd();
  gl.glBegin(GL2.GL_LINES);
  gl.glVertex3f(cx, cy, 0);
  gl.glVertex3f(cx + axis.x * radius, cy + axis.y * radius, 0);
  gl.glEnd();
  gl.glPopMatrix();
}
 
Example #13
Source File: JoglDebugDraw.java    From jbox2d with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void drawSegment(Vec2 p1, Vec2 p2, Color3f color) {
  GL2 gl = panel.getGL().getGL2();
  gl.glPushMatrix();
  transformViewport(gl, zero);
  gl.glBegin(GL2.GL_LINES);
  gl.glColor3f(color.x, color.y, color.z);
  gl.glVertex3f(p1.x, p1.y, 0);
  gl.glVertex3f(p2.x, p2.y, 0);
  gl.glEnd();
  gl.glPopMatrix();
}
 
Example #14
Source File: JoglDebugDraw.java    From jbox2d with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void drawParticles(Vec2[] centers, float radius, ParticleColor[] colors, int count) {
  GL2 gl = panel.getGL().getGL2();
  gl.glPushMatrix();
  transformViewport(gl, zero);

  float theta = 2 * MathUtils.PI / NUM_CIRCLE_POINTS;
  float c = MathUtils.cos(theta);
  float s = MathUtils.sin(theta);

  float x = radius;
  float y = 0;

  for (int i = 0; i < count; i++) {
    Vec2 center = centers[i];
    float cx = center.x;
    float cy = center.y;
    gl.glBegin(GL2.GL_TRIANGLE_FAN);
    if (colors == null) {
      gl.glColor4f(1, 1, 1, .4f);
    } else {
      ParticleColor color = colors[i];
      gl.glColor4b(color.r, color.g, color.b, color.a);
    }
    for (int j = 0; j < NUM_CIRCLE_POINTS; j++) {
      gl.glVertex3f(x + cx, y + cy, 0);
      float temp = x;
      x = c * x - s * y;
      y = s * temp + c * y;
    }
    gl.glEnd();
  }
  gl.glPopMatrix();
}
 
Example #15
Source File: JoglDebugDraw.java    From jbox2d with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void drawParticlesWireframe(Vec2[] centers, float radius, ParticleColor[] colors, int count) {
  GL2 gl = panel.getGL().getGL2();
  gl.glPushMatrix();
  transformViewport(gl, zero);

  float theta = 2 * MathUtils.PI / NUM_CIRCLE_POINTS;
  float c = MathUtils.cos(theta);
  float s = MathUtils.sin(theta);

  float x = radius;
  float y = 0;

  for (int i = 0; i < count; i++) {
    Vec2 center = centers[i];
    float cx = center.x;
    float cy = center.y;
    gl.glBegin(GL2.GL_LINE_LOOP);
    if (colors == null) {
      gl.glColor4f(1, 1, 1, 1);
    } else {
      ParticleColor color = colors[i];
      gl.glColor4b(color.r, color.g, color.b, (byte) 127);
    }
    for (int j = 0; j < NUM_CIRCLE_POINTS; j++) {
      gl.glVertex3f(x + cx, y + cy, 0);
      float temp = x;
      x = c * x - s * y;
      y = s * temp + c * y;
    }
    gl.glEnd();
  }
  gl.glPopMatrix();
}
 
Example #16
Source File: CefRenderer.java    From pandomium with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("static-access")
protected void initialize(GL2 gl2) {
    if (initialized_context_ == gl2) {
        return;
    }

    initialized_context_ = gl2;

    if (!gl2.getContext().isHardwareRasterizer()) {
        // Workaround for Windows Remote Desktop which requires pot textures.
        CefApp.getLogger().info("opengl rendering may be slow as hardware rendering isn't available");
        use_draw_pixels_ = true;
        return;
    }

    gl2.glHint(gl2.GL_POLYGON_SMOOTH_HINT, gl2.GL_NICEST);

    gl2.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);

    // Necessary for non-power-of-2 textures to render correctly.
    gl2.glPixelStorei(gl2.GL_UNPACK_ALIGNMENT, 1);

    // Create the texture.
    gl2.glGenTextures(1, texture_id_, 0);
    assert (texture_id_[0] != 0);

    gl2.glBindTexture(gl2.GL_TEXTURE_2D, texture_id_[0]);
    gl2.glTexParameteri(gl2.GL_TEXTURE_2D, gl2.GL_TEXTURE_MIN_FILTER, gl2.GL_NEAREST);
    gl2.glTexParameteri(gl2.GL_TEXTURE_2D, gl2.GL_TEXTURE_MAG_FILTER, gl2.GL_NEAREST);
    gl2.glTexEnvf(gl2.GL_TEXTURE_ENV, gl2.GL_TEXTURE_ENV_MODE, gl2.GL_MODULATE);
}
 
Example #17
Source File: CefRenderer.java    From pandomium with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("static-access")
protected void onPaint(GL2 gl2, boolean popup, Rectangle[] dirtyRects, ByteBuffer buffer, int width, int height) {
    initialize(gl2);

    if (use_draw_pixels_) {
        gl2.glRasterPos2f(-1, 1);
        gl2.glPixelZoom(1, -1);
        gl2.glDrawPixels(width, height, GL2.GL_BGRA, GL2.GL_UNSIGNED_BYTE, buffer);
        return;
    }

    if (transparent_) {
        // Enable alpha blending.
        gl2.glEnable(gl2.GL_BLEND);
    }

    // Enable 2D textures.
    gl2.glEnable(gl2.GL_TEXTURE_2D);

    assert (texture_id_[0] != 0);
    gl2.glBindTexture(gl2.GL_TEXTURE_2D, texture_id_[0]);

    if (!popup) {
        int old_width = view_width_;
        int old_height = view_height_;

        view_width_ = width;
        view_height_ = height;

        gl2.glPixelStorei(gl2.GL_UNPACK_ROW_LENGTH, view_width_);

        if (old_width != view_width_ || old_height != view_height_) {
            // Update/resize the whole texture.
            gl2.glPixelStorei(gl2.GL_UNPACK_SKIP_PIXELS, 0);
            gl2.glPixelStorei(gl2.GL_UNPACK_SKIP_ROWS, 0);
            gl2.glTexImage2D(gl2.GL_TEXTURE_2D, 0, gl2.GL_RGBA, view_width_, view_height_, 0, gl2.GL_BGRA, gl2.GL_UNSIGNED_INT_8_8_8_8_REV, buffer);
        }
        else {
            // Update just the dirty rectangles.
            for (int i = 0; i < dirtyRects.length; ++i) {
                Rectangle rect = dirtyRects[i];
                gl2.glPixelStorei(gl2.GL_UNPACK_SKIP_PIXELS, rect.x);
                gl2.glPixelStorei(gl2.GL_UNPACK_SKIP_ROWS, rect.y);
                gl2.glTexSubImage2D(gl2.GL_TEXTURE_2D, 0, rect.x, rect.y, rect.width, rect.height, gl2.GL_BGRA, gl2.GL_UNSIGNED_INT_8_8_8_8_REV, buffer);
            }
        }
    }
    else if (popup && popup_rect_.width > 0 && popup_rect_.height > 0) {
        int skip_pixels = 0, x = popup_rect_.x;
        int skip_rows = 0, y = popup_rect_.y;
        int w = width;
        int h = height;

        // Adjust the popup to fit inside the view.
        if (x < 0) {
            skip_pixels = -x;
            x = 0;
        }
        if (y < 0) {
            skip_rows = -y;
            y = 0;
        }
        if (x + w > view_width_) {
            w -= x + w - view_width_;
        }
        if (y + h > view_height_) {
            h -= y + h - view_height_;
        }

        // Update the popup rectangle.
        gl2.glPixelStorei(gl2.GL_UNPACK_ROW_LENGTH, width);
        gl2.glPixelStorei(gl2.GL_UNPACK_SKIP_PIXELS, skip_pixels);
        gl2.glPixelStorei(gl2.GL_UNPACK_SKIP_ROWS, skip_rows);
        gl2.glTexSubImage2D(gl2.GL_TEXTURE_2D, 0, x, y, w, h, gl2.GL_BGRA, gl2.GL_UNSIGNED_INT_8_8_8_8_REV, buffer);
    }

    // Disable 2D textures.
    gl2.glDisable(gl2.GL_TEXTURE_2D);

    if (transparent_) {
        // Disable alpha blending.
        gl2.glDisable(gl2.GL_BLEND);
    }
}
 
Example #18
Source File: Rhombus.java    From MeteoInfo with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void display(GLAutoDrawable drawable) {

    final GL2 gl = drawable.getGL().getGL2();
    gl.glTranslatef(0f, 0f, -2.5f);

    //drawing edge1.....
    gl.glBegin(GL2.GL_LINES);
    gl.glVertex3f(-0.75f, 0f, 0);
    gl.glVertex3f(0f, -0.75f, 0);
    gl.glEnd();

    gl.glBegin(GL2.GL_LINES);
    gl.glVertex3f(-0.75f, 0f, 3f); // 3 units into the window
    gl.glVertex3f(0f, -0.75f, 3f);
    gl.glEnd();

    //top
    gl.glBegin(GL2.GL_LINES);
    gl.glVertex3f(-0.75f, 0f, 0);
    gl.glVertex3f(-0.75f, 0f, 3f);
    gl.glEnd();

    // bottom
    gl.glBegin(GL2.GL_LINES);
    gl.glVertex3f(0f, -0.75f, 0);
    gl.glVertex3f(0f, -0.75f, 3f);
    gl.glEnd();

    // edge 2....
    gl.glBegin(GL2.GL_LINES);
    gl.glVertex3f(0f, -0.75f, 0);
    gl.glVertex3f(0.75f, 0f, 0);
    gl.glEnd();

    gl.glBegin(GL2.GL_LINES);
    gl.glVertex3f(0f, -0.75f, 3f);
    gl.glVertex3f(0.75f, 0f, 3f);
    gl.glEnd();

    gl.glBegin(GL2.GL_LINES);
    gl.glVertex3f(0f, -0.75f, 0);
    gl.glVertex3f(0f, -0.75f, 3f);
    gl.glEnd();

    gl.glBegin(GL2.GL_LINES);
    gl.glVertex3f(0.75f, 0f, 0);
    gl.glVertex3f(0.75f, 0f, 3f);
    gl.glEnd();

    //Edge 3.............
    gl.glBegin(GL2.GL_LINES);
    gl.glVertex3f(0.0f, 0.75f, 0);
    gl.glVertex3f(-0.75f, 0f, 0);
    gl.glEnd();

    gl.glBegin(GL2.GL_LINES);
    gl.glVertex3f(0.0f, 0.75f, 3f);
    gl.glVertex3f(-0.75f, 0f, 3f);
    gl.glEnd();

    gl.glBegin(GL2.GL_LINES);
    gl.glVertex3f(0.0f, 0.75f, 0);
    gl.glVertex3f(0.0f, 0.75f, 3f);
    gl.glEnd();

    gl.glBegin(GL2.GL_LINES);
    gl.glVertex3f(-0.75f, 0f, 0);
    gl.glVertex3f(-0.75f, 0f, 3f);
    gl.glEnd();

    //final edge
    gl.glBegin(GL2.GL_LINES);
    gl.glVertex3f(0.75f, 0f, 0);
    gl.glVertex3f(0.0f, 0.75f, 0);
    gl.glEnd();

    gl.glBegin(GL2.GL_LINES);
    gl.glVertex3f(0.75f, 0f, 3f);
    gl.glVertex3f(0.0f, 0.75f, 3f);
    gl.glEnd();

    gl.glBegin(GL2.GL_LINES);
    gl.glVertex3f(0.75f, 0f, 0);
    gl.glVertex3f(0.75f, 0f, 3f);
    gl.glEnd();

    gl.glBegin(GL2.GL_LINES);
    gl.glVertex3f(0.0f, 0.75f, 0);
    gl.glVertex3f(0.0f, 0.75f, 3f);
    gl.glEnd();
}
 
Example #19
Source File: CefRenderer.java    From pandomium with Apache License 2.0 4 votes vote down vote up
protected void cleanup(GL2 gl2) {
    if (texture_id_[0] != 0) {
        gl2.glDeleteTextures(1, texture_id_, 0);
    }
}
 
Example #20
Source File: JoglPanel.java    From jbox2d with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public void display(GLAutoDrawable arg0) {
  getGL().getGL2().glClear(GL2.GL_COLOR_BUFFER_BIT);
  controller.updateTest();
  getGL().glFlush();
}
 
Example #21
Source File: JoglPanel.java    From jbox2d with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public void init(GLAutoDrawable arg0) {
  getGL().getGL2().glLineWidth(1f);
  getGL().getGL2().glEnable(GL2.GL_BLEND);
  getGL().getGL2().glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA);
}