%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 2008-2010. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
%%
%% %CopyrightEnd%
%% OPENGL UTILITY API
%% This file is generated DO NOT EDIT
%% @doc A part of the standard OpenGL Utility api.
%% See www.opengl.org
%%
%% Booleans are represented by integers 0 and 1.
%% @type mem(). memory block
%% @type enum(). An integer defined in gl.hrl
%% @type offset(). An integer which is an offset in an array
%% @type clamp(). A float clamped between 0.0 - 1.0
-module(glu).
-compile(inline).
-define(GLenum,32/native-unsigned).
-define(GLboolean,8/native-unsigned).
-define(GLbitfield,32/native-unsigned).
-define(GLbyte,8/native-signed).
-define(GLshort,16/native-signed).
-define(GLint,32/native-signed).
-define(GLubyte,8/native-unsigned).
-define(GLushort,16/native-unsigned).
-define(GLuint,32/native-unsigned).
-define(GLsizei,32/native-signed).
-define(GLfloat,32/native-float).
-define(GLclampf,32/native-float).
-define(GLdouble,64/native-float).
-define(GLclampd,64/native-float).
-define(GLsizeiptr,64/native-unsigned).
-define(GLintptr,64/native-unsigned).
-define(GLUquadric,64/native-unsigned).
-define(GLhandleARB,64/native-unsigned).
-type enum() :: non_neg_integer().
-type mem() :: binary() | tuple().
-export([tesselate/2,build1DMipmapLevels/9,build1DMipmaps/6,build2DMipmapLevels/10,
build2DMipmaps/7,build3DMipmapLevels/11,build3DMipmaps/8,checkExtension/2,
cylinder/6,deleteQuadric/1,disk/5,errorString/1,getString/1,lookAt/9,
newQuadric/0,ortho2D/4,partialDisk/7,perspective/4,pickMatrix/5,project/6,
quadricDrawStyle/2,quadricNormals/2,quadricOrientation/2,quadricTexture/2,
scaleImage/9,sphere/4,unProject/6,unProject4/9]).
-import(gl, [call/2,cast/2,send_bin/1]).
%% API
%% @spec (Vec3, [Vec3]) -> {Triangles, VertexPos}
%% Vec3 = {float(),float(),float()}
%% Triangles = [VertexIndex::integer()]
%% VertexPos = binary()
%% @doc General purpose polygon triangulation.
%% The first argument is the normal and the second a list of
%% vertex positions. Returned is a list of indecies of the vertices
%% and a binary (64bit native float) containing an array of
%% vertex positions, it starts with the vertices in Vs and
%% may contain newly created vertices in the end.
tesselate({Nx,Ny,Nz}, Vs) ->
call(5000, <<(length(Vs)):32/native,0:32,
Nx:?GLdouble,Ny:?GLdouble,Nz:?GLdouble,
(<< <>
|| {Vx,Vy,Vz} <- Vs>>)/binary >>).
%% @spec (Target::enum(),InternalFormat::integer(),Width::integer(),Format::enum(),Type::enum(),Level::integer(),Base::integer(),Max::integer(),Data::binary()) -> integer()
%% @doc See external documentation.
-spec build1DMipmapLevels(enum(),integer(),integer(),enum(),enum(),integer(),integer(),integer(),binary()) -> integer().
build1DMipmapLevels(Target,InternalFormat,Width,Format,Type,Level,Base,Max,Data) ->
send_bin(Data),
call(5010, <>).
%% @spec (Target::enum(),InternalFormat::integer(),Width::integer(),Format::enum(),Type::enum(),Data::binary()) -> integer()
%% @doc See external documentation.
-spec build1DMipmaps(enum(),integer(),integer(),enum(),enum(),binary()) -> integer().
build1DMipmaps(Target,InternalFormat,Width,Format,Type,Data) ->
send_bin(Data),
call(5011, <>).
%% @spec (Target::enum(),InternalFormat::integer(),Width::integer(),Height::integer(),Format::enum(),Type::enum(),Level::integer(),Base::integer(),Max::integer(),Data::binary()) -> integer()
%% @doc See external documentation.
-spec build2DMipmapLevels(enum(),integer(),integer(),integer(),enum(),enum(),integer(),integer(),integer(),binary()) -> integer().
build2DMipmapLevels(Target,InternalFormat,Width,Height,Format,Type,Level,Base,Max,Data) ->
send_bin(Data),
call(5012, <>).
%% @spec (Target::enum(),InternalFormat::integer(),Width::integer(),Height::integer(),Format::enum(),Type::enum(),Data::binary()) -> integer()
%% @doc See external documentation.
-spec build2DMipmaps(enum(),integer(),integer(),integer(),enum(),enum(),binary()) -> integer().
build2DMipmaps(Target,InternalFormat,Width,Height,Format,Type,Data) ->
send_bin(Data),
call(5013, <>).
%% @spec (Target::enum(),InternalFormat::integer(),Width::integer(),Height::integer(),Depth::integer(),Format::enum(),Type::enum(),Level::integer(),Base::integer(),Max::integer(),Data::binary()) -> integer()
%% @doc See external documentation.
-spec build3DMipmapLevels(enum(),integer(),integer(),integer(),integer(),enum(),enum(),integer(),integer(),integer(),binary()) -> integer().
build3DMipmapLevels(Target,InternalFormat,Width,Height,Depth,Format,Type,Level,Base,Max,Data) ->
send_bin(Data),
call(5014, <>).
%% @spec (Target::enum(),InternalFormat::integer(),Width::integer(),Height::integer(),Depth::integer(),Format::enum(),Type::enum(),Data::binary()) -> integer()
%% @doc See external documentation.
-spec build3DMipmaps(enum(),integer(),integer(),integer(),integer(),enum(),enum(),binary()) -> integer().
build3DMipmaps(Target,InternalFormat,Width,Height,Depth,Format,Type,Data) ->
send_bin(Data),
call(5015, <>).
%% @spec (ExtName::[integer()],ExtString::[integer()]) -> 0|1
%% @doc See external documentation.
-spec checkExtension([integer()],[integer()]) -> 0|1.
checkExtension(ExtName,ExtString) ->
call(5016, <<(length(ExtName)):?GLuint,
(<< <> || C <- ExtName>>)/binary,0:((8-((length(ExtName)+ 4) rem 8)) rem 8),(length(ExtString)):?GLuint,
(<< <> || C <- ExtString>>)/binary,0:((8-((length(ExtString)+ 4) rem 8)) rem 8)>>).
%% @spec (Quad::integer(),Base::float(),Top::float(),Height::float(),Slices::integer(),Stacks::integer()) -> ok
%% @doc See external documentation.
-spec cylinder(integer(),float(),float(),float(),integer(),integer()) -> ok.
cylinder(Quad,Base,Top,Height,Slices,Stacks) ->
cast(5017, <>).
%% @spec (Quad::integer()) -> ok
%% @doc See external documentation.
-spec deleteQuadric(integer()) -> ok.
deleteQuadric(Quad) ->
cast(5018, <>).
%% @spec (Quad::integer(),Inner::float(),Outer::float(),Slices::integer(),Loops::integer()) -> ok
%% @doc See external documentation.
-spec disk(integer(),float(),float(),integer(),integer()) -> ok.
disk(Quad,Inner,Outer,Slices,Loops) ->
cast(5019, <>).
%% @spec (Error::enum()) -> string()
%% @doc See external documentation.
-spec errorString(enum()) -> string().
errorString(Error) ->
call(5020, <>).
%% @spec (Name::enum()) -> string()
%% @doc See external documentation.
-spec getString(enum()) -> string().
getString(Name) ->
call(5021, <>).
%% @spec (EyeX::float(),EyeY::float(),EyeZ::float(),CenterX::float(),CenterY::float(),CenterZ::float(),UpX::float(),UpY::float(),UpZ::float()) -> ok
%% @doc See external documentation.
-spec lookAt(float(),float(),float(),float(),float(),float(),float(),float(),float()) -> ok.
lookAt(EyeX,EyeY,EyeZ,CenterX,CenterY,CenterZ,UpX,UpY,UpZ) ->
cast(5022, <>).
%% @spec () -> integer()
%% @doc See external documentation.
-spec newQuadric() -> integer().
newQuadric() ->
call(5023, <<>>).
%% @spec (Left::float(),Right::float(),Bottom::float(),Top::float()) -> ok
%% @doc See external documentation.
-spec ortho2D(float(),float(),float(),float()) -> ok.
ortho2D(Left,Right,Bottom,Top) ->
cast(5024, <>).
%% @spec (Quad::integer(),Inner::float(),Outer::float(),Slices::integer(),Loops::integer(),Start::float(),Sweep::float()) -> ok
%% @doc See external documentation.
-spec partialDisk(integer(),float(),float(),integer(),integer(),float(),float()) -> ok.
partialDisk(Quad,Inner,Outer,Slices,Loops,Start,Sweep) ->
cast(5025, <>).
%% @spec (Fovy::float(),Aspect::float(),ZNear::float(),ZFar::float()) -> ok
%% @doc See external documentation.
-spec perspective(float(),float(),float(),float()) -> ok.
perspective(Fovy,Aspect,ZNear,ZFar) ->
cast(5026, <>).
%% @spec (X::float(),Y::float(),DelX::float(),DelY::float(),Viewport::{integer(),integer(),integer(),integer()}) -> ok
%% @doc See external documentation.
-spec pickMatrix(float(),float(),float(),float(),{integer(),integer(),integer(),integer()}) -> ok.
pickMatrix(X,Y,DelX,DelY,{V1,V2,V3,V4}) ->
cast(5027, <>).
%% @spec (ObjX::float(),ObjY::float(),ObjZ::float(),Model::{float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float()},Proj::{float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float()},View::{integer(),integer(),integer(),integer()}) -> {integer(),WinX::float(),WinY::float(),WinZ::float()}
%% @doc See external documentation.
-spec project(float(),float(),float(),{float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float()},{float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float()},{integer(),integer(),integer(),integer()}) -> {integer(),float(),float(),float()}.
project(ObjX,ObjY,ObjZ,{M1,M2,M3,M4,M5,M6,M7,M8,M9,M10,M11,M12,M13,M14,M15,M16},{P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16},{V1,V2,V3,V4}) ->
call(5028, <>);
project(ObjX,ObjY,ObjZ,{M1,M2,M3,M4,M5,M6,M7,M8,M9,M10,M11,M12},{P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12},{V1,V2,V3,V4}) ->
call(5028, <>).
%% @spec (Quad::integer(),Draw::enum()) -> ok
%% @doc See external documentation.
-spec quadricDrawStyle(integer(),enum()) -> ok.
quadricDrawStyle(Quad,Draw) ->
cast(5029, <>).
%% @spec (Quad::integer(),Normal::enum()) -> ok
%% @doc See external documentation.
-spec quadricNormals(integer(),enum()) -> ok.
quadricNormals(Quad,Normal) ->
cast(5030, <>).
%% @spec (Quad::integer(),Orientation::enum()) -> ok
%% @doc See external documentation.
-spec quadricOrientation(integer(),enum()) -> ok.
quadricOrientation(Quad,Orientation) ->
cast(5031, <>).
%% @spec (Quad::integer(),Texture::0|1) -> ok
%% @doc See external documentation.
-spec quadricTexture(integer(),0|1) -> ok.
quadricTexture(Quad,Texture) ->
cast(5032, <>).
%% @spec (Format::enum(),WIn::integer(),HIn::integer(),TypeIn::enum(),DataIn::binary(),WOut::integer(),HOut::integer(),TypeOut::enum(),DataOut::mem()) -> integer()
%% @doc See external documentation.
-spec scaleImage(enum(),integer(),integer(),enum(),binary(),integer(),integer(),enum(),mem()) -> integer().
scaleImage(Format,WIn,HIn,TypeIn,DataIn,WOut,HOut,TypeOut,DataOut) ->
send_bin(DataIn),
send_bin(DataOut),
call(5033, <>).
%% @spec (Quad::integer(),Radius::float(),Slices::integer(),Stacks::integer()) -> ok
%% @doc See external documentation.
-spec sphere(integer(),float(),integer(),integer()) -> ok.
sphere(Quad,Radius,Slices,Stacks) ->
cast(5034, <>).
%% @spec (WinX::float(),WinY::float(),WinZ::float(),Model::{float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float()},Proj::{float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float()},View::{integer(),integer(),integer(),integer()}) -> {integer(),ObjX::float(),ObjY::float(),ObjZ::float()}
%% @doc See external documentation.
-spec unProject(float(),float(),float(),{float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float()},{float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float()},{integer(),integer(),integer(),integer()}) -> {integer(),float(),float(),float()}.
unProject(WinX,WinY,WinZ,{M1,M2,M3,M4,M5,M6,M7,M8,M9,M10,M11,M12,M13,M14,M15,M16},{P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16},{V1,V2,V3,V4}) ->
call(5035, <>);
unProject(WinX,WinY,WinZ,{M1,M2,M3,M4,M5,M6,M7,M8,M9,M10,M11,M12},{P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12},{V1,V2,V3,V4}) ->
call(5035, <>).
%% @spec (WinX::float(),WinY::float(),WinZ::float(),ClipW::float(),Model::{float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float()},Proj::{float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float()},View::{integer(),integer(),integer(),integer()},NearVal::float(),FarVal::float()) -> {integer(),ObjX::float(),ObjY::float(),ObjZ::float(),ObjW::float()}
%% @doc See external documentation.
-spec unProject4(float(),float(),float(),float(),{float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float()},{float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float(),float()},{integer(),integer(),integer(),integer()},float(),float()) -> {integer(),float(),float(),float(),float()}.
unProject4(WinX,WinY,WinZ,ClipW,{M1,M2,M3,M4,M5,M6,M7,M8,M9,M10,M11,M12,M13,M14,M15,M16},{P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16},{V1,V2,V3,V4},NearVal,FarVal) ->
call(5036, <>);
unProject4(WinX,WinY,WinZ,ClipW,{M1,M2,M3,M4,M5,M6,M7,M8,M9,M10,M11,M12},{P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12},{V1,V2,V3,V4},NearVal,FarVal) ->
call(5036, <>).