Page 1 of 4 1234 LastLast
Results 1 to 10 of 35

Thread: Low fps even on empty canvas.

  1. #1
    Junior Member
    Join Date
    Dec 2009
    Posts
    9

    Low fps even on empty canvas.

    Hi!

    I create an empty 1680?1050px canvas with gl.clear only. It shows ~30 fps in Chrome on E8400@3000Ghz & 8800 GTS.
    Where I am wrong?

    Here is the code:
    Code :
    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
    <html>
    	<head>
    		<meta http-equiv="content-type" content="text/html; charset=UTF-8">
    		<title>webgl test</title>
    	</head>
    	<body>
    		<canvas id="canvas" width="1680" height="1050"></canvas>
    		<div id="log">log here</div>
    	</body>
    	<script type="text/javascript">
    		var log = document.getElementById('log');
     
    		var canvas = document.getElementById('canvas');
     
    		var gl;
    		try
    		{ 
    			if(!gl)
    				gl = canvas.getContext('moz-webgl');
    		}
    		catch(e){ }
     
    		try
    		{ 
    			if(!gl)
    				gl = canvas.getContext('webkit-3d');
    		}
    		catch (e) { }
     
    		if(!gl)
    			alert('no webgl');
     
    		gl.clearColor(0.2, 0.2, 0.2, 1.0);
    		gl.clearDepth(1.0);
     
    		var fps = 0;
    		function render()
    		{
    			gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
    			gl.flush();
     
    			fps++;
    		}
     
    		function getFps()
    		{
    			log.innerHTML = fps;
    			fps = 0;
    		}
     
    		window.setInterval(render, 10);
    		window.setInterval(getFps, 1000);
    	</script>
    </html>

  2. #2
    Member Coolcat's Avatar
    Join Date
    Oct 2009
    Location
    NRW, Germany
    Posts
    75

    Re: Low fps even on empty canvas.

    Maybe this does happen because you are calling flush() explicitly? You don't need to call this.

  3. #3
    Junior Member
    Join Date
    Dec 2009
    Posts
    9

    Re: Low fps even on empty canvas.

    Same result without flush().
    I`ve tested it on 2 different configs -- slow on both.

  4. #4
    Junior Member
    Join Date
    Dec 2009
    Posts
    8

    Re: Low fps even on empty canvas.

    nope seems like minefield has the same problem

    I guess the framerate won't stay in the high 60's when you go over 700px x 700px canvas so try using a smaller canvas or use it with that framerate

  5. #5
    Member Coolcat's Avatar
    Join Date
    Oct 2009
    Location
    NRW, Germany
    Posts
    75

    Re: Low fps even on empty canvas.

    This reminds me to something:
    I'm not 100% sure, but this might have something to do with scaling of the canvas element. It's possible that the scaling is done using software, not hardware. However, I had similar problems when I applied width 100% and height 100% to the canvas using CSS. Then I read the element size using JavaScript and set width and height attributes of the canvas element to that size. For some reason Minefield showed scrollbars and was incredible slow. I'm not sure, but I think an CSS-style "overflow:hidden;" solved the problem.

  6. #6
    Junior Member
    Join Date
    Dec 2009
    Posts
    9

    Re: Low fps even on empty canvas.

    2Coolcat: I`ve tried several canvas size definitions with the same result. It`s really looks like software processing.
    Did you fix it? How many fps do you have now?

  7. #7
    Member Coolcat's Avatar
    Join Date
    Oct 2009
    Location
    NRW, Germany
    Posts
    75

    Re: Low fps even on empty canvas.

    Did you fix it?
    Yes, but I don't know how
    It might also have something to do with restarting Minefield.

    How many fps do you have now?
    I'm rendering a full scene (*) at 72 fps.


    (*) my current project: UltimateConquest
    http://www-users.rwth-aachen.de/martin. ... quest.html
    http://www.youtube.com/watch?v=JDTiq3RWfTc

  8. #8
    Junior Member
    Join Date
    Dec 2009
    Posts
    9

    Re: Low fps even on empty canvas.

    I thought, an empty canvas or scene like this should show a thousands fps

  9. #9
    Member Coolcat's Avatar
    Join Date
    Oct 2009
    Location
    NRW, Germany
    Posts
    75

    Re: Low fps even on empty canvas.

    I thought, an empty canvas or scene like this should show a thousands fps
    No, not necessarily. I don't think that WebGL does support such high framerates.

  10. #10
    Junior Member
    Join Date
    Dec 2009
    Posts
    9

    Re: Low fps even on empty canvas.

    Quote Originally Posted by Coolcat
    No, not necessarily. I don't think that WebGL does support such high framerates.
    Maybe, but I can't believe that 30(70) fps and ~100% cpu loading in empty scene is normal for hardware rendering. I think it's some kind of gaps in early implementation.

Page 1 of 4 1234 LastLast

Similar Threads

  1. Low FPS
    By ninjanesto in forum OpenGL ES general technical discussions
    Replies: 1
    Last Post: 04-21-2006, 01:52 AM

Posting Permissions

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