%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 2008-2009. 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 wx_mem(). see wx.erl on memory allocation functions
%% @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).
-include("wxe.hrl").
-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).
-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]).
%% 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) ->
wxe_util: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.
build1DMipmapLevels(Target,InternalFormat,Width,Format,Type,Level,Base,Max,Data) ->
wxe_util:send_bin(Data),
wxe_util:call(5010, <>).
%% @spec (Target::enum(),InternalFormat::integer(),Width::integer(),Format::enum(),Type::enum(),Data::binary()) -> integer()
%% @doc See external documentation.
build1DMipmaps(Target,InternalFormat,Width,Format,Type,Data) ->
wxe_util:send_bin(Data),
wxe_util: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.
build2DMipmapLevels(Target,InternalFormat,Width,Height,Format,Type,Level,Base,Max,Data) ->
wxe_util:send_bin(Data),
wxe_util:call(5012, <>).
%% @spec (Target::enum(),InternalFormat::integer(),Width::integer(),Height::integer(),Format::enum(),Type::enum(),Data::binary()) -> integer()
%% @doc See external documentation.
build2DMipmaps(Target,InternalFormat,Width,Height,Format,Type,Data) ->
wxe_util:send_bin(Data),
wxe_util: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.
build3DMipmapLevels(Target,InternalFormat,Width,Height,Depth,Format,Type,Level,Base,Max,Data) ->
wxe_util:send_bin(Data),
wxe_util:call(5014, <>).
%% @spec (Target::enum(),InternalFormat::integer(),Width::integer(),Height::integer(),Depth::integer(),Format::enum(),Type::enum(),Data::binary()) -> integer()
%% @doc See external documentation.
build3DMipmaps(Target,InternalFormat,Width,Height,Depth,Format,Type,Data) ->
wxe_util:send_bin(Data),
wxe_util:call(5015, <>).
%% @spec (ExtName::[integer()],ExtString::[integer()]) -> 0|1
%% @doc See external documentation.
checkExtension(ExtName,ExtString) ->
wxe_util: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.
cylinder(Quad,Base,Top,Height,Slices,Stacks) ->
wxe_util:cast(5017, <>).
%% @spec (Quad::integer()) -> ok
%% @doc See external documentation.
deleteQuadric(Quad) ->
wxe_util:cast(5018, <>).
%% @spec (Quad::integer(),Inner::float(),Outer::float(),Slices::integer(),Loops::integer()) -> ok
%% @doc See external documentation.
disk(Quad,Inner,Outer,Slices,Loops) ->
wxe_util:cast(5019, <>).
%% @spec (Error::enum()) -> string()
%% @doc See external documentation.
errorString(Error) ->
wxe_util:call(5020, <>).
%% @spec (Name::enum()) -> string()
%% @doc See external documentation.
getString(Name) ->
wxe_util: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.
lookAt(EyeX,EyeY,EyeZ,CenterX,CenterY,CenterZ,UpX,UpY,UpZ) ->
wxe_util:cast(5022, <>).
%% @spec () -> integer()
%% @doc See external documentation.
newQuadric() ->
wxe_util:call(5023, <<>>).
%% @spec (Left::float(),Right::float(),Bottom::float(),Top::float()) -> ok
%% @doc See external documentation.
ortho2D(Left,Right,Bottom,Top) ->
wxe_util:cast(5024, <>).
%% @spec (Quad::integer(),Inner::float(),Outer::float(),Slices::integer(),Loops::integer(),Start::float(),Sweep::float()) -> ok
%% @doc See external documentation.
partialDisk(Quad,Inner,Outer,Slices,Loops,Start,Sweep) ->
wxe_util:cast(5025, <>).
%% @spec (Fovy::float(),Aspect::float(),ZNear::float(),ZFar::float()) -> ok
%% @doc See external documentation.
perspective(Fovy,Aspect,ZNear,ZFar) ->
wxe_util:cast(5026, <>).
%% @spec (X::float(),Y::float(),DelX::float(),DelY::float(),Viewport::{integer()}) -> ok
%% @doc See external documentation.
pickMatrix(X,Y,DelX,DelY,{V1,V2,V3,V4}) ->
wxe_util:cast(5027, <>).
%% @spec (ObjX::float(),ObjY::float(),ObjZ::float(),Model::{float()},Proj::{float()},View::{integer()}) -> {integer(),WinX::float(),WinY::float(),WinZ::float()}
%% @doc See external documentation.
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}) ->
wxe_util: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}) ->
wxe_util:call(5028, <>).
%% @spec (Quad::integer(),Draw::enum()) -> ok
%% @doc See external documentation.
quadricDrawStyle(Quad,Draw) ->
wxe_util:cast(5029, <>).
%% @spec (Quad::integer(),Normal::enum()) -> ok
%% @doc See external documentation.
quadricNormals(Quad,Normal) ->
wxe_util:cast(5030, <>).
%% @spec (Quad::integer(),Orientation::enum()) -> ok
%% @doc See external documentation.
quadricOrientation(Quad,Orientation) ->
wxe_util:cast(5031, <>).
%% @spec (Quad::integer(),Texture::0|1) -> ok
%% @doc See external documentation.
quadricTexture(Quad,Texture) ->
wxe_util:cast(5032, <>).
%% @spec (Format::enum(),WIn::integer(),HIn::integer(),TypeIn::enum(),DataIn::binary(),WOut::integer(),HOut::integer(),TypeOut::enum(),DataOut::wx:wx_mem()) -> integer()
%% @doc See external documentation.
scaleImage(Format,WIn,HIn,TypeIn,DataIn,WOut,HOut,TypeOut,DataOut) ->
wxe_util:send_bin(DataIn),
wxe_util:send_bin(DataOut#wx_mem.bin),
wxe_util:call(5033, <>).
%% @spec (Quad::integer(),Radius::float(),Slices::integer(),Stacks::integer()) -> ok
%% @doc See external documentation.
sphere(Quad,Radius,Slices,Stacks) ->
wxe_util:cast(5034, <>).
%% @spec (WinX::float(),WinY::float(),WinZ::float(),Model::{float()},Proj::{float()},View::{integer()}) -> {integer(),ObjX::float(),ObjY::float(),ObjZ::float()}
%% @doc See external documentation.
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}) ->
wxe_util: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}) ->
wxe_util:call(5035, <>).
%% @spec (WinX::float(),WinY::float(),WinZ::float(),ClipW::float(),Model::{float()},Proj::{float()},View::{integer()},NearVal::float(),FarVal::float()) -> {integer(),ObjX::float(),ObjY::float(),ObjZ::float(),ObjW::float()}
%% @doc See external documentation.
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) ->
wxe_util: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) ->
wxe_util:call(5036, <>).