EzDevInfo.com

GLGE

A javascript webGL graphics library GLGE WebGL Library/Framework

How GLGE XML work?

I'm trying to use GLGE but I have no idea how to write [or export.. or convert..] the 3D model in XML mesh.

Can someone explain me how to "undertand" this king of XML?


Source: (StackOverflow)

GLGE: drop shadows

I'm keen on webgl and GLGE framework. I can't make my cube drop shadow onto a plane. I've copied the definition of light from GLGE shadow demo and I still don't see shadows.

What should I take into account to make objects drop shadows in GLGE?


Source: (StackOverflow)

Advertisements

Translating mouse location to Object coordinates

I'm trying to get basic mouse integration into a small demo using a Collada object. I am able to get the correct mouse x and y, but I don't know how to translate them into coordinates to be used for the object.

I was hoping the GLGE function duck.setLoc(mousepos.x, mousepos.y) would convert from pixels, but that is not the case.

What do I have to do to translate the 2D mousepos pixels into a 3D point?


Source: (StackOverflow)

GLGE API setRot/setRotX doesn't work

I'm trying to make a little scene for viewing 3D models.

I modified the GLGE Collada example to add a .dae model from code.

http://goleztrol.nl/SO/GLGE/01/

What I've got
So far it works. The camera is rotated using an animation.

Using the buttons 'Add' and 'Remove' the model is added and removed from the scene, using the following code (Don't mind 'duck'. It was a duck in the original example.)

var duck = null;
function addDuck()
{
    if (duck) return;
    duck = new GLGE.Collada();

    doc.getElement("mainscene").addCollada(duck);

    duck.setId("duck");
    duck.setDocument("amyrose.dae");
    duck.setLocY(-15);
    duck.setRotX(1);
    duck.setScale(2);
}

function removeDuck()
{
    if (!duck) return;
    doc.getElement("mainscene").removeChild(duck);
    duck = null;
}

Problem
Now the model is lying down, while it should stand up. The various methods of the element seem to work. The location is set, and the scale is set, but the call to setRotX seems to be ignored. I tried various others methods from the api, but setRotY, setRot, setQuatX and setDRotX all seem to fail. I don't get any errors (well not about this method). I tried values of 1.57 (which should be about 90 degrees), but other values as well, ranging from 1 to 180.

I can't find out what I'm doing wrong. Of course I could rotate the model itself in Blender, but I'd like to do it using the GLGE API.

Update
When I load the demo-model, seymourplane_triangulate.dae, the rotation works. Apparently my model differs in that it cannot be rotated. I just don't understand why. I figured it may be because the model is built of various separate meshes, but I don't understand why scaling and moving does work.

Does anyone know what's wrong with this model, and what I could do to fix it (maybe using Blender)?

Setting an initial rotation in the XML file that contains the scene does work. Setting rotation on another element (like the whole scene) works as well.


Source: (StackOverflow)

jQuery Tab Menu and WebGL

I want to use the tabs from jQuery UI (Source: http://jqueryui.com/demos/tabs/) to display on each tab a COLLADA dae file using WebGL GLGE (Source: http://www.glge.org/). The Tabs should be generated dynamically depending on an xml file. Everything works as planed, only the rendering of the 3D Objects does not work.

I tried now different approaches but none of them works. The result is everytime the same. The 3D COLLADA Object is only rendered on the first tab. Even if I use basic and static document.write statements without retrieving data from my xml only the building on the first page is displayed.

For Example:

<div id="tabs">
  <div id="tabs-1">
     //ONLY THIS OBJECT IS RENDERED
     <iframe src="glge/index_1.html" height="400" width="400"></iframe>
  </div>
  <div id="tabs-2">
     <iframe src="glge/index_1.html" height="400" width="400"></iframe>
  </div>
  <div id="tabs-3">
     <iframe src="glge/index_1.html" height="400" width="400"></iframe>
  </div>

If i use the iframes out of the jQuery Tabs more than one iframe is rendered. So

<iframe src="glge/index_1.html" height="400" width="400"></iframe>
<iframe src="glge/index_1.html" height="400" width="400"></iframe>
<iframe src="glge/index_1.html" height="400" width="400"></iframe>
<div id="tabs">
     //codehere
</div>

brings three rendered 3D Objects above the Tabs.

Hope you can understand my problem and help me out.

EDIT: I just uploaded the above "simple" example. You can see it under: http://korb.cwsurf.de/tmp/buildingdetail_simple.html

greetings, faiko


Source: (StackOverflow)

How to load textures to different faces of a cube in GLGE? (or at least WebGL)

I have 6 textures I would like to load on 6 different faces of a cube. I'm trying to make a new texture by using GLGE.TextureCube();. And then I load all six images to the faces the supposedly should be on the cube like so

    mapTex = new GLGE.TextureCube();
    mapTex.setSrcNegX("models/map/negx.jpg"); // they are all 1024x1024
    mapTex.setSrcNegY("models/map/negy.jpg");
    mapTex.setSrcNegZ("models/map/negz.jpg");
    mapTex.setSrcPosX("models/map/posx.jpg");
    mapTex.setSrcPosY("models/map/posy.jpg");
    mapTex.setSrcPosZ("models/map/posz.jpg");

And then I add the texture to the Wavefront object. However, it seems only one of the 6 texture images is getting mapped and its mapped incorrectly.

My guess is that when it creates the new texture map out of the other 6, it tiles them beside each other so the new texture map's co-ordinates no longer correspond to that my obj file.

How can I properly combine 6 textures to one map to be used with GLGE? Or is there a way to manually load a texture on a face of a Mesh?


Source: (StackOverflow)

Processing toxiclips Library For Raspberrypi

I am writing a program in Processing on Raspberrypi(Raspbian), to import a 3D STL image file. It is working perfectly on Microsoft (windows7) & Linux(Ubuntu) platform but I am struggling to run same program on Raspberrypi (Raspbian) platform.

I am getting below Error when I run this program on Raspberrypi...

Coding

import toxi.geom.*;
import toxi.geom.mesh.*;

import toxi.processing.*;

TriangleMesh mesh;
ToxiclibsSupport gfx;

void setup() {
  size(600,600,P3D);
  mesh=(TriangleMesh)new STLReader().loadBinary(sketchPath("check.stl"),STLReader.TRIANGLEMESH);
  //mesh=(TriangleMesh)new STLReader().loadBinary(sketchPath("mesh-flipped.stl"),STLReader.TRIANGLEMESH).flipYAxis();
  gfx=new ToxiclibsSupport(this);
}

void draw() {
  background(51);
  lights();
  translate(width/2,height/2,0);
  rotateX(mouseY*0.01);
  rotateY(mouseX*0.01);
  gfx.origin(new Vec3D(),200);
  noStroke();
  gfx.mesh(mesh,false,10);
}

Error

glGetError 0x500
glGetError 0x500
java.lang.ClassCastException: javax.media.nativewindow.DefaultGraphicsConfiguration cannot be cast to com.jogamp.nativewindow.awt.AWTGraphicsConfiguration
    at javax.media.opengl.awt.GLCanvas.chooseGraphicsConfiguration(GLCanvas.java:1421)
    at javax.media.opengl.awt.GLCanvas.addNotify(GLCanvas.java:630)
    at java.awt.Container.addImpl(Container.java:1114)
    at java.awt.Container.add(Container.java:966)
    at processing.opengl.PJOGL.initSurface(PJOGL.java:347)
    at processing.opengl.PGraphicsOpenGL.initPrimary(PGraphicsOpenGL.java:6310)
    at processing.opengl.PGraphicsOpenGL.requestDraw(PGraphicsOpenGL.java:1653)
    at processing.core.PApplet.run(PApplet.java:2256)
    at java.lang.Thread.run(Thread.java:724)

Can anyone guide on how do I resolve this issue in order to get required result?


Source: (StackOverflow)

Is there a way to run unit test for a WebGL webapp in a headless browser

Is there a way to run unit test for a WebGL (GLGE) webapp in a headless browser?

I'd like to run the tests on a jenkins server, so the tests must run on a headless (phantom.js) brower.

Anybody already tried that?

Cheers


Source: (StackOverflow)