Esempio n. 1
0
        void DrawCompass(OpenGL GL)
        {
            mat4 model = mat4.identity();

            model = glm.translate(model, new vec3(7, -3, -6));
            //model = glm.scale(model,new vec3(0.2f));
            textureShader.Bind(GL);
            textureShader.SetUniform(GL, "projectionMatrix", glm.perspective(myGLM.D2R(60), (float)cWidth / (float)cHeight, 0.01f, 100.0f));
            textureShader.SetUniform(GL, "viewMatrix", mat4.identity()); // glm.lookAt(new vec3(0f, 0f, -6f), new vec3(0f, 0f, 0f), new vec3(0.0f, 1.0f, 0.0f))
            textureShader.SetUniform(GL, "modelMatrix", model);
            textureShader.SetUniform(GL, "normalMatrix", myGLM.transpose(glm.inverse(model)));

            //textureShader.SetUniform(GL, "sunLight.vColor", new vec3(1f, 1f, 1f));
            //textureShader.SetUniform(GL, "sunLight.Ka", new vec3(.1f, .1f, .1f));
            //textureShader.SetUniform(GL, "sunLight.Kd", new vec3(1f, 1f, 1f));
            //textureShader.SetUniform(GL, "sunLight.vDirection", new vec3(0f, 0f, 1f));
            //textureShader.SetUniform(GL, "specLight.vDirection", new vec3(0f, 0f, 0f));
            //textureShader.SetUniform(GL, "specLight.Ks", new vec3(.9f, .9f, .9f));
            //textureShader.SetUniform(GL, "specLight.Shininess", 100f);

            _compass.Render(GL, textureShader);

            //model = mat4.identity();
            //model = glm.translate(model, new vec3(7, -3, -6));
            //model = glm.rotate(model, D2R(-1 * _compassRot), new vec3(0f, 0f, 1f));
            //model = glm.scale(model, new vec3(.1f, .8f, 1f));

            //textureShader.SetUniform(GL, "projectionMatrix", glm.perspective(D2R(60), (float)cWidth / (float)cHeight, 0.01f, 100.0f));
            //textureShader.SetUniform(GL, "viewMatrix", mat4.identity()); // glm.lookAt(new vec3(0f, 0f, -6f), new vec3(0f, 0f, 0f), new vec3(0.0f, 1.0f, 0.0f))
            //textureShader.SetUniform(GL, "modelMatrix", model);
            //textureShader.SetUniform(GL, "normalMatrix", myGLM.transpose(glm.inverse(model)));
            //_cArrow.Render(GL, textureShader);

            textureShader.Unbind(GL);
        }
Esempio n. 2
0
        void RenderFizzDemo(OpenGL gl)
        {
            for (int j = 0; j < POINT_TYPES; j++)
            {
                _p[j].Size = (float)rand.NextDouble() * POINT_DEFAULT_SIZE;
                for (int i = 0; i < POINTS; i++)
                {
                    _p[j].Pos[i].x   = rf(); _p[j].Pos[i].y = rf(); _p[j].Pos[i].z = 1; // No 3D!!
                    _p[j].Color[i].x = rf(); _p[j].Color[i].y = rf(); _p[j].Color[i].z = rf(); _p[j].Color[i].w = rf();
                }
            }


            simpleShader.Bind(gl);
            for (int j = 0; j < POINT_TYPES; j++)
            {
                _p[j].Render(gl, simpleShader);
            }
            simpleShader.Unbind(gl);
        }