Package net.java.games.jogl

Examples of net.java.games.jogl.GL


        System.out.println("init 3d");
       
       
       
       
        GL gl = drawable.getGL();
        GLU glu = drawable.getGLU();
        gl.glGenTextures(1, textures);
        gl.glBindTexture(GL.GL_TEXTURE_2D, textures[0]);
        gl.glDisable(GL.GL_DEPTH_TEST);
        gl.glDisable(GL.GL_LIGHTING);
        gl.glEnable(GL.GL_TEXTURE_2D);
        //gl.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_REPLACE);

        gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_REPEAT);
        gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_REPEAT);
        gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST);
        gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST);

        gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_RGBA, width, height, 0,  GL.GL_RGBA, GL.GL_UNSIGNED_INT_8_8_8_8, (char[])null);

        //System.out.println("time :: " + (System.currentTimeMillis() - time)); 
        gl.glClear(GL.GL_COLOR_BUFFER_BIT);
        gl.glMatrixMode(GL.GL_PROJECTION);   
        gl.glLoadIdentity();              
        glu.gluOrtho2D(-1.0, 1.0, -1.0, 1.0);
       
        cgContext = CgGL.cgCreateContext();
        int errorCg = CgGL.cgGetError();
        System.out.println("cgCreateContext: "+CgGL.cgGetErrorString(errorCg));

        if(hasFragmentShaderSupport())
        {
           
            cgProgram = CgGL.cgCreateProgram(cgContext,  CgGL.CG_SOURCE, program,  getBestProfile()"main"null);
            //errorCg = CgGL.cgGetError();
            //System.out.println("cgCreateProgram: "+CgGL.cgGetErrorString(errorCg));
           
            CgGL.cgGLLoadProgram(cgProgram);
            //errorCg = CgGL.cgGetError();
            //System.out.println("cgLoadProgram: "+CgGL.cgGetErrorString(errorCg));
            CgGL.cgGLBindProgram(cgProgram);
            //errorCg = CgGL.cgGetError();
            //System.out.println("cgBindPRogram: "+CgGL.cgGetErrorString(errorCg));
           
            cgParameter = CgGL.cgGetNamedParameter(cgProgram,  "Y");
            CgGL.cgGLSetTextureParameter(cgParameter,  textures[0]);
            //errorCg = CgGL.cgGetError();
            //System.out.println("cgSetParam: "+CgGL.cgGetErrorString(errorCg));
           
            CgGL.cgGLEnableTextureParameter(cgParameter);

            gl.glBindTexture(GL.GL_TEXTURE_2D, textures[0]);
            CgGL.cgGLEnableProfile(getBestProfile());
            //errorCg = CgGL.cgGetError();
            //System.out.println("cgEnableProfile: "+CgGL.cgGetErrorString(errorCg));
        }
        else
View Full Code Here


            System.out.println("Your graphics hardware is not capable of doing Color Space Conversion\n");
        }
    }

    public void display(GLDrawable drawable) {
        GL gl = drawable.getGL();
        GLU glu = drawable.getGLU();
       
        if(data != null) {
            gl.glTexSubImage2D(GL.GL_TEXTURE_2D, 0, 0, 0, formatWidth, formatHeight,  inputColorOrder, inputFormat, data);
        }
               
        gl.glBegin(GL.GL_QUADS);
          gl.glTexCoord2f(0,0);
          gl.glVertex3d(-1, 1,0);
          gl.glTexCoord2f(extendX,0);
          gl.glVertex3d(1, 1,0);
          gl.glTexCoord2f(extendX,extendY);
          gl.glVertex3d(1, -1,0);
          gl.glTexCoord2f(0,extendY);
          gl.glVertex3d(-1, -1,0);
        gl.glEnd();
       
        drawable.swapBuffers();
         
       
View Full Code Here

TOP

Related Classes of net.java.games.jogl.GL

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.