protected override void InternalRender(FrameEventArgs e) { GL.Color4(1.0f, 1.0f, 1.0f, 1.0f); GL.BlendColor(1.0f, 1.0f, 1.0f, 1.0f); GL.PushAttrib(AttribMask.EnableBit); GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); GL.BindTexture(TextureTarget.Texture2D, texture); GL.Begin(BeginMode.Quads); GL.TexCoord2(0.0f, to); GL.Vertex2(0.0f, 0.0f); GL.TexCoord2(0.5f, to); GL.Vertex2(this.Height, 0.0f); GL.TexCoord2(0.5f, to + 0.25f); GL.Vertex2(this.Height, this.Height); GL.TexCoord2(0.0f, to + 0.25f); GL.Vertex2(0.0f, this.Height); GL.TexCoord2(0.5f, to); GL.Vertex2(this.Height, 0.0f); GL.TexCoord2(1.0f, to); GL.Vertex2(this.Width - this.Height + 1.0f, 0.0f); GL.TexCoord2(1.0f, to + 0.25f); GL.Vertex2(this.Width - this.Height + 1.0f, this.Height); GL.TexCoord2(0.5f, to + 0.25f); GL.Vertex2(this.Height, this.Height); GL.TexCoord2(0.5f, to); GL.Vertex2(this.Width - this.Height, 0.0f); GL.TexCoord2(0.0f, to); GL.Vertex2(this.Width, 0.0f); GL.TexCoord2(0.0f, to + 0.25f); GL.Vertex2(this.Width, this.Height); GL.TexCoord2(0.5f, to + 0.25f); GL.Vertex2(this.Width - this.Height, this.Height); GL.End(); GL.Disable(EnableCap.Texture2D); GL.RasterPos2((this.Width >> 0x01) - 0x0a * this.Text.Length - 0x05, (this.Height >> 0x01) - 0x10); OpenGLFont.PrintString(this.Text); GL.PopAttrib(); }
private void recalcText() { Queue <string> txt = new Queue <string>(); OpenGLFont.splitWidth(this.fulltext, this.wwidth - 150.0f, txt); this.text = txt.ToArray(); }
public void Render(FrameEventArgs e) { if (this.enabled) { /* * GL.Color3(0.0f,0.0f,0.0f); * GL.Vertex2(0.0f,0.0f); * GL.Vertex2(this.wwidth,0.0f); * GL.Vertex2(0.0f,height); * GL.Vertex2(this.wwidth,height); * * GL.Vertex2(0.0f,this.wheight-height); * GL.Vertex2(this.wwidth,this.wheight-height); * GL.Vertex2(0.0f,this.wheight); * GL.Vertex2(this.wwidth,this.wheight);//*/ GL.Color3(0.0f, 0.5f, 1.0f); for (int i = 0x00; i < this.text.Length; i++) { GL.RasterPos2(10.0f, this.wheight - height + OpenGLFont.FontHeight * i); OpenGLFont.PrintString(this.text[i]); } GL.Color3(1.0f, 1.0f, 1.0f); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); OpenGLFont.LoadFont(); this.WindowState = WindowState.Fullscreen; GL.Enable(EnableCap.DepthTest); GL.Enable(EnableCap.CullFace); GL.Enable(EnableCap.Lighting); GL.Enable(EnableCap.Light0); GL.Enable(EnableCap.ColorMaterial); GL.Enable(EnableCap.LineSmooth); GL.ShadeModel(ShadingModel.Smooth); this.LoadScene(new PrologueScene()); /*GL.Light(LightName.Light0, LightParameter.Ambient, LightAmbient); * GL.Light(LightName.Light0, LightParameter.Diffuse, LightDiffuse); * GL.Light(LightName.Light0, LightParameter.Position, LightPosition); * GL.Light(LightName.Light0, LightParameter.Specular, LightSpecular);*/ GL.Light(LightName.Light0, LightParameter.Position, this.l0[0x00]); GL.Light(LightName.Light0, LightParameter.Ambient, this.l0[0x01]); GL.Light(LightName.Light0, LightParameter.Diffuse, this.l0[0x02]); GL.Light(LightName.Light0, LightParameter.Specular, this.l0[0x03]); GL.Light(LightName.Light0, LightParameter.SpotExponent, this.l0[0x04]); GL.LightModel(LightModelParameter.LightModelAmbient, this.l0[0x05]); GL.LightModel(LightModelParameter.LightModelTwoSide, 0); GL.LightModel(LightModelParameter.LightModelLocalViewer, 0); GL.ColorMaterial(MaterialFace.FrontAndBack, ColorMaterialParameter.AmbientAndDiffuse); //GL.Material(MaterialFace.FrontAndBack, MaterialParameter.Specular, MaterialSpecular); GL.Material(MaterialFace.FrontAndBack, MaterialParameter.Shininess, SurfaceShininess); this.Mouse.Move += HandleMousehandleMove; this.Mouse.ButtonDown += HandleMousehandleButtonDown; this.Mouse.ButtonUp += this.cam.OnMouseUp; this.Mouse.WheelChanged += this.cam.OnMouseWheel; }
public void Render(OpenTK.FrameEventArgs e) { OpenGLFont.PrintString(this.totalMessage); }