Beispiel #1
0
        public void ResetColorTransform()
        {
            brightness     = 1.0f;
            contrast       = 1.0f;
            blackTolerance = 0;
            whiteTolerance = 255;
            paletteFirst   = false;

            if (output is null)
            {
                return;
            }
            Create(null, null, false);
            output.Invalidate();
        }
Beispiel #2
0
        public void DrawPyramid()
        {
            Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT);
            Gl.glLoadIdentity();

            float[] fogColor = new float[4] {
                0.5f, 0.5f, 0.5f, 1.0f
            };
            Gl.glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
            Gl.glEnable(Gl.GL_COLOR_MATERIAL);
            float[] matdiffu = new float[] { 1.0f, 1.0f, 1.0f, 1.0f };
            Gl.glMaterialfv(Gl.GL_FRONT_AND_BACK, Gl.GL_DIFFUSE, matdiffu);

            float[] light1_diffuse  = new float[] { 1.0f, 1.0f, 1.0f, 0.0f };
            float[] light1_position = new float[] { -1.0f, -1.0f, -1.0f, 1.0f };
            float[] light2_position = new float[] { -1f, 1f, 0f, 1.0f };

            // light
            Gl.glEnable(Gl.GL_LIGHT1);
            Gl.glEnable(Gl.GL_LIGHT0);
            Gl.glLightfv(Gl.GL_LIGHT1, Gl.GL_DIFFUSE, light1_diffuse);
            Gl.glLightfv(Gl.GL_LIGHT1, Gl.GL_POSITION, light1_position);
            Gl.glLightfv(Gl.GL_LIGHT0, Gl.GL_DIFFUSE, light1_diffuse);
            Gl.glLightfv(Gl.GL_LIGHT0, Gl.GL_POSITION, light2_position);

            // textures
            Gl.glEnable(Gl.GL_TEXTURE_2D);

            Gl.glBindTexture(Gl.GL_TEXTURE_2D, mGlTextureObject);

            Gl.glRotatef(angle, 0.0f, 0.5f, 0.5f);
            Gl.glScalef(zoom, zoom, zoom);

            Gl.glBegin(Gl.GL_TRIANGLES);

            Gl.glTexCoord2f(0.0f, 0.0f);
            Gl.glVertex3f(0.0f, 1f, 0.0f);
            Gl.glTexCoord2f(0.5f, 1.0f);
            Gl.glVertex3f(-1.0f, -1.0f, 1.0f);
            Gl.glTexCoord2f(1.0f, 0.0f);
            Gl.glVertex3f(1.0f, -1.0f, 1.0f);

            Gl.glEnd();
            Gl.glDisable(Gl.GL_TEXTURE_2D);
            Gl.glBegin(Gl.GL_TRIANGLES);

            Gl.glColor3f(0.3f, 1.0f, 0.5f);

            // Gl.glTexCoord2f(0.0f, 0.0f);
            Gl.glVertex3f(0.0f, 1.0f, 0.0f);
            // Gl.glTexCoord2f(0.5f, 1.0f);
            Gl.glVertex3f(-1.0f, -1.0f, 1.0f);
            // Gl.glTexCoord2f(1.0f, 0.0f);
            Gl.glVertex3f(0.0f, -1.0f, -1.0f);

            Gl.glColor3f(0.0f, 0.0f, 1.0f);
            Gl.glVertex3f(0.0f, 1.0f, 0.0f);
            Gl.glVertex3f(0.0f, -1.0f, -1.0f);
            Gl.glVertex3f(1.0f, -1.0f, 1.0f);

            Gl.glColor3f(0.6f, 0.2f, 0.0f);
            Gl.glVertex3f(-1.0f, -1.0f, 1.0f);
            Gl.glVertex3f(0.0f, -1.0f, -1.0f);
            Gl.glVertex3f(1.0f, -1.0f, 1.0f);

            Gl.glEnd();
            Gl.glPopMatrix();
            Gl.glFlush();
            OpenGLControl.Invalidate();
        }