Пример #1
0
        internal GLPBRTTManager(BaseGLSupport glSupport, RenderTarget target)
            : base(glSupport)
        {
            this._glSupport  = glSupport;
            this._mainWindow = target;

            this._mainGLContext = (GLContext)target.GetCustomAttribute("GLCONTEXT");
        }
Пример #2
0
 /// <summary>
 ///     Internal constructor.  This class cannot be instantiated externally.
 /// </summary>
 /// <remarks>
 ///     Protected internal because this singleton will actually hold the instance of a subclass
 ///     created by a render system plugin.
 /// </remarks>
 protected internal GLRTTManager(BaseGLSupport glSupport)
 {
     if (_instance == null)
     {
         _instance       = this;
         this._glSupport = glSupport;
     }
 }
Пример #3
0
		internal GLPBRTTManager( BaseGLSupport glSupport, RenderTarget target )
			: base( glSupport )
		{
			_glSupport = glSupport;
			_mainWindow = target;

			_mainGLContext = (GLContext)target.GetCustomAttribute( "GLCONTEXT" );
		}
Пример #4
0
		/// <summary>
		///     Internal constructor.  This class cannot be instantiated externally.
		/// </summary>
		/// <remarks>
		///     Protected internal because this singleton will actually hold the instance of a subclass
		///     created by a render system plugin.
		/// </remarks>
		protected internal GLRTTManager( BaseGLSupport glSupport )
		{
			if ( _instance == null )
			{
				_instance = this;
				this._glSupport = glSupport;
			}
		}
Пример #5
0
        internal GLPBRTTManager(BaseGLSupport glSupport, RenderTarget target)
            : base(glSupport)
        {
            this._glSupport  = glSupport;
            this._mainWindow = target;

            this._mainGLContext = (GLContext)target["GLCONTEXT"];
        }
Пример #6
0
        internal GLTextureManager(BaseGLSupport glSupport)
            : base()
        {
            this._glSupport = glSupport;
            Is32Bit         = true;

            ResourceGroupManager.Instance.RegisterResourceManager(ResourceType, this);
            _createWarningTexture();
        }
Пример #7
0
		internal GLTextureManager( BaseGLSupport glSupport )
			: base()
		{
			this._glSupport = glSupport;
			Is32Bit = true;

			ResourceGroupManager.Instance.RegisterResourceManager( ResourceType, this );
			_createWarningTexture();
		}
Пример #8
0
        internal GLFBORTTManager(BaseGLSupport glSupport, bool atiMode)
            : base(glSupport)
        {
            for (int x = 0; x < this._props.GetLength(0); x++)
            {
                this._props[x] = new FormatProperties();
            }
            this._atiMode = atiMode;

            _detectFBOFormats();

            Gl.glGenFramebuffersEXT(1, out this._tempFBO);
        }
Пример #9
0
		internal GLHardwareOcclusionQuery( BaseGLSupport glSupport )
		{
			this._glSupport = glSupport;
			isSupportedARB = _glSupport.CheckMinVersion( GL_Version_1_5 ) || _glSupport.CheckExtension( GL_ARB_occlusion_query );
			isSupportedNV = _glSupport.CheckExtension( GL_NV_occlusion_query );

			if ( isSupportedNV )
			{
				Gl.glGenOcclusionQueriesNV( 1, out this.queryId );
			}
			else if ( isSupportedARB )
			{
				Gl.glGenQueriesARB( 1, out this.queryId );
			}
		}
Пример #10
0
        internal GLHardwareOcclusionQuery(BaseGLSupport glSupport)
        {
            this._glSupport     = glSupport;
            this.isSupportedARB = this._glSupport.CheckMinVersion(GL_Version_1_5) ||
                                  this._glSupport.CheckExtension(GL_ARB_occlusion_query);
            this.isSupportedNV = this._glSupport.CheckExtension(GL_NV_occlusion_query);

            if (this.isSupportedNV)
            {
                Gl.glGenOcclusionQueriesNV(1, out this.queryId);
            }
            else if (this.isSupportedARB)
            {
                Gl.glGenQueriesARB(1, out this.queryId);
            }
        }
Пример #11
0
        public GLTextureBuffer(string baseName, int target, int id, int face, int level, BufferUsage usage,
                               bool softwareMipmap, BaseGLSupport glSupport, bool writeGamma, int fsaa)
            : base(0, 0, 0, PixelFormat.Unknown, usage)
        {
            int value;

            this._glSupport = glSupport;

            this._target         = target;
            this._textureId      = id;
            this._face           = face;
            this._level          = level;
            this._softwareMipmap = softwareMipmap;

            Gl.glBindTexture(this._target, this._textureId);

            // Get face identifier
            this._faceTarget = this._target;
            if (this._target == Gl.GL_TEXTURE_CUBE_MAP)
            {
                this._faceTarget = Gl.GL_TEXTURE_CUBE_MAP_POSITIVE_X + this._face;
            }

            // Get width
            Gl.glGetTexLevelParameteriv(this._faceTarget, this._level, Gl.GL_TEXTURE_WIDTH, out value);
            width = value;

            // Get height
            if (this._target == Gl.GL_TEXTURE_1D)
            {
                value = 1; // Height always 1 for 1D textures
            }
            else
            {
                Gl.glGetTexLevelParameteriv(this._faceTarget, this._level, Gl.GL_TEXTURE_HEIGHT, out value);
            }
            height = value;

            // Get depth
            if (this._target != Gl.GL_TEXTURE_3D)
            {
                value = 1; // Depth always 1 for non-3D textures
            }
            else
            {
                Gl.glGetTexLevelParameteriv(this._faceTarget, this._level, Gl.GL_TEXTURE_DEPTH, out value);
            }
            depth = value;

            // Get format
            Gl.glGetTexLevelParameteriv(this._faceTarget, this._level, Gl.GL_TEXTURE_INTERNAL_FORMAT, out value);
            GLFormat = value;
            format   = GLPixelUtil.GetClosestPixelFormat(value);

            // Default
            rowPitch    = Width;
            slicePitch  = Height * Width;
            sizeInBytes = PixelUtil.GetMemorySize(Width, Height, Depth, Format);

            // Set up pixel box
            buffer = new PixelBox(Width, Height, Depth, Format);

            if (Width == 0 || Height == 0 || Depth == 0)
            {
                /// We are invalid, do not allocate a buffer
                return;
            }

            // Is this a render target?
            if (((TextureUsage)Usage & TextureUsage.RenderTarget) == TextureUsage.RenderTarget)
            {
                // Create render target for each slice
                this._sliceTRT.Capacity = Depth;
                for (int zoffset = 0; zoffset < Depth; ++zoffset)
                {
                    String name;
                    name = String.Format("{0}/{1}/{2}/{3}", baseName, face, this._level, zoffset);

                    GLSurfaceDesc renderTarget;
                    renderTarget.Buffer  = this;
                    renderTarget.ZOffset = zoffset;
                    RenderTexture trt = GLRTTManager.Instance.CreateRenderTexture(name, renderTarget, writeGamma, fsaa);
                    this._sliceTRT.Add(trt);
                    Root.Instance.RenderSystem.AttachRenderTarget(this._sliceTRT[zoffset]);
                }
            }
        }
Пример #12
0
		/// <summary>
		///    Constructor used when creating a manual texture.
		/// </summary>
		/// <param name="parent"></param>
		/// <param name="name"></param>
		/// <param name="handle"></param>
		/// <param name="group"></param>
		/// <param name="isManual"></param>
		/// <param name="loader"></param>
		/// <param name="glSupport"></param>
		internal GLTexture( ResourceManager parent, string name, ResourceHandle handle, string group, bool isManual, IManualResourceLoader loader, BaseGLSupport glSupport )
			: base( parent, name, handle, group, isManual, loader )
		{
			_glSupport = glSupport;
			_glTextureID = 0;
		}
Пример #13
0
 internal GLCopyingRTTManager(BaseGLSupport glSupport)
     : base(glSupport)
 {
 }
Пример #14
0
		internal GLCopyingRTTManager( BaseGLSupport glSupport )
			: base( glSupport )
		{
		}
Пример #15
0
 /// <summary>
 ///    Constructor used when creating a manual texture.
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="name"></param>
 /// <param name="handle"></param>
 /// <param name="group"></param>
 /// <param name="isManual"></param>
 /// <param name="loader"></param>
 /// <param name="glSupport"></param>
 internal GLTexture(ResourceManager parent, string name, ResourceHandle handle, string group, bool isManual, IManualResourceLoader loader, BaseGLSupport glSupport)
     : base(parent, name, handle, group, isManual, loader)
 {
     this._glSupport   = glSupport;
     this._glTextureID = 0;
 }
Пример #16
0
		internal GLFBORTTManager( BaseGLSupport glSupport, bool atiMode )
			: base( glSupport )
		{
			for ( int x = 0; x < this._props.GetLength( 0 ); x++ )
			{
				this._props[ x ] = new FormatProperties();
			}
			this._atiMode = atiMode;

			_detectFBOFormats();

			Gl.glGenFramebuffersEXT( 1, out this._tempFBO );
		}
Пример #17
0
		public GLRenderSystem()
		{
		    depthWrite = true;
            stencilMask = unchecked((int)0xffffffff);

			LogManager.Instance.Write( "{0} created.", Name );

			// create
			_glSupport = new GLSupport();

            worldMatrix = Matrix4.Identity;
            viewMatrix = Matrix4.Identity;

			InitConfigOptions();

			ColorWrite[ 0 ] = ColorWrite[ 1 ] = ColorWrite[ 2 ] = ColorWrite[ 3 ] = 1;

			for ( var i = 0; i < Config.MaxTextureCoordSets; i++ )
			{
				texCoordIndex[ i ] = 99;
			    textureTypes[ i ] = 0;
			}

			// init the stored stencil buffer params
			stencilFail = stencilZFail = stencilPass = Gl.GL_KEEP;
			stencilFunc = Gl.GL_ALWAYS;
			stencilRef = 0;
			

			minFilter = FilterOptions.Linear;
			mipFilter = FilterOptions.Point;

		}
Пример #18
0
		public GLTextureBuffer( string baseName, int target, int id, int face, int level, BufferUsage usage,
		                        bool softwareMipmap, BaseGLSupport glSupport, bool writeGamma, int fsaa )
			: base( 0, 0, 0, PixelFormat.Unknown, usage )
		{
			int value;

			this._glSupport = glSupport;

			this._target = target;
			this._textureId = id;
			this._face = face;
			this._level = level;
			this._softwareMipmap = softwareMipmap;

			Gl.glBindTexture( this._target, this._textureId );

			// Get face identifier
			this._faceTarget = this._target;
			if ( this._target == Gl.GL_TEXTURE_CUBE_MAP )
			{
				this._faceTarget = Gl.GL_TEXTURE_CUBE_MAP_POSITIVE_X + this._face;
			}

			// Get width
			Gl.glGetTexLevelParameteriv( this._faceTarget, this._level, Gl.GL_TEXTURE_WIDTH, out value );
			width = value;

			// Get height
			if ( this._target == Gl.GL_TEXTURE_1D )
			{
				value = 1; // Height always 1 for 1D textures
			}
			else
			{
				Gl.glGetTexLevelParameteriv( this._faceTarget, this._level, Gl.GL_TEXTURE_HEIGHT, out value );
			}
			height = value;

			// Get depth
			if ( this._target != Gl.GL_TEXTURE_3D )
			{
				value = 1; // Depth always 1 for non-3D textures
			}
			else
			{
				Gl.glGetTexLevelParameteriv( this._faceTarget, this._level, Gl.GL_TEXTURE_DEPTH, out value );
			}
			depth = value;

			// Get format
			Gl.glGetTexLevelParameteriv( this._faceTarget, this._level, Gl.GL_TEXTURE_INTERNAL_FORMAT, out value );
			GLFormat = value;
			format = GLPixelUtil.GetClosestPixelFormat( value );

			// Default
			rowPitch = Width;
			slicePitch = Height*Width;
			sizeInBytes = PixelUtil.GetMemorySize( Width, Height, Depth, Format );

			// Set up pixel box
			buffer = new PixelBox( Width, Height, Depth, Format );

			if ( Width == 0 || Height == 0 || Depth == 0 )
			{
				/// We are invalid, do not allocate a buffer
				return;
			}

			// Is this a render target?
			if ( ( (TextureUsage)Usage & TextureUsage.RenderTarget ) == TextureUsage.RenderTarget )
			{
				// Create render target for each slice
				this._sliceTRT.Capacity = Depth;
				for ( int zoffset = 0; zoffset < Depth; ++zoffset )
				{
					String name;
					name = String.Format( "{0}/{1}/{2}/{3}", baseName, face, this._level, zoffset );

					GLSurfaceDesc renderTarget;
					renderTarget.Buffer = this;
					renderTarget.ZOffset = zoffset;
					RenderTexture trt = GLRTTManager.Instance.CreateRenderTexture( name, renderTarget, writeGamma, fsaa );
					this._sliceTRT.Add( trt );
					Root.Instance.RenderSystem.AttachRenderTarget( this._sliceTRT[ zoffset ] );
				}
			}
		}
        /// <summary>
        ///		Default constructor.
        /// </summary>
        public GLRenderSystem()
        {
            viewMatrix = Matrix4.Identity;
            worldMatrix = Matrix4.Identity;
            textureMatrix = Matrix4.Identity;

            // init the stored stencil buffer params
            stencilFail = stencilZFail = stencilPass = Gl.GL_KEEP;
            stencilFunc = Gl.GL_ALWAYS;
            stencilRef = 0;
            stencilMask = unchecked((int)0xffffffff);

            colorWrite[0] = colorWrite[1] = colorWrite[2] = colorWrite[3] = 1;

            minFilter = FilterOptions.Linear;
            mipFilter = FilterOptions.Point;

            // create
            glSupport = new GLSupport();

            InitConfigOptions();
        }