Home My Page Projects Code Snippets Project Openings 3D graphics for Standard ML
Summary Activity SCM

SCM Repository

[sml3d] View of /src/opengl/gl-sig.sml
ViewVC logotype

View of /src/opengl/gl-sig.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 43 - (download) (annotate)
Thu Mar 13 22:10:07 2008 UTC (11 years, 6 months ago) by jhr
File size: 10677 byte(s)
  Adding raster operations
(* gl-sig.sml
 *
 * COPYRIGHT (c) 2005 John Reppy (http://www.cs.uchicago.edu/~jhr)
 * All rights reserved.
 *)

signature GL =
  sig

    include SML3D_TYPES

  (* faces *)
    eqtype face
    val FRONT_FACE : face
    val BACK_FACE : face
    val BOTH_FACES : face	(* == FRONT_AND_BACK *)

  (* material parameters *)
    eqtype material_param 
    val AMBIENT : material_param
    val DIFFUSE : material_param
    val SPECULAR : material_param
    val EMISSION : material_param
    val AMBIENT_AND_DIFFUSE : material_param

  (* enable/disable capabilities *)
(* NOTE: this is just a small subset of the capabilities supported by
 * OpenGL.  Do a "man glEnable" for the full list.
 *)
    eqtype capability
    val ALPHA_TEST : capability
    val AUTO_NORMAL : capability
    val BLEND : capability
    val COLOR_MATERIAL : capability
    val CULL_FACE : capability
    val DEPTH_TEST : capability
    val FOG : capability
    val LIGHTING : capability
    val LINE_SMOOTH : capability
    val POINT_SMOOTH : capability
    val RESCALE_NORMAL : capability
    val STENCIL_TEST : capability
    val SCISSOR_TEST : capability
    val enable : capability -> unit
    val disable : capability -> unit

  (* matrix-mode operations *)
    eqtype matrix_mode
    val MODELVIEW_MATRIX : matrix_mode
    val PROJECTION_MATRIX : matrix_mode
    val TEXTURE_MATRIX : matrix_mode
    val COLOR_MATRIX : matrix_mode	(* requires GL_ARB_imaging *)
    val matrixMode : matrix_mode -> unit
    val getMatrixMode : unit -> matrix_mode
    val loadIdentity : unit -> unit
    val pushMatrix : unit -> unit
    val popMatrix : unit -> unit
    val ortho : {
	    left : double, right : double,
	    bottom : double, top : double,
	    zNear : double, zFar : double
	  } -> unit
    val frustum : {
	    left : double, right : double,
	    bottom : double, top : double,
	    zNear : double, zFar : double
	  } -> unit
    val viewport : {x : int, y : int, wid : int, ht : int} -> unit
    val depthRange : {zNear : double, zFar : double} -> unit

  (* transformations *)
    val rotated  : (double * double * double * double) -> unit
    val rotatef  : (float * float * float * float) -> unit
    val rotatedv : (double * vec3d) -> unit
    val rotatefv : (float * vec3f) -> unit
    val scaled   : (double * double * double) -> unit
    val scalef   : (float * float * float) -> unit
    val scaledv  : vec3d -> unit
    val scalefv  : vec3f -> unit
    val uScaled  : double -> unit
    val uScalef  : float -> unit
    val translated  : (double * double * double) -> unit
    val translatedv : vec3d -> unit
    val translatef  : (float * float * float) -> unit
    val translatefv : vec3f -> unit

  (* buffer operations operation *)
    datatype buffer_bit
      = COLOR_BUFFER_BIT
      | DEPTH_BUFFER_BIT
      | ACCUM_BUFFER_BIT
      | STENCIL_BUFFER_BIT
    val clear : buffer_bit list -> unit
    val clearColor : color4f -> unit
    val clearDepth : double -> unit
    val clearAccum : color4f -> unit
    val clearStencil : int -> unit
(*
    datatype draw_buffer
      = NO_BUFFER
      | FRONT | FRONT_LEFT | FRONT_RIGHT
      | BACK | BACK_LEFT | BACK_RIGHT
      | FRONT_AND_BACK | LEFT | RIGHT
      | AUX of int
    val drawBuffer : draw_buffer -> unit
    val getDrawBuffer : unit -> draw_buffer
*)
    val depthMask : bool -> unit

  (* lighting controls *)
    val smoothShading : bool -> unit	(* glShadeModel: true => SMOOTH; false => FLAT *)
    val ambientLight : color4f -> unit		(* glLightModel(GL_AMBIENT, _) *)
    val shininess : (face * float) -> unit	(* glMaterialf(_, GL_SHININESS, _) *)
    val material : (face * material_param * color4f) -> unit
  (* lights --- OpenGL requires that there be at least 8 lights *)
    eqtype light
    val light0 : light
    val light1 : light
    val light2 : light
    val light3 : light
    val light4 : light
    val light5 : light
    val light6 : light
    val light7 : light
    val light : int -> light
  (* turn a light on/off *)
    val enableLight : light -> unit
    val disableLight : light -> unit
  (* configure a light *)
    val lightPosition : (light * vec4f) -> unit
    val lightSpotDirection : (light * vec3f) -> unit
    val lightSpotCutoff : (light * float) -> unit
    val lightSpotExponent : (light * float) -> unit
    val lightConstantAttenuation : (light * float) -> unit
    val lightLinearAttenuation : (light * float) -> unit
    val lightQuadraticAttenuation : (light * float) -> unit
  (* higher-level light configuration *)
    val directionLight : (light * vec3f) -> unit
    val pointLight : (light * vec3f) -> unit
    val spotLight : (light * {pos : vec3f, dir : vec3f, cutoff : float, exp : float}) -> unit
  (* set the radiance of a light *)
    val lightAmbient : (light * color4f) -> unit
    val lightDiffuse : (light * color4f) -> unit
    val lightSpecular : (light * color4f) -> unit

    val lightModelAmbient : color4f -> unit
    datatype color_control = SINGLE_COLOR | SEPARATE_SPECULAR_COLOR
    val lightModelColorControl : color_control -> unit
    val lightModelLocalViewer : bool -> unit
    val lightModelTwoSide : bool -> unit

(* NOTE: perhaps blending should be in its own substructure?  Also, we have
 * a datatype for the blend_equation that carried the blend_funcs as arguments.
 * then we would only need one API call.
 *)
   (* blending *)
    eqtype blend_func
    val ZERO: blend_func
    val ONE: blend_func
    val SRC_COLOR: blend_func		(* dst only *)
    val ONE_MINUS_SRC_COLOR: blend_func	(* dst only *)
    val SRC_ALPHA: blend_func
    val ONE_MINUS_SRC_ALPHA: blend_func
    val DST_ALPHA: blend_func
    val ONE_MINUS_DST_ALPHA: blend_func
    val DST_COLOR: blend_func		(* src only *)
    val ONE_MINUS_DST_COLOR: blend_func	(* src only *)
    val SRC_ALPHA_SATURATE: blend_func	(* src only *)
    eqtype blend_equation
    val MIN: blend_equation
    val MAX: blend_equation
    val FUNC_ADD: blend_equation
    val FUNC_SUBTRACT: blend_equation
    val FUNC_REVERSE_SUBTRACT: blend_equation
    val blendColor : color4f -> unit
    val blendEquation : blend_equation -> unit
    val blendFunc : {src : blend_func, dst : blend_func} -> unit

   (* misc. state changes *)
    val cullFace : face -> unit

  (* Polygon render modes *)
    eqtype polygon_mode
    val POINT : polygon_mode
    val LINE : polygon_mode
    val FILL : polygon_mode
    val polygonMode : (face * polygon_mode) -> unit

   (* render primitives *)
    eqtype primitive
    val POINTS : primitive
    val LINES : primitive
    val LINE_LOOP : primitive
    val LINE_STRIP : primitive
    val TRIANGLES : primitive
    val TRIANGLE_STRIP : primitive
    val TRIANGLE_FAN : primitive
    val QUADS : primitive
    val QUAD_STRIP : primitive
    val POLYGON : primitive

  (* begin/end rendering *)
    val beginPrim : primitive -> unit
    val endPrim : unit -> unit
    val renderPrim : (primitive * (unit -> unit)) -> unit
    val finish : unit -> unit
    val flush : unit -> unit

  (* primitive commands *)
    val vertex2d    : (double * double) -> unit
    val vertex2dv   : vec2d -> unit
    val vertex2f    : (float * float) -> unit
    val vertex2fv   : vec2f -> unit
    val vertex3d    : (double * double * double) -> unit
    val vertex3dv   : vec3d -> unit
    val vertex3f    : (float * float * float) -> unit
    val vertex3fv   : vec3f -> unit
    val vertex4d    : (double * double * double * double) -> unit
    val vertex4dv   : vec4d -> unit
    val vertex4f    : (float * float * float * float) -> unit
    val vertex4fv   : vec4f -> unit
    val normal3d    : (double * double * double) -> unit
    val normal3dv   : vec3d -> unit
    val normal3f    : (float * float * float) -> unit
    val normal3fv   : vec3f -> unit
    val color3f     : (float * float * float) -> unit
    val color3fv    : color3f -> unit
    val color3ub    : (ubyte * ubyte * ubyte) -> unit
    val color3ubv   : color3ub -> unit
    val color4f     : (float * float * float * float) -> unit
    val color4fv    : color4f -> unit
    val color4ub    : (ubyte * ubyte * ubyte * ubyte) -> unit
    val color4ubv   : color4ub -> unit
    val texCoord1d  : double -> unit
    val texCoord1f  : float -> unit
    val texCoord2d  : (double * double) -> unit
    val texCoord2dv : tex2d -> unit
    val texCoord2f  : (float * float) -> unit
    val texCoord2fv : tex2f -> unit
    val texCoord3d  : (double * double * double) -> unit
    val texCoord3dv : tex3d -> unit
    val texCoord3f  : (float * float * float) -> unit
    val texCoord3fv : tex3f -> unit
    val texCoord4d  : (double * double * double * double) -> unit
    val texCoord4dv : tex4d -> unit
    val texCoord4f  : (float * float * float * float) -> unit
    val texCoord4fv : tex4f -> unit

  (* display lists *)
    eqtype display_list
    val newList : {list : display_list, exec : bool} -> unit
    val endList : unit -> unit
    val genList : unit -> display_list
    val genLists : int -> display_list list
    val callList : display_list -> unit

  (* raster operations *)
    val rasterPos2s  : (short * short) -> unit
    val rasterPos2sv : short vec2 -> unit
    val rasterPos2i  : (int * int) -> unit
    val rasterPos2iv : int vec2 -> unit
    val rasterPos2f  : (float * float) -> unit
    val rasterPos2fv : vec2f -> unit
    val rasterPos2d  : (double * double) -> unit
    val rasterPos2dv : vec2d -> unit
    val rasterPos3s  : (short * short * short) -> unit
    val rasterPos3sv : short vec3 -> unit
    val rasterPos3i  : (int * int * int) -> unit
    val rasterPos3iv : int vec3 -> unit
    val rasterPos3f  : (float * float * float) -> unit
    val rasterPos3fv : vec3f -> unit
    val rasterPos3d  : (double * double * double) -> unit
    val rasterPos3dv : vec3d -> unit
    val rasterPos4s  : (short * short * short * short) -> unit
    val rasterPos4sv : short vec4 -> unit
    val rasterPos4i  : (int * int * int * int) -> unit
    val rasterPos4iv : int vec4 -> unit
    val rasterPos4f  : (float * float * float * float) -> unit
    val rasterPos4fv : vec4f -> unit
    val rasterPos4d  : (double * double * double * double) -> unit
    val rasterPos4dv : vec4d -> unit

    val getCurrentRasterColorf : unit -> color4f
    val getCurrentRasterDistance : unit -> float
    val getCurrentRasterPosition : unit -> vec4f
    val isCurrentRasterPositionValid : unit -> bool
    val getCurrentRasterTextureCoords : unit -> tex4f

  (* information about the renderer *)
    val getVendorString : unit -> string
    val getRendererString : unit -> string
    val getVersionString : unit -> string
    val getExtensionsString : unit -> string
    val getExtensions : unit -> string list

  end

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0