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