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/vertex-sig.sml
ViewVC logotype

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1414 - (download) (annotate)
Mon Apr 14 22:49:17 2014 UTC (4 years, 2 months ago) by jhr
File size: 6695 byte(s)
  Vertex attributes for OpenGL 3.2 core
(* vertex-sig.sml
 *
 * COPYRIGHT (c) 2013 The SML3d Project (http://sml3d.cs.uchicago.edu)
 * All rights reserved.
 *
 * This interface covers the Vertex Specification and Vertes Array parts of the OpenGL 3.2
 * API (Sections 2.7 and 2.8 ofthe OpenGL 3.2 Core Specification).  Note that the interface
 * to drawing commands is specified in the GL_DRAW signature.
 *)

signature GL_VERTEX =
  sig

  (* attribute locations *)
    eqtype attrib

  (* attribute locations can be specified as numeric values (corresponding to "layout"
   * location specifications in shader programs).  These functions convert between the
   * abstract type and the concrete numeric representation.
   *)
    val fromWord : word -> attrib
    val toWord : attrib -> word

    val maxVertexAttribs : unit -> int

  (***** Vertex specification *****)

  (* specifying individual attributes [glVertexAttrib] *)
    val attrib1s   : attrib * SML3dTypes.short -> unit
    val attrib1f   : attrib * SML3dTypes.float -> unit
    val attrib1d   : attrib * SML3dTypes.double -> unit
    val attribI1i  : attrib * SML3dTypes.int -> unit
    val attribI1ui : attrib * SML3dTypes.uint -> unit
    val attrib2s   : attrib * SML3dTypes.short * SML3dTypes.short -> unit
    val attrib2f   : attrib * SML3dTypes.float * SML3dTypes.float -> unit
    val attrib2d   : attrib * SML3dTypes.double * SML3dTypes.double -> unit
    val attribI2i  : attrib * SML3dTypes.int * SML3dTypes.int -> unit
    val attribI2ui : attrib * SML3dTypes.uint * SML3dTypes.uint -> unit
    val attrib3s   : attrib * SML3dTypes.short * SML3dTypes.short * SML3dTypes.short -> unit
    val attrib3f   : attrib * SML3dTypes.float * SML3dTypes.float * SML3dTypes.float -> unit
    val attrib3d   : attrib * SML3dTypes.double * SML3dTypes.double * SML3dTypes.double -> unit
    val attribI3i  : attrib * SML3dTypes.int * SML3dTypes.int * SML3dTypes.int -> unit
    val attribI3ui : attrib * SML3dTypes.uint * SML3dTypes.uint * SML3dTypes.uint -> unit
    val attrib4s   : attrib * SML3dTypes.short * SML3dTypes.short * SML3dTypes.short * SML3dTypes.short -> unit
    val attrib4f   : attrib * SML3dTypes.float * SML3dTypes.float * SML3dTypes.float * SML3dTypes.float -> unit
    val attrib4d   : attrib * SML3dTypes.double * SML3dTypes.double * SML3dTypes.double * SML3dTypes.double -> unit
    val attribN4ub : attrib * SML3dTypes.ubyte * SML3dTypes.ubyte * SML3dTypes.ubyte * SML3dTypes.ubyte -> unit
    val attribI4i  : attrib * SML3dTypes.int * SML3dTypes.int * SML3dTypes.int * SML3dTypes.int -> unit
    val attribI4ui : attrib * SML3dTypes.uint * SML3dTypes.uint * SML3dTypes.uint * SML3dTypes.uint -> unit

(* packed attribute values were introduced in Open GL 3.3
    eqtype packing
    val INT_10_10_10_2 : packing
    val UNSIGNED_INT_10_10_10_2 : packing

    val attribP1ui : attrib * packing * bool * uint -> unit
    val attribP2ui : attrib * packing * bool * uint -> unit
    val attribP3ui : attrib * packing * bool * uint -> unit
    val attribP4ui : attrib * packing * bool * uint -> unit
*)

  (***** Vertex arrays *****)

  (* attribute arity phantom types *)
    type one
    type two
    type three
    type four
    type bgra

(* packed attribute values were introduced in Open GL 3.3
    type int_2_10_10_10_rev
    type uint_2_10_10_10_rev
*)

    type ('arity, 'ty) attrib_fmt	(* floating-point attributes *)
    type ('arity, 'ty) int_attrib_fmt	(* integer attributes *)

  (* attribute array formats *)
    val array1b  : (one, SML3dTypes.byte) int_attrib_fmt
    val array1ub : (one, SML3dTypes.ubyte) int_attrib_fmt
    val array1s  : (one, SML3dTypes.short) int_attrib_fmt
    val array1us : (one, SML3dTypes.ushort) int_attrib_fmt
    val array1i  : (one, SML3dTypes.int) int_attrib_fmt
    val array1ui : (one, SML3dTypes.uint) int_attrib_fmt
    val array1h  : (one, SML3dTypes.half) attrib_fmt
    val array1f  : (one, SML3dTypes.float) attrib_fmt
    val array1d  : (one, SML3dTypes.double) attrib_fmt

    val array2b  : (two, SML3dTypes.byte) int_attrib_fmt
    val array2ub : (two, SML3dTypes.ubyte) int_attrib_fmt
    val array2s  : (two, SML3dTypes.short) int_attrib_fmt
    val array2us : (two, SML3dTypes.ushort) int_attrib_fmt
    val array2i  : (two, SML3dTypes.int) int_attrib_fmt
    val array2ui : (two, SML3dTypes.uint) int_attrib_fmt
    val array2h  : (two, SML3dTypes.half) attrib_fmt
    val array2f  : (two, SML3dTypes.float) attrib_fmt
    val array2d  : (two, SML3dTypes.double) attrib_fmt

    val array3b  : (three, SML3dTypes.byte) int_attrib_fmt
    val array3ub : (three, SML3dTypes.ubyte) int_attrib_fmt
    val array3s  : (three, SML3dTypes.short) int_attrib_fmt
    val array3us : (three, SML3dTypes.ushort) int_attrib_fmt
    val array3i  : (three, SML3dTypes.int) int_attrib_fmt
    val array3ui : (three, SML3dTypes.uint) int_attrib_fmt
    val array3h  : (three, SML3dTypes.half) attrib_fmt
    val array3f  : (three, SML3dTypes.float) attrib_fmt
    val array3d  : (three, SML3dTypes.double) attrib_fmt

    val array4b  : (four, SML3dTypes.byte) int_attrib_fmt
    val array4ub : (four, SML3dTypes.ubyte) int_attrib_fmt
    val array4s  : (four, SML3dTypes.short) int_attrib_fmt
    val array4us : (four, SML3dTypes.ushort) int_attrib_fmt
    val array4i  : (four, SML3dTypes.int) int_attrib_fmt
    val array4ui : (four, SML3dTypes.uint) int_attrib_fmt
    val array4h  : (four, SML3dTypes.half) attrib_fmt
    val array4f  : (four, SML3dTypes.float) attrib_fmt
    val array4d  : (four, SML3dTypes.double) attrib_fmt

  (* arrays with reverse-order components *)
    val arrayBGRAub : (bgra, SML3dTypes.ubyte) int_attrib_fmt
(* packed attribute values were introduced in Open GL 3.3
    val arrayBGRApi : (bgra, int_2_10_10_10_rev) attrib_fmt
    val arrayBGRApui : (bgra, uint_2_10_10_10_rev) attrib_fmt
*)

  (* specifying floating-point attributes.  The bool argument specifies whether integer arguments
   * should be mapped to a normalized range ([-1..1] for signed values and [0..1] for unsigned).
   *)
    val attribFltArray : attrib * ('arity, 'ty) attrib_fmt -> unit
    val attribArray : attrib * bool * ('arity, 'ty) int_attrib_fmt -> unit
    val attribIntArray : attrib * ('arity, 'ty) int_attrib_fmt -> unit

  (* like the previous three functions, but with stride and offset info too *)
    val attribFltArray' : attrib * ('arity, 'ty) attrib_fmt * GLsizei.int * C_Ptrdiff.t -> unit
    val attribArray' : attrib * bool * ('arity, 'ty) int_attrib_fmt * GLsizei.int * C_Ptrdiff.t -> unit
    val attribIntArray' : attrib * ('arity, 'ty) int_attrib_fmt * GLsizei.int * C_Ptrdiff.t -> unit

    val enableArray : attrib -> unit
    val disableArray : attrib -> unit

  end

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