Page 1 of 1

text output console

Posted: 10.08.2009, 11:18
by Dandelion
Hello,

is there any way to check the content of a variable in the renderer? I tried cout << xx but then where is the console the output is displayed. Or is it possible to access the variables via the huddetails/overlayelements from the celestiacore?

Greetings
Thomas

Re: text output console

Posted: 10.08.2009, 11:39
by selden
Exactly what do you mean by
the content of a variable in the renderer?
What kind of variable?

Most user-modifiable values are accessible by using appropriate CelX (Lua) functrions. Unfortunately, the function names aren't particularly consistent. Some use tables, some consist of the variable name prefixed by get, some functions are just the variable's name. You'll have to read through the CelX documentation in the WikiBook to find out which to use. See http://en.wikibooks.org/wiki/Celestia#Scripting

Celestia's command console log only contains specific messages which may or may not be what you want. It's only available by directing it to a log file and you have to use a specific incantation to get that to happen. Celestia doesn't follow exactly the standard Unix conventions for redirecting terminal output. See http://en.wikibooks.org/wiki/Celestia/Command_Line

Re: text output console

Posted: 10.08.2009, 15:18
by t00fri
Dandelion wrote:Hello,

is there any way to check the content of a variable in the renderer? I tried cout << xx but then where is the console the output is displayed. Or is it possible to access the variables via the huddetails/overlayelements from the celestiacore?

Greetings
Thomas

Thomas,

you told us far too little! I assume you have managed to compile Celestia, otherwise the C++ command cout<<xx doesn't make any sense. But what operating system/compiler are you using? That's crucial, indeed.

1) Linux: You compile Celestia with gcc(g++) , start the executable from a standard Linux console and then get the cout result onto that console.

2) Windows: The standard (free) compiler we are all using is VC++ 2008 express (SP1) (Microsoft). There you can open a console from withing the IDE. After starting Celestia with CTRL+F5 from within the IDE, the cout output appears in that console.

You may also read out many variables using celx commands.

Fridger

Re: text output console

Posted: 10.08.2009, 19:45
by Dandelion
Hi,

sorry for the lack of information. First of all my c++ knowledge is very limited. I'm using VS 2008 with Vista. I'm trying to modify the way the surface.color is calculated in the Renderer::renderStar function. There for I added two variables. Now for some reason the stars are only black. My calculations must be wrong. I have no clue were I went wrong so I want to have a look into the new variables to see what the interim results look like. I have no idea how to output the content of the variables.

Hope you can help!

Thomas

Re: text output console

Posted: 10.08.2009, 20:16
by t00fri
Dandelion wrote:Hi,

sorry for the lack of information. First of all my c++ knowledge is very limited. I'm using VS 2008 with Vista. I'm trying to modify the way the surface.color is calculated in the Renderer::renderStar function. There for I added two variables. Now for some reason the stars are only black. My calculations must be wrong. I have no clue were I went wrong so I want to have a look into the new variables to see what the interim results look like. I have no idea how to output the content of the variables.

Hope you can help!

Thomas

Well then, AFTER these two variables have been defined (of course!), just insert

cout << variable1<< " "<<variable2<<endl;

[
Sometimes you must write instead
cerr<< variable1<< " "<<variable2<<endl;
]

Be careful NOT to print out variables from busy inner loops .... (else the program will come to almost a halt printing out all this ;-) )

Open a console in the VS 2008 IDE and run the program with CTRL+F5 after recompiling. See what happens.


Good luck
Fridger