1 Reply Latest reply: Oct 24, 2012 2:12 AM by gimbal2 RSS

    no video memory. no memory acceleration for Intel HD graphics. what now?

    800600
      I did a quick double buffering on my pc with a Intel HD graphics (integrated with CPU) and works fine but jumpy and flickering a little. I run a check on the BufferedStrategy, BufferCapability and ImageCapability (code below), and found that no video memory, image cannot be accelearated in any way and Java is using blitting to do the double buffering.

      Is this normal for Intel HD graphics or my program is flawed anywhere?
      import java.awt.*;
      import java.awt.event.*;
      import java.awt.image.*;
      import javax.swing.*;
      import java.util.*;
      
      public class CapTest extends Canvas{
      private GraphicsConfiguration gc=null;
      private int img_width=0, img_height=0;
      private ArrayList<String> sb=null;
      
      public CapTest(int w, int h){
      this.img_width=w;
      this.img_height=h;
      // fixed size of drawing canvas
      setPreferredSize(new Dimension(w,h));
      setMaximumSize(new Dimension(w,h));
      setMinimumSize(new Dimension(w,h));
      // create String array
      sb=new ArrayList<String>(20);
      }
      
      @Override
      public void paint(Graphics g){
      
      g.setColor(Color.black);
      g.fillRect(0,0,getWidth(),getHeight());// fillRect(x,y,width,height)
      g.setColor(Color.yellow);
      int x=4,y=12;
      for (int c=0; c<sb.size(); c++){
           g.drawString(sb.get(c),x,y);
           y+=16;
      }
      ;
      }
      
      @Override
      public void update(Graphics g){
      paint(g);
      }
      
      private void start(){
      int number;
      boolean b;
      
      // create buffers for this Canvas object
      createBufferStrategy(2); 
      
      // create informational objects
      GraphicsEnvironment ge=GraphicsEnvironment.getLocalGraphicsEnvironment();
      GraphicsDevice gd=ge.getDefaultScreenDevice();
      GraphicsConfiguration gc=gd.getDefaultConfiguration();
      BufferCapabilities bc=gc.getBufferCapabilities();
      ImageCapabilities fbc=bc.getFrontBufferCapabilities();
      ImageCapabilities bbc=bc.getBackBufferCapabilities();
      
      // create report
      
      sb.add("Device default information:");
      sb.add("");
      sb.add("From GraphicsDevice==>");
      sb.add(String.format("Device ID: %s",gd.getIDstring()));
      
      number=gd.getAvailableAcceleratedMemory();
      if (number<=0)
           sb.add(String.format("Available accelerated memory: %d bytes (Oops!)", number));
      else
           sb.add(String.format("Available accelerated memory: %d bytes", number));
      
      sb.add("");
      sb.add("BufferCapabilities==>");
      sb.add("Full screen mode required: "+bc.isFullScreenRequired());
      sb.add("Multiple Buffers available: "+bc.isMultiBufferAvailable());
      
      b=bc.isPageFlipping();
      sb.add("Use Page flipping: "+b);
      if (b)
           sb.add("FlipContents: "+bc.getFlipContents().toString());
      else
           sb.add("FlipContents: BLIT");
      
      sb.add("");
      sb.add("ImageCapabilities==>");
      sb.add("Front buffer accelerated: "+fbc.isAccelerated());
      sb.add("Front buffer can lose surface: "+fbc.isTrueVolatile());
      sb.add("Back buffer accelerated: "+bbc.isAccelerated());
      sb.add("Back buffer can lose surface: "+bbc.isTrueVolatile());
      
      // show the report
      repaint();
      ;
      }
      
      
      public void showNow(int w, int h){
      
      JFrame jf=new JFrame("Hardware Capabilities Test");
      if ((w==this.img_width) && (h==this.img_height)){
           jf.setResizable(false);
      }
      
      jf.add(this);
      
      // set up default window close action.
      jf.addWindowListener(new WindowAdapter(){
           public void windowClosing(WindowEvent e) {
                sb.clear();
                sb=null;
                System.exit(0);
           }
      });
      
      jf.pack();
      jf.setVisible(true);
      
      // set up reporting environment.
      this.gc=jf.getGraphicsConfiguration();
      start();
      
      }
      
      public static void main(String[] args) {
      
      javax.swing.SwingUtilities.invokeLater(
           new Runnable(){
                public void run(){
                     new CapTest(640,400).showNow(640,400);
                }          
           }
      );
      
      }
      ;
      }
      Without video memory, how do I create smooth animation? My pc is a Xeon 3.0 Ghz computer with 4GB memory.