Ambiera ForumDiscussions, Help and Support. |
|
[ 1 2 ] Page 1 of 2 |
|
|||||
|
I know this topic was brought up a while ago, but here's a quick method I'm using for setting the canvas to auto-width and height according to current window size. The only problem here is maintaining the camera aspect ratio. Hope this helps!
|
||||
|
Very cool.. I will try to do this. Thanks for sharing |
||||
|
Hi pal, I am getting an error: canvas is undefined Is it still working for you? |
||||
|
Still working for me, is you canvas id still '3darea'? |
||||
|
Yes the ID is still "3darea".. With that error it isn´t working for me. Don´t you get the same error?! Would you leave the aspect ratio on "automatic"? |
||||
|
I have been leaving the camera aspect ratio as automatic. Not sure if that makes a difference in the error you're getting though. I feel like maybe it's something in your HTML somewhere like a div tag left open or something. Or I suppose it could be the same sort of thing in your JS. |
||||
|
I tested it with an empty scene using exact the same script you posted above.. Same error and no auto-width when browserwindow size is changed :( Anyone else having this issue? |
||||
|
This method returns the size of the browser window: [code ]var width=(window.innerWidth)?window.innerWidth:((document.all)?document.body.offsetWidth:null); var height=(window.innerHeight)?window.innerHeight:((document.all)?document.body.offsetHeight:null); [/code] |
||||
|
This method returns the size of the browser window:
The rest of the code I think the problems will not make |
||||
|
I took a look at the code again. Here's what I'm doing differently now:
|
||||
|
hi i have problem by full screen i replace this code in my pantest.html file but the screen go to left position of my screen and dont fullscreen <html> <head> <script type="text/javascript" src="copperlichtdata/copperlicht.js"></script> <script type="text/javascript"> var canvas; function webGLStart() { canvas = document.getElementById("3darea"); var c_w = window.innerWidth - 50, c_h = window.innerHeight - 17; canvas.width = c_w; canvas.height = c_h; } canvas.resize = function (){ c_w = window.innerWidth - 50; c_h = window.innerHeight - 17; canvas.width = c_w; canvas.height = c_h; } </script> </head> <body ="webGLStart();" ="canvas.resize();"> <canvas id="3darea" width="500" height="500" style="background-color:000; margin:0px;"></canvas> <script type="text/javascript"> <!-- startCopperLichtFromFile('3darea', 'copperlichtdata/pantest.ccbjs'); --> </script> </body> </html> |
||||
|
The attribute in the body of the posted code lacks that "on resize" (without spaces), this forum strips this out, unfortunately. Then this should be fixed. BTW: The next update of CopperCube will have this feature built-in, so you only need to click a checkbox for this. |
||||
|
hi no check box found un ver 5.3 ! |
||||
|
what's the best method to full screen the page in browser,i can't find solution |
||||
|
You are right, this didn't make it into the 5.3 release. But I'll publish a free plugin which will make this possible about in the middle of next week. |
[ 1 2 ] Page 1 of 2 |
|