Exemplo n.º 1
0
        public GraphicsDevice(Size size, WindowMode window)
        {
            Console.WriteLine("Using Cg renderer");
            windowSize = size;

            var extensions = new []
            {
                "GL_ARB_vertex_program",
                "GL_ARB_fragment_program",
                "GL_ARB_vertex_buffer_object",
            };

            surf = SdlGraphics.InitializeSdlGl(ref windowSize, window, extensions);

            cgContext = Tao.Cg.Cg.cgCreateContext();

            Tao.Cg.Cg.cgSetErrorCallback(CgErrorCallback);

            Tao.Cg.CgGl.cgGLRegisterStates(cgContext);
            Tao.Cg.CgGl.cgGLSetManageTextureParameters(cgContext, true);
            vertexProfile   = CgGl.cgGLGetLatestProfile(CgGl.CG_GL_VERTEX);
            fragmentProfile = CgGl.cgGLGetLatestProfile(CgGl.CG_GL_FRAGMENT);

            Gl.glEnableClientState(Gl.GL_VERTEX_ARRAY);
            ErrorHandler.CheckGlError();
            Gl.glEnableClientState(Gl.GL_TEXTURE_COORD_ARRAY);
            ErrorHandler.CheckGlError();

            Sdl.SDL_SetModState(0);             // i have had enough.

            input = new SdlInput(surf);
        }
Exemplo n.º 2
0
        public GraphicsDevice(Size size, WindowMode window)
        {
            Console.WriteLine("Using Gl renderer");
            windowSize = size;

            var extensions = new []
            {
                "GL_ARB_vertex_shader",
                "GL_ARB_fragment_shader",
                "GL_ARB_vertex_buffer_object",
            };

            surf = SdlGraphics.InitializeSdlGl(ref windowSize, window, extensions);

            Gl.glEnableClientState(Gl.GL_VERTEX_ARRAY);
            ErrorHandler.CheckGlError();
            Gl.glEnableClientState(Gl.GL_TEXTURE_COORD_ARRAY);
            ErrorHandler.CheckGlError();

            Sdl.SDL_SetModState(0);

            input = new SdlInput(surf);
        }
Exemplo n.º 3
0
 public void Clear()
 {
     SdlGraphics.Clear();
 }
Exemplo n.º 4
0
 public void DrawPrimitives(PrimitiveType pt, int firstVertex, int numVertices)
 {
     SdlGraphics.DrawPrimitives(pt, firstVertex, numVertices);
 }