ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperLicht
forum topic indicator Help me
person icon
hatoriconan
Registered User
Quote
2010-07-06 06:40:00

I need some code to load file .obj in webgl

can you help me ?

if you finish , please sending me (.html,.javascript)

email :trungle1988@gmail.com

thank you very much

person icon
niko
Moderator
Quote
2010-07-06 17:04:14

You can import any .obj file in copperCube (download here: http://www.ambiera.com/coppercube/download.html) and then create a copperlicht webgl from it. No need to code anyhting.

person icon
zexx
Registered User
Quote
2010-09-06 23:51:03

I cannot initialize the renderer. The code is very simple, listed below. When executed it reports that webgl isn't supported (because renderer cannot be initialized). But webgl is enabled and works, I can run any webgl demo including those from CopperLicht tutorials.

I tried both Chrome (nightly) and Minefield, to no avail. I'm using CopperLicht 1.2.0, which is a single JavaScript file. Am I doing something wrong? Is something wrong with that version of CopperLight?



JavaScript file "panorama.js":

function main() {
// create the 3d engine
var engine = new CopperLicht ("display");

if (!engine.initRenderer()) {
alert ("Your browser doesn't support WebGL.");
return;
}
}
main();


HTML file "panorama.html":


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<script type="text/javascript" src="copperlicht.js"></script>
<script type="text/javascript" src="panorama.js"></script>
</head>
<body>
<div style="width:640px; margin:auto; position:relative; font-size: 9pt; color: 777777;">
<canvas id="display" width="640" height="480" style="background-color:000000">
</canvas>
</div>
</body>
</html>

person icon
niko
Moderator
Quote
2010-09-07 17:02:02

That's actually a problem in your code: The main() is called before the canvas was created, that's why CopperLicht then cannot find an element with the id 'display'.
Simply do it this way: 1) In the panorama.js, remove the main() call at the end. 2) In the html file, under the </canvas> add the following:

<script>main();</script>


Should work then.
Note: From the name, it looks like you used a panorama scene in CopperCube. Use a Free3D scene instead, panoramas are not yes supported in WebGL.

person icon
zexx
Registered User
Quote
2010-09-07 20:58:07

Thank you very much!! It works now!

I'm not a new programmer, but I'm new in JavaScript. At least that's my poor excuse. I'm trying to create a 360 panorama view, which seems to me like a good use for a skybox. Thanks again for helping me.


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |