Esempio n. 1
0
        public static void InitializeSharedResources()
        {
            // Only setup once. This is checked multiple times to prevent crashes.
            if (SetupStatus == SharedResourceStatus.Initialized)
            {
                return;
            }

            try
            {
                // Make a permanent context to share resources.
                GraphicsContext.ShareContexts = true;
                dummyResourceWindow           = CreateGameWindowContext();

                if (Runtime.enableOpenTkDebugOutput)
                {
                    EnableOpenTkDebugOutput();
                }

                RenderTools.LoadTextures();
                GetOpenGlSystemInfo();
                ShaderTools.SetUpShaders();

                SetupStatus = SharedResourceStatus.Initialized;
            }
            catch (AccessViolationException)
            {
                // Context creation failed.
                SetupStatus = SharedResourceStatus.Failed;
            }
        }
Esempio n. 2
0
 private static void CreateNudSphereShader()
 {
     // HACK: Recreating static resources is dumb.
     // Don't add this to the main shaders to begin with.
     string[] nudMatShaders = new string[]
     {
         "Nud\\NudSphere.frag",
         "Nud\\NudSphere.vert",
         "Nud\\StageLighting.frag",
         "Nud\\Bayo.frag",
         "Nud\\SmashShader.frag",
         "Utility\\Utility.frag"
     };
     OpenTkSharedResources.shaders.Remove("NudSphere");
     ShaderTools.CreateAndAddShader("NudSphere", nudMatShaders);
 }
Esempio n. 3
0
        public static void DrawScreenQuadPostProcessing(Texture texture0, Texture texture1, Mesh3D screenTriangle)
        {
            // Draws RGB and alpha channels of texture to screen quad.
            Shader shader = OpenTkSharedResources.shaders["ScreenQuad"];

            shader.UseProgram();

            shader.SetTexture("image0", texture0, 0);
            shader.SetTexture("image1", texture1, 1);

            shader.SetBoolToInt("renderBloom", Runtime.renderBloom);
            shader.SetFloat("bloomIntensity", Runtime.bloomIntensity);

            ShaderTools.SystemColorVector3Uniform(shader, Runtime.backgroundGradientBottom, "backgroundBottomColor");
            ShaderTools.SystemColorVector3Uniform(shader, Runtime.backgroundGradientTop, "backgroundTopColor");

            // Draw full screen "quad" (big triangle)
            DrawScreenTriangle(shader, screenTriangle);
        }