Esempio n. 1
0
        PixelType GetOpenTKPixelType(e_PixelType a_pixelType)
        {
            switch (a_pixelType)
            {
            case e_PixelType.Byte:
            {
                return(PixelType.Byte);
            }

            case e_PixelType.UnsignedByte:
            {
                return(PixelType.UnsignedByte);
            }

            case e_PixelType.Int:
            {
                return(PixelType.Int);
            }

            case e_PixelType.UnsignedInt:
            {
                return(PixelType.UnsignedInt);
            }

            case e_PixelType.Float:
            {
                return(PixelType.Float);
            }
            }

            return(PixelType.UnsignedByte);
        }
Esempio n. 2
0
        public void WriteData(IntPtr a_ptr, e_PixelType a_pixelType)
        {
            if (m_handle == -1)
            {
                m_handle = GL.GenTexture();
            }

            int width  = m_texture.Width;
            int height = m_texture.Height;

            OpenTK.Graphics.OpenGL.PixelFormat pixelFormat = GetOpenTKPixelFormat(m_texture.PixelFormat);
            PixelInternalFormat internalFormat             = GetOpenTKInternalPixelFormat(m_texture.InternalPixelFormat);
            PixelType           pixelType = GetOpenTKPixelType(a_pixelType);

            GL.BindTexture(TextureTarget.Texture2D, m_handle);

            GL.TexImage2D
            (
                TextureTarget.Texture2D,
                0,
                internalFormat,
                width, height,
                0,
                pixelFormat,
                pixelType,
                a_ptr
            );

            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)All.Linear);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)All.Linear);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapR, (int)All.ClampToEdge);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)All.ClampToEdge);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)All.ClampToEdge);

#if DEBUG_INFO
            Pipeline.GLError("Texture: Writing: ");
#endif
        }
Esempio n. 3
0
        internal void WriteData(int a_width, int a_height, e_PixelFormat a_pixelFormat, e_InternalPixelFormat a_internalPixelFormat, e_PixelType a_pixelType, IntPtr a_data)
        {
            m_width  = a_width;
            m_height = a_height;

            m_pixelFormat         = a_pixelFormat;
            m_pixelInternalFormat = a_internalPixelFormat;

            m_internalObject.WriteData(a_data, a_pixelType);
        }