Neatware Header
Home   Products   Forums   Partners   Buy   Company   Contact   Blog   

15. Application

application is the root of other objects. You can think it as a game environment. vertex object is an instance of vertex shader; pixel object is an instance of pixel shader; and texture is an instance of texture shader. The mesh object inherits from the application deals with the mesh procecessing. The vbuufer and ibuffer handle the vertex buffer and the index buffer. Finally, the light and material objects work for the lights and materials in the fixed-function shaders.

set app [$app application] creates an application object with the variable name app. You can use $app to call functions for the object. $app create will create a window with default position, size, and title. $app run starts running program in the windows message loop. $app release will release the resource of the application instance. $app version vertex major minor sets the required vertex version with major and minor.

Application commads include:

  • $app create this fullscreen
  • $app create this window maximize
  • $app create this window size x y width height

    creates an application object inside a class with this variable. If the fullscreen parameter is added this command creates a window in fullscreen initially. The window parameter specifies the window as maximize or as the size in the x, y position with width and height.

  • $app release

    release application object.

  • $app run

    starts to execute application object and enters the message loop.

Vertex and pixel shader commands include:

  • $app vertex

    creates a vertex shader with arguments ??

  • $app decl

    creates vertex declaration with arguments ??

  • $app version [vertex|pixel] major minor

    sets required vertex or pixel shader version

  • $app vconst

    sets vertex constant

  • $app vconsti

    sets vertex constant to integer

  • $app vconstf

    sets vertex constant to integer

  • $app pixel

    creates pixel shader with arguments ??

  • $app pconst

    sets pixel shader constant ??

  • $app pconsti

    sets integer pixel shader constant

  • $app pconstf

sets float pixel shader constant.

Creates texture commands

  • $app texture

    creates texture with arguments ??

  • $app vset

    actives video texture

Creates mesh, effect, envmap, and graph

  • $app mesh

    creates mesh with arguments ??

  • $app effect

    creates effect with arguments ??

  • $app envmap

    creates environment map with arguments ??

  • $app graph

creates graph with arguments

Creates vertex and index buffer

  • $app vbuffer

    creates vertex buffer

  • $app ibuffer

creates index buffer

Creates other objects

  • $app arcball

    creates arcball object

  • $app font name size style

    creates a font object with font name, size and style. The style can be enum bold, italic, or zenable.

  • $app dialog file [fname] [initdir] [filter]

    returns file path name from a file dialog box. fname is the initial file naem, initdir is the initial directory, and filter is the filter string of the file. The default file name is default.
    The default initial directory is ".". The default filter is "All Files (*.*)\0*.*\0\0".

  • $app keyboard active mView

    initializes keyboard control to the matrix mView.

  • $app keyboard active mView

gets the new view matrix mView.

  • $app getFTU

    some video card require D3DPTEXTURECAPS_POW2 capability, that is a texture must have widths and heights specified as powers of two. So the texture addressing over (u, v) should have a new value fTU instead of 1.0.

  • $app getFTV

some video card require D3DPTEXTURECAPS_POW2 capability, that is a texture must have widths and heights specified as powers of two. So the texture addressing over (u, v) should have a new value fTV instead of 1.0.

  • $app getFrameStats

    returns the string of frame stats
  • $app getDeviceStats

returns the string of device stats

  • $app getElapsedTime

    returns elapsed time

  • $app getTickCount

    returns tick count number

  • $app getTransform type m

    gets transform matrix and stores to m. Type can be view, projection, world, texture0-7.

  • $app setTransform type m

    sets transform matrix by m. Type can be view, projection, world, texture0-7.

  • $app setRenderState state value

    sets render state. State can be any element of the D3DRENDERSTATETYPE type.

  • $app setSamplerState sampler type value

sets texture sampler states. Sampler is The sampler stage index. Type can be addressu, addressv, addressw, bordercolor, magfilter, minfilter, mipfilter, mipmaplodbias, maxmip-level, maxanisotropy, srgbtexture, elementindex, and dmapoffset. The value is upto the type setting.

  • $app setTextureStageState stage type value

sets texture stage state. Stage is the identifier of the texture. It is in the range from 0 to 7. Type indicates the texture state D3DTEXTURESTAGESTATETYPE to be set. Value is the state value upto the type parameter.

  • $app clear flags color z stencil

    clears the viewport to a specified color, and/or the depth buffer, and/or the stencil buffer. Flags can be combination of the list {target zbuffer stencil} which indicates what buffer will be erased. z is in the range from 0.0 to 1.0. And stencil is in the range from 0 to 2^n-1, where n is the bit depth of the stencil buffer.

  • $app beginScene

    starts scene
  • $app drawIndexedPrimitive type baseIndex minIndex numVertices startIndex primitiveCount

renders indexed primitive. The type can be pointlist, linelist, linestrip, trianglelist, trianglestrip, or trianglefan. BaseIndex is the offset of the first vertex index. MinIndex is the minimum vertex index used in this render. NumVertices is the number of vertices. StartIndex is the starting location to render the vertices. PrimitiveCount is the number of primitives to render.

  • $app drawPrimitive type startIndex primitiveCount

    renders primitive. StartIndex is the starting location to render the vertices. PrimitiveCount is the number of primitives to render.

  • $app showHelp

    returns true if show help key F1 is pressed ok otherwise returns false.

  • $app endScene

    ends a scene