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

SCM Repository

[sml3d] View of /trunk/sml3d/src/sml3d/gl3/raster-sig.sml
ViewVC logotype

View of /trunk/sml3d/src/sml3d/gl3/raster-sig.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1389 - (download) (annotate)
Sun Apr 6 02:28:36 2014 UTC (5 years, 5 months ago) by jhr
File size: 6564 byte(s)
  Working on OpenGL 3.2 support
(* raster-sig.sml
 *
 * COPYRIGHT (c) 2011 The SML3d Project (http://sml3d.cs.uchicago.edu)
 * All rights reserved.
 *
 * This interface covers the Rasterization and the Reading, and Copying Pixels part of the
 * OpenGL 3.2 API (Sections 3, 4.3.1, and 4.3.2).
 *)

(* QUESTION: what is the relationship between this stuff an RENDER_CTL? *)
signature GL_RASTER =
  sig

  (* enable/disable dicarding of primitives before rasterization.  When enabled, all primitives
   * are discarded before they reach the rasterizer.
   *)
    val enableRasterizerDiscard : bool -> unit

  (* Enable/disable the multisample state.  If enabled, use multiple fragment samples
   * in computing the final color of a pixel.
   *)
    val enableMultisample : bool -> unit

  (* Retrieve the location of a sample *)
    val getSamplePosition : SML3dTypes.uint -> SML3dTypes.vec2f

  (* Enable/disable the program point size state.  If enabled and a vertex or geometry
   * shader is active, then the derived point size is taken from the (potentially
   * clipped) shader builtin gl_PointSize and clamped to the implementation-dependent
   * point size range.
   *)
    val enableProgramPointSize : bool -> unit

  (* Specify the diameter of rasterized points (default 1.0). *)
    val pointSize : Float.t -> unit

  (* Specify the threshold value to which point sizes are clamped if they exceed the
   * specified value (default 1.0).
   *)
    val pointFadeThresholdSize : Float.t -> unit

  (* Values for specifying the point-sprite texture-coordinate origin *)
    eqtype sprite_origin
    val LOWER_LEFT : sprite_origin
    val UPPER_LEFT : sprite_origin	(* default *)

  (* Specify the point sprite texture coordinate origin (default UPPER_LEFT) *)
    val pointSpriteOrigin : sprite_origin -> unit

  (* Specify the width of rasterized lines (default 1.0) *)
    val lineWidth : Float.t -> unit

  (* Enable/disable line smoothing.  If enabled, draw lines with correct filtering,
   * otherwise draw aliased lines.
   *)
    val enableLineSmooth : bool -> unit

  (* Values for specifying culling faces *)
    eqtype face
    val FRONT : face    (* front face *)
    val BACK : face     (* back face *)
    val BOTH : face	(* both front and back faces *)

  (* Specifies whether front- or back-facing facets are candidates for culling, when
   * culling is enabled (default BACK).
   *)
    val cullFace : face -> unit

  (* Values for specifying which face is the front of a polygon *)
    eqtype winding
    val CCW : winding	(* counter-clockwise winding (default) *)
    val CW : winding	(* clockwise winding *)

  (* Specifies the orientation of front-facing polygons (default CCW) *)
    val frontFace : winding -> unit

  (* Enable/disable polygon culling.  If enabled, cull polygons based on their
   * winding in window coordinates.
   *)
    val enableCullFace : bool -> unit

  (* Polygon render modes *)
    eqtype polygon_mode
    val POINT : polygon_mode    (* vertices are rendered as points *)
    val LINE : polygon_mode     (* edges are rendered as lines (i.e., wirefame) *)
    val FILL : polygon_mode     (* polygons are filled *)
 
  (* Specify the rasterization mode for polygons *)
    val polygonMode : polygon_mode -> unit

  (* set the scale and units used to calculate depth values *)
    val polygonOffset : {factor : Float.t, units : Float.t} -> unit

(* TODO: pixelStore operations *)

  (* Values for specifying the color clamp mode for readPixels *)
    eqtype read_clamp_mode
    val NO_CLAMP : read_clamp_mode
    val CLAMP : read_clamp_mode
    val CLAMP_FIXED_ONLY : read_clamp_mode

  (* Specify the clamping mode for readPixels *)
    val clampReadColor : read_clamp_mode -> unit

    type 'nchan fmt             (* format of pixel data; type parameter specifies number of
                                 * channels *)
    type ('nchan, 'ty) ty       (* type of pixel data; type parameters specify number of channels and
                                 * client-side type of buffer/image elements *) 
  
  (* type constants for channels *)
    type one_chan
    type two_chan
    type rgb_chan
    type rgba_chan
  
  (* format specifiers *)
    val STENCIL_INDEX   : one_chan fmt
    val DEPTH_COMPONENT : one_chan fmt
    val DEPTH_STENCIL   : two_chan fmt
    val RED             : one_chan fmt
    val GREEN           : one_chan fmt
    val BLUE            : one_chan fmt
    val RGB             : rgb_chan fmt
    val BGR             : rgb_chan fmt
    val RGBA            : rgba_chan fmt
    val BGRA            : rgba_chan fmt
  
  (* type specifiers [see OpenGL 3.2; Table 3.5] *)
    val UNSIGNED_BYTE       : (one_chan, SML3dTypes.ubyte) ty
    val BYTE                : (one_chan, SML3dTypes.byte) ty
    val UNSIGNED_SHORT      : (one_chan, SML3dTypes.ushort) ty
    val SHORT               : (one_chan, SML3dTypes.short) ty
    val UNSIGNED_INT        : (one_chan, SML3dTypes.uint) ty
    val INT                 : (one_chan, SML3dTypes.int) ty
    val HALF_FLOAT          : (one_chan, SML3dTypes.ushort) ty
    val FLOAT               : (one_chan, Float.t) ty
  
    val UNSIGNED_BYTE_3_3_2	        : (rgb_chan, SML3dTypes.ubyte) ty
    val UNSIGNED_BYTE_2_3_3_REV         : (rgb_chan, SML3dTypes.ubyte) ty
    val UNSIGNED_SHORT_5_6_5            : (rgb_chan, SML3dTypes.ushort) ty
    val UNSIGNED_SHORT_5_6_5_REV	: (rgb_chan, SML3dTypes.ushort) ty
  
    val UNSIGNED_SHORT_4_4_4_4	        : (rgba_chan, SML3dTypes.ushort) ty
    val UNSIGNED_SHORT_4_4_4_4_REV      : (rgba_chan, SML3dTypes.ushort) ty
    val UNSIGNED_SHORT_5_5_5_1	        : (rgba_chan, SML3dTypes.ushort) ty
    val UNSIGNED_SHORT_1_5_5_5_REV      : (rgba_chan, SML3dTypes.ushort) ty
    val UNSIGNED_INT_8_8_8_8	        : (rgba_chan, SML3dTypes.ubyte SML3dTypes.vec4) ty
    val UNSIGNED_INT_8_8_8_8_REV        : (rgba_chan, SML3dTypes.ubyte SML3dTypes.vec4) ty
    val UNSIGNED_INT_10_10_10_2         : (rgba_chan, SML3dTypes.uint) ty
    val UNSIGNED_INT_2_10_10_10_REV     : (rgba_chan, SML3dTypes.uint) ty
    val UNSIGNED_INT_10F_11F_11F_REV    : (rgba_chan, SML3dTypes.uint) ty
    val UNSIGNED_INT_5_9_9_9_REV        : (rgba_chan, SML3dTypes.uint) ty
    
    val UNSIGNED_INT_24_8               : (two_chan, SML3dTypes.uint) ty
    (* this is a float * int24 * int8 *)
    val FLOAT_32_UNSIGNED_INT_24_8_REV	: (two_chan, SML3dTypes.uint * SML3dTypes.uint) ty

  (* readPixels, etc. *)
    val readPixels : {
            x : int, y : int, wid : int, ht : int,
            fmt : 'nc fmt, ty : ('nc, 'rep) ty
          } -> 'rep Image.image2D

  end

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