using StgSharp.Math;
using System;
namespace StgSharp.Graphics
{
public interface IglFunc
{
///
/// Align a sets of code to frame update of a .
/// Usually, a call of is required.
/// This method is used as sigle thread method. If more than one
/// alignment is requested, a will throw.
///
/// The form used as frame update benchmark.
/// More than one alingment attached to one form timer
void AlignFrame(Form form);
///
/// Operation after alignment by calling .
/// No calling of this method is acceptable, but it will bring the risk
/// of that relevant code will not run if it is interrupted by frame overtime.
/// Please call this method immediately after calling ,
/// too early or sonner may cause .
///
/// The form used as frame update benchmark.
/// Operation after frame update alignment.
/// The action binded to a wrong alignment.
void AfterAlign(Form form, Action action);
///
/// Same function as OpenGL api glActiveTexture
///
/// type of texture to activate
void ActiveTexture(uint type);
///
/// Same fucntion as OpenGL api glAttachShader
///
/// Shader program to be attachec
/// A shader part to attach
void AttachShader(uint program, uint shader);
///
/// Bind the indexed buffer object to certain type of buffer
///
///
///
void BindBuffer(BufferType bufferType, uint index);
///
/// Same function as OpenGL api, glBindTexture.
///
/// Type of texture to bind
/// Sign of texture
void BindTexture(uint type, uint texture);
///
/// Same function as OpenGL api, glBindVertexArray
///
///
void BindVertexArray(uint index);
///
/// Clear buffers to preset values
///
///
void Clear(MaskBufferBit mask);
///
/// Call apiClearColor in OpenGL
/// specifies the red, green, blue, and alpha values used by apiClear to clear the color buffers.
/// Values specified by apiClearColor are clamped to the range [0,1]
///
/// Specify the red values used when the color buffers are cleared.
/// Specify the red values used when the color buffers are cleared.
/// Specify the red values used when the color buffers are cleared.
/// Specify the red values used when the color buffers are cleared.
void ClearColor(float R, float G, float B, float A);
void ClearGraphicError();
///
/// Conpile the provided shader code in string form.
///
/// A string represent the shader's code
/// An enum represent the type of the shader to
/// conpile, including vertex shader and fragment shader.
/// An uint value as the only mark of conpiled shader
uint CompileShader(string shaderCode, ShaderType shaderType);
///
/// Same function as OpenGL api, glCreateProgram
///
///
uint CreateProgram();
///
/// Creates a form and its associated
///
/// Required width
/// Required width
/// Tittle of the window
///
///
/// The instance of created form
///
IntPtr CreateWindowHandle(int width, int height, string tittle, IntPtr monitor, Form share);
uint CreatGraphicProgram();
///
/// Same function as OpenGL api, glDeleteBuffer.
///
/// Amount of bufferd to be deleted
/// Pointer of buffer to be deleted
unsafe void DeleteBuffers(int count, uint* ptr);
///
/// Same function as OpenGL api, glDeleteVertexArrays
///
/// Amount of vao to be deleted
/// pointer of vao sign array
unsafe void DeleteVertexArrays(int count, uint* ptr);
void DrawElements(GepmetryType mode, int count, Type type, IntPtr ptr);
///
/// Same fucntion as the OpenGL api glGenBuffers
///
///
///
unsafe void GenBuffers(int count, uint* ptr);
///
/// Same fucnction as OpenGL api glGenTextures.
///
/// amount of textures to generate
/// pointer to texture signs' array
unsafe void GenTextures(int count, uint* ptr);
///
/// Same fucntion as OpenGL api, glGenVertexArray
///
/// Amount of vao to be generated
/// Pointer of vao sign array
unsafe void GenVertexArrays(int count, uint* ptr);
void GetGraphicError();
///
/// Same fucntion as OpenGL api, glGetUniformLocation
///
/// Shader program to find the uniform
/// Pointer to byte array of name of the uniform
///
unsafe int GetUniformLocation(uint program, byte* ptr);
bool GetWindowShouldClose(Form form);
///
/// Make the OpenGL context of a vertain as the activated OpenGL context.
///
///
void MakeContexCurrent(Form form);
void SetBufferData(BufferType bufferType, T bufferData, BufferUsage usage) where T : IMat;
void SetBufferData(BufferType bufferType, T[] bufferArray, BufferUsage usage) where T : struct, IConvertible;
///
/// sets the framebuffer resize callback of the specified ,
///which is called when the framebuffer of the specified is resized.
///
/// The only signiture stands for the to be controlled
/// Method hadler
void SetFrameBufferSizeCallback(IntPtr id, FrameBufferSizeHandler handler);
void SetValue(Uniform uniform, float v0, float v1, float v2, float v3);
void SetValue(Uniform uniform, Vec4d vec);
void SetValue(Uniform uniform, float v0, float v1, float v2);
void SetValue(Uniform uniform, float v0, float v1);
void SetValue(Uniform uniform, float v0);
void SetValue(Uniform uniform, int i0);
void SetValue(Uniform uniform, Vec4d vec);
///
/// Set how a shader parameter read data from a VBO.
///
/// Serial number of the parameter
/// Amount of data each elements contains
/// Type of data read by shader
///
/// Pixels stride of each sets of data
///
void SetVertexAttribute(uint index, int size, Type t, bool normalized, int stride, int pointer);
void SwapBuffers(Form form);
///
/// Same function as OpenGL api glTexImage2d
///
/// texture target to load image in
/// level of mipmap, 0 if default
/// OpenGL's internal color channel format
/// width of image
/// height of image
/// color channels of this image
/// how this image express each pixel
/// pointer to data array of pixels
unsafe void TextureImage2d(uint target, int level, uint internalformat, int width, int height, uint format, uint type, void* pixels);
///
/// Same fucntion as OpenGL api glTexParameteri
///
/// texture target to set parameters
/// name of parameter
/// value of parameter
void TextureParameter(uint target, uint pname, int param);
///
/// Same fucntion as OpenGL api glUseShader.
///
/// Sign of program to be used
void UseProgram(uint program);
///
/// Same function as the OpenGL api, glViewPort
///
///
///
///
///
void Viewport(int x, int y, int width, int height);
}
}