glShadeModel() private méthode

private glShadeModel ( uint mode ) : void
mode uint
Résultat void
Exemple #1
0
        protected virtual void initRenderingGL()
        {
            if (m_uint_DC == 0 || m_uint_RC == 0)
            {
                return;
            }
            if (this.Width == 0 || this.Height == 0)
            {
                return;
            }
            GL.glClearColor(0.5f, 0.9f, 1.0f, 1.0f);
            GL.glEnable(GL.GL_DEPTH_TEST);
            GL.glDepthFunc(GL.GL_LEQUAL);


            //GL.glHint(GL.GL_PERSPECTIVE_CORRECTION_Hint, GL.GL_NICEST);

            GL.glViewport(0, 0, this.Width, this.Height);
            GL.glMatrixMode(GL.GL_PROJECTION);
            GL.glLoadIdentity();


            GL.glShadeModel(GL.GL_SMOOTH);

            GLU.gluPerspective(60, (float)Width / (float)Height, 0.45f, 1000.0f);

            GenerateTextures(1);//////////////////////////////////////

            GL.glMatrixMode(GL.GL_MODELVIEW);
            GL.glLoadIdentity();
        }
Exemple #2
0
        protected virtual void initRenderingGL()
        {
            if (m_uint_DC == 0 || m_uint_RC == 0)
            {
                return;
            }

            GL.glShadeModel(GL.GL_SMOOTH);
            GL.glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
            GL.glClearDepth(1.0f);

            GL.glEnable(GL.GL_LIGHT0);
            GL.glEnable(GL.GL_COLOR_MATERIAL);
            GL.glColorMaterial(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT_AND_DIFFUSE);

            GL.glEnable(GL.GL_DEPTH_TEST);
            GL.glDepthFunc(GL.GL_LEQUAL);
            GL.glHint(GL.GL_PERSPECTIVE_CORRECTION_Hint, GL.GL_NICEST);

            GL.glViewport(0, 0, Width, Height);
            GL.glClearColor(0, 0, 0, 0);
            GL.glMatrixMode(GL.GL_PROJECTION);
            GL.glLoadIdentity();
            GLU.gluPerspective(45.0, 1.0, 1.0, 1000.0);
            GL.glMatrixMode(GL.GL_MODELVIEW);
            GL.glLoadIdentity();
            GL.glGetDoublev(GL.GL_MODELVIEW_MATRIX, AccumulatedTraslations);

            InitTexture("SurgeryRoom.bmp");
        }
Exemple #3
0
        public void initRenderingGL()
        {
            if (m_uint_DC == 0 || m_uint_RC == 0)
            {
                return;
            }
            if (this.Width == 0 || this.Height == 0)
            {
                return;
            }

            GL.glShadeModel(GL.GL_SMOOTH);
            GL.glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
            GL.glClearDepth(1.0f);

            GL.glEnable(GL.GL_LIGHT0);
            GL.glEnable(GL.GL_COLOR_MATERIAL);
            GL.glColorMaterial(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT_AND_DIFFUSE); // GL.GL_AMBIENT_AND_DIFFUSE / GL.GL_SHININESS


            //GL.glEnable(GL.GL_DEPTH_TEST);
            GL.glDepthFunc(GL.GL_LEQUAL);

            GL.glViewport(0, 0, this.Width, this.Height);
            GL.glMatrixMode(GL.GL_PROJECTION);
            GL.glLoadIdentity();

            GLU.gluPerspective(45, ((double)Width) / Height, 1.0, 1000.0);
            GL.glMatrixMode(GL.GL_MODELVIEW);
            //save the current MODELVIEW Matrix (now it is Identity)
            //GL.glGetDoublev(GL.GL_MODELVIEW_MATRIX, AccumulatedRotationsTraslations);

            InitTexture("IMG\\1.bmp");
        }
        protected virtual void initRenderingGL()
        {
            if (m_DeviceContext == 0 || m_RenderingContext == 0)
            {
                return;
            }
            if (m_DisplayPanel.Width == 0 || m_DisplayPanel.Height == 0)
            {
                return;
            }

            GL.glShadeModel(GL.GL_SMOOTH);
            GL.glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
            GL.glClearDepth(1.0f);


            GL.glClearColor(0.5f, 0.5f, 0.5f, 0.0f);
            GL.glEnable(GL.GL_DEPTH_TEST);
            GL.glDepthFunc(GL.GL_LEQUAL);
            GL.glHint(GL.GL_PERSPECTIVE_CORRECTION_Hint, GL.GL_NICEST);

            GL.glViewport(0, 0, m_DisplayPanel.Width, m_DisplayPanel.Height);
            GL.glMatrixMode(GL.GL_PROJECTION);
            GL.glLoadIdentity();

            //nice 3D
            GLU.gluPerspective(70.0, 1.0, 0.4, 500.0);

            GL.glMatrixMode(GL.GL_MODELVIEW);
            GL.glLoadIdentity();
            TextureUtills.GenerateTextures();
            //save the current MODELVIEW Matrix (now it is Identity)
            GL.glGetDoublev(GL.GL_MODELVIEW_MATRIX, AccumulatedRotationsTraslations);
        }
Exemple #5
0
        protected virtual void initRenderingGL()
        {
            if (m_uint_DC == 0 || m_uint_RC == 0)
            {
                return;
            }
            if (this.Width == 0 || this.Height == 0)
            {
                return;
            }
            GL.glShadeModel(GL.GL_SMOOTH);
            GL.glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
            GL.glClearDepth(1.0f);


            GL.glEnable(GL.GL_LIGHT0);
            GL.glEnable(GL.GL_COLOR_MATERIAL);
            GL.glColorMaterial(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT_AND_DIFFUSE);

            GL.glEnable(GL.GL_DEPTH_TEST);
            GL.glDepthFunc(GL.GL_LEQUAL);
            GL.glHint(GL.GL_PERSPECTIVE_CORRECTION_Hint, GL.GL_NICEST);

            GL.glViewport(0, 0, this.Width, this.Height);
            GL.glMatrixMode(GL.GL_PROJECTION);
            GL.glLoadIdentity();

            //nice 3D
            GLU.gluPerspective(45.0, 1.0, 0.4, 100.0);

            //! TEXTURE 1a
            GL.glEnable(GL.GL_COLOR_MATERIAL);
            float[] emis = { 0.3f, 0.3f, 0.3f, 1 };
            GL.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_EMISSION, emis);
            //! TEXTURE 1a



            GL.glShadeModel(GL.GL_SMOOTH);
            GLU.gluPerspective(viewAngle, (float)Width / (float)Height, 0.45f, 30.0f);

            GL.glMatrixMode(GL.GL_MODELVIEW);
            GL.glLoadIdentity();

            //! TEXTURE 1a
            GenerateTextures();
            //! TEXTURE 1b
            //save the current MODELVIEW Matrix (now it is Identity)
            GL.glGetDoublev(GL.GL_MODELVIEW_MATRIX, AccumulatedRotationsTraslations);
        }
Exemple #6
0
        protected virtual void initRenderingGL()
        {
            if (m_uint_DC == 0 || m_uint_RC == 0)
            {
                return;
            }
            if (this.Width == 0 || this.Height == 0)
            {
                return;
            }
            GL.glShadeModel(GL.GL_SMOOTH);
            GL.glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
            GL.glClearDepth(1.0f);

            if (GlobalProperties.LightBeamOn)
            {
                GL.glEnable(GL.GL_LIGHT0);
            }
            GL.glEnable(GL.GL_COLOR_MATERIAL);
            GL.glColorMaterial(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT_AND_DIFFUSE);

            GL.glEnable(GL.GL_DEPTH_TEST);
            GL.glDepthFunc(GL.GL_LEQUAL);

            GL.glViewport(0, 0, this.Width, this.Height);
            GL.glClearColor(0, 0, 0, 0);
            GL.glMatrixMode(GL.GL_PROJECTION);
            GL.glLoadIdentity();

            GLU.gluPerspective(90.0, ((double)Width) / Height, 1.0, 1000.0);
            GL.glMatrixMode(GL.GL_MODELVIEW);
            GL.glLoadIdentity();


            GenerateTextures();
        }
        public void Draw()
        {
            if (m_uint_DC == 0 || m_uint_RC == 0)
            {
                return;
            }

            GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT | GL.GL_STENCIL_BUFFER_BIT);

            //TRIVIAL
            GL.glViewport(0, 0, Width, Height);
            GL.glLoadIdentity();
            GL.glEnable(GL.GL_NORMALIZE);

            GLU.gluLookAt(ScrollValue[0], ScrollValue[1], ScrollValue[2],
                          ScrollValue[3], ScrollValue[4], ScrollValue[5],
                          ScrollValue[6], ScrollValue[7], ScrollValue[8]);



            pos[0] = light_position[0] = ScrollValue[9];
            pos[1] = light_position[1] = ScrollValue[10];
            pos[2] = light_position[2] = ScrollValue[11];
            pos[3] = light_position[3] = 0;

            light_position_reflected[0] = -ScrollValue[9];
            light_position_reflected[1] = -ScrollValue[10];
            light_position_reflected[2] = -ScrollValue[11];
            light_position[3]           = 0;

            GL.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, light_position);
            GL.glEnable(GL.GL_LIGHT0);

            GL.glLightfv(GL.GL_LIGHT1, GL.GL_POSITION, light_position);
            GL.glEnable(GL.GL_LIGHT1);

            //beascender look angle
            GL.glTranslatef(0.0f, -50.0f, -340.0f); //how far from the lake
            GL.glTranslatef(0.0f, 1.0f, 0.0f);      //height from the lake
            GL.glRotatef(25, 1.0f, 0, 0);           //look at lake angle

            GL.glRotatef(xAngle, 1.0f, 0.0f, 0.0f);
            if (checkBox)
            {
                GL.glRotatef((float)spirala * 0.018f, 0.0f, 1.0f, 0.0f);
                GL.glRotatef((float)speed * 0.008f, 1.0f, 1.0f, 0.0f);
                GL.glRotatef((float)speed * 0.008f, 0.0f, 1.0f, 1.0f);
                GL.glRotatef((float)speed * -0.005f, 1.0f, 0.0f, 1.0f);
            }
            GL.glRotatef(yAngle, 0.0f, 1.0f, 0.0f);
            GL.glRotatef(zAngle, 0.0f, 0.0f, 1.0f);
            if (checkBox)
            {
                GL.glTranslatef(xShift, yShift + (float)-speed * 0.18f, zShift);
            }
            GL.glTranslatef(xShift, yShift, zShift);



            /*
             *
             * Reflection drawing area start here
             *
             */

            GL.glPushMatrix();

            GL.glEnable(GL.GL_BLEND);
            GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);

            //draw only to STENCIL buffer
            GL.glEnable(GL.GL_STENCIL_TEST);
            GL.glStencilOp(GL.GL_REPLACE, GL.GL_REPLACE, GL.GL_REPLACE);
            GL.glStencilFunc(GL.GL_ALWAYS, 1, 0xFFFFFFFF);
            GL.glColorMask((byte)GL.GL_FALSE, (byte)GL.GL_FALSE, (byte)GL.GL_FALSE, (byte)GL.GL_FALSE);
            GL.glDisable(GL.GL_DEPTH_TEST);

            Drawlake();//Draw area when we want to see reflect

            // restore regular seascendings
            GL.glColorMask((byte)GL.GL_TRUE, (byte)GL.GL_TRUE, (byte)GL.GL_TRUE, (byte)GL.GL_TRUE);
            GL.glEnable(GL.GL_DEPTH_TEST);

            // reflection is drawn only where STENCIL buffer value equal to 1
            GL.glStencilFunc(GL.GL_EQUAL, 1, 0xFFFFFFFF);
            GL.glStencilOp(GL.GL_KEEP, GL.GL_KEEP, GL.GL_KEEP);


            /*
             * draw reflected scene
             */

            GL.glScalef(1, -1, 1); //swap axes down


            GL.glPushMatrix();
            DrawTexturedCube();

            //reflected penguin
            drawPenguin();

            draw_sun();
            draw_moon();
            GL.glPopMatrix();


            GL.glPopMatrix();
            GL.glEnable(GL.GL_LIGHTING);

            Drawlake();

            GL.glDisable(GL.GL_LIGHTING);


            GL.glStencilFunc(GL.GL_NOTEQUAL, 1, 0xFFFFFFFF);
            GL.glStencilOp(GL.GL_KEEP, GL.GL_KEEP, GL.GL_KEEP);

            GL.glDepthMask((byte)GL.GL_FALSE);
            GL.glDepthMask((byte)GL.GL_TRUE);

            drawFloorTextured();

            draw_sun();
            draw_moon();


            GL.glDisable(GL.GL_STENCIL_TEST);

            DrawTexturedCube();    //SKY BOX



            /*
             *
             * paint main scene area - start here
             *
             */

            // drawaxe();



            GL.glShadeModel(GL.GL_FLAT);

            GL.glEnable(GL.GL_LIGHTING);

            //Main Penguin
            drawPenguin();



            /////////

            GL.glDisable(GL.GL_LIGHTING);



            /*
             *
             * Draw shadows area - start here
             *
             */
            GL.glDisable(GL.GL_LIGHTING);


            GL.glPushMatrix();

            MakeShadowMatrix(ground);  //sending fround matrix
            GL.glMultMatrixf(cubeXform);

            GL.glShadeModel(GL.GL_FLAT);
            GL.glColor3d(0, 0, 0);//black

            drawPenguinShade();

            GL.glPopMatrix();



            GL.glFlush();
            WGL.wglSwapBuffers(m_uint_DC);
        }