ParallelGraphics Forums
General
You are here: [Forums]::[General]

Registration 
Registration
Forgot your password?

Help 
Help
Support

Quick search 

Subscribe to newsletters 

Install Cortona VRML Client for FREE!
Outline 3D
Try RobinZone!
email:  password:
  General

Subject: Re: How to Read Values from Text (.txt) or Databas
Sender: steve@geostudio3d.co.uk 16.10.07 02:51

You could try this ...

Below is a code sample which lets a VRML scene communicate with PHP on an Apache server/
This was done a long time ago and I forget which browser it was tested on

The method uses Browser.createVrmlFromURL
The URL is to a PHP file which returns some VRML with an anchor node
The anchor node parameter field contains returning data

In this example the waitForResponse timer waits 5 2 seconds for the server to respond.
You could make it retry until the response returns.
Even better, you could add an initialise script to the return vrml which would do a callback on loading.

Steve

-- wrl file ------------------------------------------------------------------------------------------

#VRML V2.0 utf8


DEF G Group{}

DEF waitForResponse TimeSensor {loop FALSE enabled TRUE cycleInterval 2}


DEF    S Script{
    directOutput TRUE
    mustEvaluate TRUE
    field SFNode g USE G
    eventOut SFTime querySent
    eventIn SFBool checkResponse


    url    "vrmlscript:

    function sendQuery(v,t,p){
        // p contains query parameter string eg ?name=steve&age=32
        if(v){
            g.removeChildren=g.children; // clean out previous communication
            h='muStat.php'+p;
            u=new MFString(h);
            Browser.createVrmlFromURL(u,g,'addChildren');
            querySent=t;
        }
    }


    function checkResponce(v,t){
        if(!v){
            a=g.children[0];
            print(a.parameter[0]);
        }
    }
    "
}



ROUTE S.querySent TO waitForResponse.startTime
ROUTE waitForResponse.isActive TO S.checkResponse


-- wrl file ------------------------------------------------------------------------------------------

<?php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
?>
#VRML V2.0 utf8
Anchor{parameter[
"piece of data 1"
"piece of data 2"
"etc"
]}


I have project related to VRML. My aim is to gather data from Database or Text files which are always updated and use these data into my VRML file.
Actually in database there is a boolan value if this value is 0 than my machine shows the red light and if value is 1 than my machine shows the green light. There are several machines and continuous updated machine state (0 or 1). How do i satisfy these interaction autonmously?

It is my final project of my university. So vital important for me. Please help me. Thank you in advance.


 


How to Read Values from Text (.txt) or Database / denizfb81@hotmail.com / 4.10.07 12:58
     Re: How to Read Values from Text (.txt) or Databas / steve@geostudio3d.co.uk / 16.10.07 02:51
         Re: How to Read Values from Text (.txt) or Databas / nalex@parallelgraphics.com / 16.10.07 06:34
             Re: How to Read Values from Text (.txt) or Databas / steve@geostudio3d.co.uk / 16.10.07 09:04
         Re: How to Read Values from Text (.txt) or Databas / steve@geostudio3d.co.uk / 16.10.07 03:01

Messages in thread: 5


© 1998-2007 ParallelGraphics. All rights reserved. Terms of use.