text output console

The place to discuss creating, porting and modifying Celestia's source code.
Topic author
Dandelion
Posts: 8
Joined: 23.06.2009
With us: 15 years 4 months

text output console

Post #1by Dandelion » 10.08.2009, 11:18

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

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 2 months
Location: NY, USA

Re: text output console

Post #2by selden » 10.08.2009, 11:39

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
Selden

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 7 months
Location: Hamburg, Germany

Re: text output console

Post #3by t00fri » 10.08.2009, 15:18

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
Image

Topic author
Dandelion
Posts: 8
Joined: 23.06.2009
With us: 15 years 4 months

Re: text output console

Post #4by Dandelion » 10.08.2009, 19:45

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

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 7 months
Location: Hamburg, Germany

Re: text output console

Post #5by t00fri » 10.08.2009, 20:16

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
Image


Return to “Development”