This Script can be used to set a full screen error message if an error happens on startup. (such as no OpenGL ES 2.0 support that is required for some samples).
Inheritance: MonoBehaviour
Exemple #1
0
    public void InitEffect()
    {
        // This sample requires OpenGL ES 2.0 otherwise it won't work.
        mErrorOccurred = !IsOpenGLES2();

        if (mErrorOccurred)
        {
            Debug.LogError(ERROR_TEXT);

            // Show a dialog box with an error message.
            GLErrorHandler.SetError(ERROR_TEXT);

            // Turn off renderer to make sure the unsupported shader is not used.
            GetComponent <Renderer>().enabled = false;

            TrackableBehaviour[] tbs = (TrackableBehaviour[])FindObjectsOfType(typeof(TrackableBehaviour));
            if (tbs != null)
            {
                for (int i = 0; i < tbs.Length; ++i)
                {
                    tbs[i].enabled = false;
                }
            }
        }
    }
Exemple #2
0
        public void UpdateVertexData(GLContext control)
        {
            CellSize   = (int)Runtime.GridSettings.CellSize;
            CellAmount = (int)Runtime.GridSettings.CellAmount;

            Vector3[]    vertices = Vertices;
            List <float> buffer   = new List <float>();

            for (int i = 0; i < vertices.Length; i++)
            {
                buffer.Add(vertices[i].X);
                buffer.Add(vertices[i].Y);
                buffer.Add(vertices[i].Z);
            }

            var data = buffer.ToArray();

            GL.BindBuffer(BufferTarget.ArrayBuffer, vbo_position);
            GL.BufferData <Vector3>(BufferTarget.ArrayBuffer,
                                    new IntPtr(data.Length * sizeof(float)),
                                    vertices, BufferUsageHint.StaticDraw);


            GLErrorHandler.CheckGLError();
        }
Exemple #3
0
        public void UpdateVertexData()
        {
            Vector3[] vertices = new Vector3[3];
            vertices[0] = new Vector3(-1f, -1f, 1f);
            vertices[1] = new Vector3(3f, -1f, 1f);
            vertices[2] = new Vector3(-1f, 3f, 1f);

            GL.GenBuffers(1, out vbo_position);
            GL.BindBuffer(BufferTarget.ArrayBuffer, vbo_position);
            GL.BufferData <Vector3>(BufferTarget.ArrayBuffer,
                                    new IntPtr(vertices.Length * Vector3.SizeInBytes),
                                    vertices, BufferUsageHint.StaticDraw);

            vao = new VertexBufferObject(vbo_position);
            vao.AddAttribute(0, 3, VertexAttribPointerType.Float, false, 12, 0);
            vao.Initialize();

            Prepare();

            GLErrorHandler.CheckGLError();
        }