public void onSurfaceCreated(GL10 glUnused, EGLConfig config)
            {
                // Set the background clear color to black.
                gl.clearColor(1.0f, 1.0f, 1.0f, 0.0f);

                // Use culling to remove back faces.
                opengl.glEnable(opengl.GL_CULL_FACE);

                // Enable depth testing
                opengl.glEnable(opengl.GL_DEPTH_TEST);

                // Enable texture mapping
                opengl.glEnable(opengl.GL_TEXTURE_2D);

                // Position the eye in front of the origin.
                float eyeX = 0.0f;
                float eyeY = 0.0f;
                float eyeZ = -0.5f;

                // We are looking toward the distance
                float lookX = 0.0f;
                float lookY = 0.0f;
                float lookZ = -5.0f;

                // Set our up vector. This is where our head would be pointing were we holding the camera.
                float upX = 0.0f;
                float upY = 1.0f;
                float upZ = 0.0f;

                // Set the view matrix. This matrix can be said to represent the camera position.
                // NOTE: In OpenGL 1, a ModelView matrix is used, which is a combination of a model and
                // view matrix. In OpenGL 2, we can keep track of these matrices separately if we choose.
                Matrix.setLookAtM(mViewMatrix, 0, eyeX, eyeY, eyeZ, lookX, lookY, lookZ, upX, upY, upZ);


                mProgramHandle = gl.createAndLinkProgram(
                    new Shaders.per_pixelVertexShader(),
                    new Shaders.per_pixelFragmentShader(),
                    "a_Position",
                    "a_Color",
                    "a_Normal",
                    "a_TexCoordinate"
                    );

                // Define a simple shader program for our point.


                mPointProgramHandle = gl.createAndLinkProgram(
                    new Shaders.per_pixelVertexShader(),
                    new Shaders.per_pixelFragmentShader(),
                    "a_Position"
                    );

                // Load the texture
                mTextureDataHandle  = TextureHelper.loadTexture(mActivityContext, R.drawable.jsc_24bit);
                mTextureDataHandle2 = TextureHelper.loadTexture(mActivityContext, R.drawable.jsc_black);
            }
        // what about webgl2?
        // X:\jsc.svn\examples\java\android\synergy\OVRVrCubeWorldSurfaceView\OVRVrCubeWorldSurfaceViewXNDK\VrCubeWorld.Scene.cs


        // let's try to mimic WebGL api and see how far we get
        // why is Android ES a static reference?

        // whats the most popular api looking at Y:\jsc.svn\examples\javascript\WebGLLesson16\WebGLLesson16\Application.cs ?
        // jsc analyzer shows how many distinct methods reference the api but not yet how many times what is referenced
        // as such some manual guessing eeds to be done.

        public __WebGLUniformLocation getUniformLocation(__WebGLProgram program, string name)
        {
            return new __WebGLUniformLocation { value = GLES20.glGetUniformLocation(program.value, name) };
        }
 public void useProgram(__WebGLProgram program)
 {
     GLES20.glUseProgram(program.value);
 }
 internal void attachShader(__WebGLProgram program, __WebGLShader vertexShader)
 {
     GLES20.glAttachShader(program, vertexShader);
 }
 internal void bindAttribLocation(__WebGLProgram programHandle, int i, string p)
 {
     GLES20.glBindAttribLocation(programHandle, i, p);
 }
 internal void deleteProgram(__WebGLProgram programObject)
 {
     GLES20.glDeleteProgram(programObject);
 }
 internal void linkProgram(__WebGLProgram programObject)
 {
     GLES20.glLinkProgram(programObject);
 }
Example #8
0
 public void useProgram(__WebGLProgram program)
 {
     GLES20.glUseProgram(program.value);
 }
        // shall we also redefine the constants?



        public int getAttribLocation(__WebGLProgram program, string name)
        {
            return GLES20.glGetAttribLocation(program.value, name);
        }
Example #10
0
 internal void bindAttribLocation(__WebGLProgram programHandle, int i, string p)
 {
     GLES20.glBindAttribLocation(programHandle, i, p);
 }
Example #11
0
        // let's try to mimic WebGL api and see how far we get
        // why is Android ES a static reference?

        // whats the most popular api looking at Y:\jsc.svn\examples\javascript\WebGLLesson16\WebGLLesson16\Application.cs ?
        // jsc analyzer shows how many distinct methods reference the api but not yet how many times what is referenced
        // as such some manual guessing eeds to be done.

        public __WebGLUniformLocation getUniformLocation(__WebGLProgram program, string name)
        {
            return(new __WebGLUniformLocation {
                value = GLES20.glGetUniformLocation(program.value, name)
            });
        }
Example #12
0
 internal void attachShader(__WebGLProgram program, __WebGLShader vertexShader)
 {
     GLES20.glAttachShader(program, vertexShader);
 }
Example #13
0
 internal void linkProgram(__WebGLProgram programObject)
 {
     GLES20.glLinkProgram(programObject);
 }
Example #14
0
 internal void deleteProgram(__WebGLProgram programObject)
 {
     GLES20.glDeleteProgram(programObject);
 }
Example #15
0
        // shall we also redefine the constants?



        public int getAttribLocation(__WebGLProgram program, string name)
        {
            return(GLES20.glGetAttribLocation(program.value, name));
        }
            public void onSurfaceCreated(GL10 glUnused, EGLConfig config)
            {
                // Set the background clear color to black.
                gl.clearColor(1.0f, 1.0f, 1.0f, 0.0f);

                // Use culling to remove back faces.
                opengl.glEnable(opengl.GL_CULL_FACE);

                // Enable depth testing
                opengl.glEnable(opengl.GL_DEPTH_TEST);

                // Enable texture mapping
                opengl.glEnable(opengl.GL_TEXTURE_2D);

                // Position the eye in front of the origin.
                float eyeX = 0.0f;
                float eyeY = 0.0f;
                float eyeZ = -0.5f;

                // We are looking toward the distance
                float lookX = 0.0f;
                float lookY = 0.0f;
                float lookZ = -5.0f;

                // Set our up vector. This is where our head would be pointing were we holding the camera.
                float upX = 0.0f;
                float upY = 1.0f;
                float upZ = 0.0f;

                // Set the view matrix. This matrix can be said to represent the camera position.
                // NOTE: In OpenGL 1, a ModelView matrix is used, which is a combination of a model and
                // view matrix. In OpenGL 2, we can keep track of these matrices separately if we choose.
                Matrix.setLookAtM(mViewMatrix, 0, eyeX, eyeY, eyeZ, lookX, lookY, lookZ, upX, upY, upZ);


                mProgramHandle = gl.createAndLinkProgram(
                    new Shaders.per_pixelVertexShader(),
                    new Shaders.per_pixelFragmentShader(),
                    "a_Position",
                    "a_Color",
                    "a_Normal",
                    "a_TexCoordinate"
                );

                // Define a simple shader program for our point.


                mPointProgramHandle = gl.createAndLinkProgram(
                    new Shaders.per_pixelVertexShader(),
                    new Shaders.per_pixelFragmentShader(),
                      "a_Position"
                );

                // Load the texture
                mTextureDataHandle = TextureHelper.loadTexture(mActivityContext, R.drawable.jsc_24bit);
                mTextureDataHandle2 = TextureHelper.loadTexture(mActivityContext, R.drawable.jsc_black);
            }