Next Previous Contents

3. Usage

You may run the server from either a file manager or the shell. The server will appear as a graphical window, and host a TCP socket at port 17702 by default. From this point, you can run the test client from a shell, and after it connects to the glAppGrapher, you can watch objects appear in the glAppGrapher. You may then use the left, right, and middle mouse buttons to navigate around the three-dimensional world.

3.1 Command-Line Parameters

-fullscreen Tells the server to run in full screen mode. The default mode is 800x600x16@60 Hz
-width width Initial width of the window, or width in full screen mode
-height height Initial height of the window, or height in full screen mode
-bpp bitsperpixel Initial bits per pixel in full screen mode (Default is 16)
-refreshrate rate Refresh rate in full screen mode (Default is 60 Hz)
-port listenport Port to host the glAppGrapher on


3.2
Logic

The glAppGrapher contains a linked list of OpenGL and GLU-based commands. Each time you send the glAppGrapher a command to either render something or change a render property, the glAppGrapher will add your command to the linked list. Every time the glAppGrapher redraws itself because of a camera movement, a window refresh, or the act of having a command sent to it; it will clear the scene, and traverse the entire linked list for commands to execute.

For example, if you send these commands to the glAppGrapher from your code only once:

glColor4f(1,0.5,0.5,0);
glVertex3f(0,0,0);

The glAppGrapher will perform this sequence of events every time it redraws:

glColor4f(1,0.5,0.5,0);
glVertex3f(0,0,0);

If you used the mouse to move around the scene, and logged each command as it happened in the glAppGrapher, your log file would look something like:

glColor4f(1,0.5,0.5,0);
glVertex3f(0,0,0);
glColor4f(1,0.5,0.5,0);
glVertex3f(0,0,0);
glColor4f(1,0.5,0.5,0);
glVertex3f(0,0,0);
glColor4f(1,0.5,0.5,0);
glVertex3f(0,0,0);
glColor4f(1,0.5,0.5,0);
glVertex3f(0,0,0);
glColor4f(1,0.5,0.5,0);
glVertex3f(0,0,0);

So, how does the server know you want it to call "glColor4f" and "glVertex3f"? Because in the command you pass to it, you send the name of the OpenGL function you want to call, as well as all its parameters. If any of those parameters are a pointer, you will just pass all the raw data that is pointed to. Later on when the glAppGrapher actually handles your command, it maps the name of the OpenGL function to the actual OpenGL function itself, passes in the parameters that you gave it, and calls the function. Read on for more details.

 

3.3 Usage in your own program

This is where the real explaining comes into play. The test client comes with source, so you can see how the communication takes place in passing commands through sockets.

The first step to establishing communication begins when the glAppGrapher is running and hosting a server. Upon starting your client program, you must use Berkeley Socket calls at the TCP layer to connect to the glAppGrapher. Once you are connected, you send commands to the glAppGrapher through your socket via binary data as shown below.

Every command the test client sends to the glAppGrapher is built in the following format:

Based on what the message ID is, these fields will follow the Message ID  field:

For GLAG_MSG_CONSOLE: The zero-terminated string you want to send to the console; as if you were typing it in from the console.

For GLAG_MSG_CLEAR: None

For GLAG_MSG_GL_FUNC:

 

Please look in glappgrapherclient.cpp for details. 

You may notice that most of the messages ID's have no accompanying implementation. They have yet to be implemented in a future release.

 



Next Previous Contents