The Virtual Gallery Initiative
About Source Docs Examples bottom
Examples

All of this is included in the /docs directory of the download

Example VGI Tag File...designed to show all the tags and will drive a the parser nuts if you use it

<vgi>>
<junk>
<head>

  <title = "The Blacksun">
  <world depth-test texture="GL_Texture_2D">
  <lighting Local Viewer Two-Sided ambient = ".5,.5,.5,1">

</head>
<body>


<object name = "OBJ1" origin = "1,2,0.0" defs="blah.def">
     <primative = "gl_QUADS">
     <dimension = "GL_TEXTURE_2D">
     <mode = "MOduLATE">
     <junk>
     <clamp = "SR">
     <repeat = "Y">
     <type ="GL_RGB">

     <material both>
     <ambient = ".2, 1.0, 1.0, 1.0">
     <diffuse = ".2, .5, 1.0, 1.0">
     <specular = ".2, .5, 1.0, 1.0">
      <shiny = 15.0>
     <emission = ".0, .0, .5, 1.0">
     </material>

     <vlist>
     <v = "1,0,2"><t = "0,0,0">
     <v = "4,0,2"><t = "1,0,0">
     <v = "4,4,2"><t = "1,1,0">
     <v = "1,4,2"><t = "0,1,0">
     </vlist>

     <texture = "neotrin.sgi">
     <filter="GL_LINEAR">
</object>

<light>
     <ambient = ".2,.3,.1,1.0">
     <diffuse = ".2,.3,.1,1.0">
     <specular = ".2,.3,.1,1.0">
     <position = "0.0,10.0,0.0,0.0">
     <direction = "0.0,0.0,0.0">
     <exponent = "1">
     <cutoff = "45">
     <constant = "1"> or <contstant attenuation ="1">
     <linear = "1"> or <linear attenuation ="1">    <quadratic = "1"> or <quadratic attenuation ="1">

</light>

</body>
</vgi>

General Info

No Tag is case sensitve nor is the data between the " ", with the exception of file references (with good reason). The GL_ prefix to the listed data options is also optional, to save on typing.

Most tags do not need a compliemtary ending tag (ig. <TAG> </TAG>) but some do require it, the <LIGHT>,<OBJECT>, <VLIST>, <HEAD>, <BODY>, <MATERIAL> and <VGI> being the ones that do.

Also all tags that tag RGBA values are clamped at 1, as per the GL standard.
Finaly, the quotes " " are important (unlike HTML)

Head Info

Title
Sets the title of the VGI window (not yet actually). It does not need completion.

Lighting Overall Lighting Settings.

If "Local Viewer" is present it sets the light model to local view, if not
present the default is infinite.

If "Two-Sided" is present it sets the light model to two sided color, if not
present the default is one-color

If "Specular" is present it sets the light model to Seperate Specular Color, rather than single color value default

<Ambient> sets the overall ambient lighting levels with a standard RGBA chain. Values are clamped at 1.

Also by including the lighting tag you turn on lighting so you'd better define some light objects in the body. It does not need completion.

World

This tag sets the object state variables for the entire GL world. It does not need completion.

Tags-Key Words

"Depth-Test" - Enables GL Depth Testing
"Cull-Face" - Enables Polygon Cull facing, the default is Front Facing.
"Texture" - Enables "GL_TEXTURE_2D" (default) or "GL_TEXTURE_3D"
"BlendSrc" - Determines the source channel for blending. Default is GL_ONE.

Possible Values:

GL_ZERO
GL_ONE (default)
GL_DST_COLOR
GL_ONE_MINUS_DST_COLOR
GL_SRC_ALPHA
GL_ONE_MINUS_SRC_ALPHA
GL_DST_ALPHA
GL_ONE_MINUS_DST_ALPHA
GL_SRC_ALPHA_SATURATE
GL_CONSTANT_COLOR
GL_ONE_MINUS_CONSTANT_COLOR
GL_CONSTANT_ALPHA
GL_ONE_MINUS_CONSTANT_ALPHA

"BlendDest" - Determines the destination channel for blending. Default is GL_ONE.

Possible Values:

GL_ZERO
GL_ONE (default)
GL_SRC_COLOR
GL_ONE_MINUS_SRC_COLOR
GL_SRC_ALPHA
GL_ONE_MINUS_SRC_ALPHA
GL_DST_ALPHA
GL_ONE_MINUS_DST_ALPHA
GL_CONSTANT_COLOR
GL_ONE_MINUS_CONSTANT_COLOR
GL_CONSTANT_ALPHA
GL_ONE_MINUS_CONSTANT_ALPHA

Body Info

Lights

The <LIGHT> tag creates a light object. Currently GL limits things to 8 lights. This
tag must be completed by a </LIGHT> tag.

<Ambient> - Sets the ambient color in RGBA format. Default is 0,0,0,1.0
<Diffuse> - Sets the diffuse color in RGBA format. Default is .5,.5,5,1.0
<Specular> - Sets the specular color in RGBA format. Default is 0,0,0,1.0

<Position> - Sets the location in x,y,z,w co-ordinates. If w is zero the light source is a directional one, and the co-ordinates descripe its direction. If non-zero it is a positional light and the co-ordinates describe the location of the light. Be sure to set a direction and attenuation. The default is 0,10,0,1 (yes a positional light is default)

<Direction> - Sets where a positional light is being pointed in x, y, z co-ordinates. The default is 0,0,0.

<Exponent> - Sets how concentrated the light is. Default is 0.

<Cutoff> - Sets the spot_cutoff angle. Remember it is half of the total arc of the light, thus the default of 45, gives a 90 degree cone of light. The limit is 90 with the exception of 180 being allowed (it's GL not this app)

<Constant> or <Contstant attenuation> - Sets the constant attenuation for the light. Default is 1.

Linear or <Linear attenuation> - Sets the linear attenuation for the light. Default is 0.

<Quadratic> or <Quadratic attenuation> - Sets the quadtratic attenuation for the light. Default is 0.

Objects

The <OBJECT> tag creates a new object. There is no limit to the amount of objects (well okay memory, processor, and bandwidth). This tag must be completed by a </OBJECT> tag

In the object tag you may use the folowing keywords

"name" - Lets you provide a unique name for the object, to be used in animation (animation to be implimented)

"origin" - Lets you specify an origin point that this object's vertex definitions will be based around. This allows you to create objects and not have to calculate each vertex in the overall world co-ordinates. You can say "I want a 10x10x10 box" (in the vertex list) "and place it at 25.3,13.1,5.0" (the origin). This tag is optional, but is a massive timesaver.

"defs" - Specifies a .def file to be retrieved from the server. This is a smaller subset of a .vgi file that contains object definition. This is a great way of creating long complex objects without cluttering your .vgi page, or for loading pre-defined objects like "column.def". You must use the origin keyword with these, else the object will end up at the default origin 0,0,0. **Not impimented yet**

<PRIMATIVE> - Sets what type and style of polygon to draw. Note that the GL_ is optional and will parse fine with or without it. The default is GL_POLYGON

Possible Values:

GL_POINTS
GL_LINES
GL_LINE_STRIP
GL_LINE_LOOP
GL_TRIANGLES
GL_TRIANGLE_FAN
GL_TRIANGLE_STRIP
GL_QUADS
GL_QUAD_STRIP
GL_POLYGON (default)


<DIMENSION> - Sets the Dimension for the texture to be used. Default is 2D.

Possible Values:

GL_TEXTURE_1D
GL_TEXTURE_2D (default)
GL_TEXTURE_3D


<MODE> - Sets the mode on how the texture is applied to the polyon. Default is Replace. Since most everything will be textured rather than basic polygons, this tag is not used much.

Possible Values:

GL_DECAL
GL_REPLACE (default)
GL_MODULATE
GL_BLEND
GL_REPLACE

<TYPE> - Sets the image type to be loaded later. Right now the MipMap generation only takes two. RGB and RGBA. The Default is RGBA

Possible Values:

GL_RGB
GL_RGBA (default)

<FILTER> - Sets the filetering mechanism for shading, reduction and enlarging. Nearest is faster but Linear looks better.

GL_LINEAR (default)
GL_NEAREST

<CLAMP>
<REPEAT>
- Tells how to handle texture co-ordinates > 1. The Values passed can either be XYZ or RTS.


<TEXTURE> - The name of the image file to be gotten and loaded into a texture object

<VLIST> - Starts the collection of vertex and texture points. This tag does need compeltion as you can have as many vertex and t points as you need for the object.

<V> - Vertex points in x,y,z (relative or hard addressing is determined by origin tag)

<T> - Texture points in x,y,z. Tells where in the texture map this particular vertex is associated with. The Z is only used for 3D textures.

Note that even though you can list all the vertex points and then all the texture points. It is best to lay them out one beside the other, lest confusion set in when it does not render correctly. Also if you specify more of one than the other, the extra are ignored.

<MATERIAL> - Matrial properties of the object. Needs closing tag </MATERIAL> You can use the tag FRONT, REAR or BOTH to specify which face this set of materials applies to. Values are in standard RGBA format except for shininess exponent.

<ambient> - Ambient light reflected
<diffuse> - Diffuse light reflected
<specular> - Specular light reflcected
<shiny> - Shininess of the object
<emission> - Amount of light and kind of light emited by the object