What happened to my frame rate!


Ok, I don't mean to boast, but I do have a pretty good graphics card… it’s a NVidia 6800. My PC is no slouch either, and I’ve got plenty of memory, so when I started up the gears.java demo I was expecting a pretty high frame. However, it just didn’t look right. I added some code to the display() function (which gets called to display each frame) and I was getting 60FPS... Hold the phone!!!!
if(nFrame++ > 200) {
if(nLastUpdate != 0) {
long nTimeMS = System.currentTimeMillis() - nLastUpdate ;
System.out.println(nFrame + " in " + nTimeMS + "msec (" +
nFrame * 1000 / nTimeMS + " FPS)") ;
}
nFrame = 0 ;
nLastUpdate = System.currentTimeMillis() ;
}

60FPS…um… that is my monitor refresh rate (I’ve got an LCD). Ahhh, now I remember… Vertical retrace! To stop frames from tearing while being display most OpenGL implementations pause and wait for the monitors Vertical Retrace Interrupt before updating the image. Usually, it’s a pain to turn this off in OpenGL but in JOGL it’s easy. If you want to pull the maximum frame rate just set the "swap interval" to 0 in the init() function.

public void init(GLAutoDrawable drawable) {
GL gl = drawable.getGL();
gl.setSwapInterval(0);

}

1100 FPS … That’s better, now that’s what I like to see!

Labels

Web Search Gmail Google Docs Mobile YouTube Google Maps Google Chrome User interface Tips iGoogle Social Google Reader Traffic Making Devices cpp programming Ads Image Search Google Calendar tips dan trik Google Video Google Translate web programming Picasa Web Albums Blogger Google News Google Earth Yahoo Android Google Talk Google Plus Greasemonkey Security software download info Firefox extensions Google Toolbar Software OneBox Google Apps Google Suggest SEO Traffic tips Book Search API Acquisitions InOut Visualization Web Design Method for Getting Ultimate Traffic Webmasters Google Desktop How to Blogging Music Nostalgia orkut Google Chrome OS Google Contacts Google Notebook SQL programming Google Local Make Money Windows Live GDrive Google Gears April Fools Day Google Analytics Google Co-op visual basic Knowledge java programming Google Checkout Google Instant Google Bookmarks Google Phone Google Trends Web History mp3 download Easter Egg Google Profiles Blog Search Google Buzz Google Services Site Map for Ur Site game download games trick Google Pack Spam cerita hidup Picasa Product's Marketing Universal Search FeedBurner Google Groups Month in review Twitter Traffic AJAX Search Google Dictionary Google Sites Google Update Page Creator Game Google Finance Google Goggles Google Music file download Annoyances Froogle Google Base Google Latitude Google Voice Google Wave Google Health Google Scholar PlusBox SearchMash teknologi unik video download windows Facebook Traffic Social Media Marketing Yahoo Pipes Google Play Google Promos Google TV SketchUp WEB Domain WWW World Wide Service chord Improve Adsence Earning jurnalistik sistem operasi AdWords Traffic App Designing Tips and Tricks WEB Hosting linux How to Get Hosting Linux Kernel WEB Errors Writing Content award business communication ubuntu unik