private void MDL0Viewer_Load(object sender, EventArgs e) { simpleOpenGlControl1.InitializeContexts(); Gl.ReloadFunctions(); //Gl.glEnable(Gl.GL_LIGHTING); Gl.glEnable(Gl.GL_RESCALE_NORMAL); Gl.glEnable(Gl.GL_COLOR_MATERIAL); Gl.glEnable(Gl.GL_DEPTH_TEST); Gl.glEnable(Gl.GL_NORMALIZE); Gl.glDisable(Gl.GL_CULL_FACE); Gl.glFrontFace(Gl.GL_CCW); Gl.glEnable(Gl.GL_TEXTURE_2D); Gl.glClearDepth(1); Gl.glEnable(Gl.GL_ALPHA_TEST); Gl.glAlphaFunc(Gl.GL_GREATER, 0f); Gl.glEnable(Gl.GL_BLEND); Gl.glBlendFunc(Gl.GL_SRC_ALPHA, Gl.GL_ONE_MINUS_SRC_ALPHA); //Gl.glTexEnvf(Gl.GL_TEXTURE_ENV, Gl.GL_TEXTURE_ENV_MODE, Gl.GL_BLEND); Gl.glShadeModel(Gl.GL_SMOOTH); Gl.glDepthFunc(Gl.GL_LEQUAL); Gl.glClearColor(51f / 255f, 51f / 255f, 51f / 255f, 0f); if (Resource.Data.Textures != null && Model != null) { int i = 0; foreach (var v in Model.Materials) { if (v.Tex0 != null) { UploadTex(v.Tex0, i * 4 + 0 + 1); } if (v.Tex1 != null) { UploadTex(v.Tex1, i * 4 + 1 + 1); } if (v.Tex2 != null) { UploadTex(v.Tex2, i * 4 + 2 + 1); } //if (v.Tex3 != null) UploadTex(v.Tex3, i * 4 + 3 + 1); i++; } } if (Model != null) { Shaders = new CGFXShader[Model.Materials.Length]; } //GlNitro.glNitroBindTextures(file, 1); glversion = Gl.glGetString(Gl.GL_VERSION); init = true; Render(); }
private void MDL0Viewer_Load(object sender, EventArgs e) { simpleOpenGlControl1.InitializeContexts(); //GL.Enable(GL.GL_LIGHTING); GL.Enable(EnableCap.RescaleNormal); GL.Enable(EnableCap.ColorMaterial); GL.Enable(EnableCap.DepthTest); GL.Enable(EnableCap.Normalize); GL.Disable(EnableCap.CullFace); GL.FrontFace(FrontFaceDirection.Ccw); GL.Enable(EnableCap.Texture2D); GL.ClearDepth(1); GL.Enable(EnableCap.AlphaTest); GL.AlphaFunc(AlphaFunction.Greater, 0f); GL.Enable(EnableCap.Blend); GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha); //GL.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_BLEND); GL.ShadeModel(ShadingModel.Smooth); GL.DepthFunc(DepthFunction.Lequal); GL.ClearColor(51f / 255f, 51f / 255f, 51f / 255f, 0f); if (Resource.Data.Textures != null && Model != null) { int i = 0; foreach (var v in Model.Materials) { if (v.Tex0 != null) { UploadTex(v.Tex0, i * 4 + 0 + 1); } if (v.Tex1 != null) { UploadTex(v.Tex1, i * 4 + 1 + 1); } if (v.Tex2 != null) { UploadTex(v.Tex2, i * 4 + 2 + 1); } //if (v.Tex3 != null) UploadTex(v.Tex3, i * 4 + 3 + 1); i++; } } if (Model != null) { Shaders = new CGFXShader[Model.Materials.Length]; } //GlNitro.glNitroBindTextures(file, 1); glversion = GL.GetString(StringName.Version); init = true; Render(); }