Results 1 to 3 of 3
  1. #1
    neptune296 is offline Member
    Join Date
    Mar 2012
    Posts
    5
    Rep Power
    0

    Question Java Hardware Acceleration / Direct3D Doesn't work with Intel Integrated Graphics?

    Hi everyone I have a strange problem that I hope someone can help me with. I can't seem to get page flipping / hardware acceleration to work on my notebook with Java using a JFrame and a BufferStrategy for animation. It appears that every computer that I've tried my app on with Intel Integrated Graphics doesn't support hardware acceleration or page flipping with Java and doesn't use Direct3D. I was wondering if anyone can confirm this with the short app I created to demo the problem? And does anyone get hardware acceleration with this configuration, is there some way to fix it since it makes animation really slow?

    Thank you!

    The Problem:
    Hardware Acceleration using Java 7 update 11 doesn't appear to be working with Intel Integrated Graphics on a Windows 7 and 8 machine using a BufferStrategy with a JFrame.

    Details:
    Graphics Card: Intel(R) HD Graphics 4000
    JRE: Java 7 Update 11
    OS: Windows 7, Windows 8
    When trying to explicitly enable the direct3d pipeline using -Dsun.java2d.d3d=True the following error occurs: Could not enable direct3d pipeline on screen 0

    Expected Results:
    Java Hardware Acceleration / Direct3D Doesn't work with Intel Integrated Graphics?-hw1.png

    Actual Results:
    Java Hardware Acceleration / Direct3D Doesn't work with Intel Integrated Graphics?-hw2.png

    Resources:
    If you want to verify the problem you can download the app I created for testing at: http://ndcubed.com/downloads/GraphicsTest.zip

    If you don't feel comfortable downloading a compiled JAR file you can compile the app yourself using the following source code however the compiled jar has a few more features I added but left out in the source below for simplicity, it simply outputs the BufferStrategy's capabilities:
    Java Code:
    package graphicstest;
    
    import javax.swing.*;
    import java.awt.*;
    import java.awt.image.BufferStrategy;
    
    public class GraphicsTest extends JFrame {
    
        public static void main(String[] args) {
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    new GraphicsTest();
                }
            });
        }
    
        GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
        BufferCapabilities bufferCapabilities;
        BufferStrategy bufferStrategy;
    
        int y = 0;
        int delta = 1;
    
        public GraphicsTest() {
    
            setTitle("Hardware Acceleration Test");
            setSize(500, 300);
            setLocationRelativeTo(null);
            setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    
            setVisible(true);
    
            createBufferStrategy(2);
            bufferStrategy = getBufferStrategy();
    
            bufferCapabilities = gc.getBufferCapabilities();
    
            new AnimationThread().start();
        }
    
        class AnimationThread extends Thread {
            @Override
            public void run() {
    
                while(true) {
                    Graphics2D g2 = null;
                    try {
                        g2 = (Graphics2D) bufferStrategy.getDrawGraphics();
                        draw(g2);
                    } finally {
                        if(g2 != null) g2.dispose();
                    }
                    bufferStrategy.show();
    
                    try {
                        Thread.sleep(16);
                    } catch(Exception err) {
                        err.printStackTrace();
                    }
                }
            }
        }
    
        public void draw(Graphics2D g2) {
            if(!bufferCapabilities.isPageFlipping() || bufferCapabilities.isFullScreenRequired()) {
                g2.setColor(Color.black);
                g2.fillRect(0, 0, getWidth(), getHeight());
                g2.setColor(Color.red);
                g2.drawString("Hardware Acceleration is not supported...", 100, 100);
                g2.setColor(Color.white);
                g2.drawString("Page Flipping: " + (bufferCapabilities.isPageFlipping() ? "Available" : "Not Supported"), 100, 130);
                g2.drawString("Full Screen Required: " + (bufferCapabilities.isFullScreenRequired() ? "Required" : "Not Required"), 100, 160);
                g2.drawString("Multiple Buffer Capable: " + (bufferCapabilities.isMultiBufferAvailable() ? "Yes" : "No"), 100, 190);
            } else {
                g2.setColor(Color.black);
                g2.fillRect(0, 0, getWidth(), getHeight());
                g2.setColor(Color.white);
                g2.drawString("Hardware Acceleration is Working...", 100, 100);
                g2.drawString("Page Flipping: " + (bufferCapabilities.isPageFlipping() ? "Available" : "Not Supported"), 100, 130);
                g2.drawString("Full Screen Required: " + (bufferCapabilities.isFullScreenRequired() ? "Required" : "Not Required"), 100, 160);
                g2.drawString("Multiple Buffer Capable: " + (bufferCapabilities.isMultiBufferAvailable() ? "Yes" : "No"), 100, 190);
            }
    
            y += delta;
            if((y + 50) > getHeight() || y < 0) {
                delta *= -1;
            }
    
            g2.setColor(Color.blue);
            g2.fillRect(getWidth()-50, y, 50, 50);
        }
    }
    A variant of this question is posted here with no solution.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is online now Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,304
    Rep Power
    20

    Default Re: Java Hardware Acceleration / Direct3D Doesn't work with Intel Integrated Graphics

    Moved from Advanced Java

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: Java Hardware Acceleration / Direct3D Doesn't work with Intel Integrated Graphics

    When you say Intel integrated graphics, I assume you mean "Intel HD" graphics. I have a Sandy Bridge Celeron in a Gigabyte GA-Z77-HD3 running Ubuntu 12.04, and I'm using the on-board HDMI. Your app says hardware acceleration is working, page flipping available, full screen not required, but not multiple buffer capable.
    Get in the habit of using standard Java naming conventions!

Similar Threads

  1. Replies: 13
    Last Post: 10-04-2012, 07:45 PM
  2. Java Swing - JLabel setText() doesn't work
    By Zyril in forum New To Java
    Replies: 6
    Last Post: 07-29-2012, 09:51 PM
  3. Replies: 2
    Last Post: 07-03-2012, 08:09 AM
  4. Replies: 9
    Last Post: 02-26-2012, 09:13 PM
  5. 2D graphics acceleration
    By matiasmorant in forum Advanced Java
    Replies: 8
    Last Post: 01-18-2012, 01:06 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •