private void glControl1_Load(object sender, EventArgs e) { // Enable depth test GL.Enable(EnableCap.DepthTest); // Set the viewport GL.Viewport(glControl1.ClientRectangle); // Compile and link shaders string vertexShaderSrc = Encoding.ASCII.GetString(Properties.Resources.VertexShader); string fragmentShaderSrc = Encoding.ASCII.GetString(Properties.Resources.FragmentShader); shaderProgram = new SmShaderProgram(vertexShaderSrc, fragmentShaderSrc); // Construct the projection matrix projectionMatrix = Matrix4.CreatePerspectiveFieldOfView(MathHelper.DegreesToRadians(45.0f), (float)glControl1.Width / (float)glControl1.Height, 1.0f, 20000.0f); // Check the maximum line width supported float[] widthRange = new float[2]; GL.GetFloat(GetPName.LineWidthRange, widthRange); if (widthRange[1] < 3.0f) { throw new Exception("Graphics card or driver does not support required line width"); } }
private void glControl1_Load(object sender, EventArgs e) { // Enable depth test GL.Enable(EnableCap.DepthTest); // Set the viewport GL.Viewport(glControl1.ClientRectangle); // Compile and link shaders string vertexShaderSrc = Encoding.ASCII.GetString(Properties.Resources.VertexShader); string fragmentShaderSrc = Encoding.ASCII.GetString(Properties.Resources.FragmentShader); shaderProgram = new SmShaderProgram(vertexShaderSrc, fragmentShaderSrc); // Construct the projection matrix projectionMatrix = Matrix4.CreatePerspectiveFieldOfView(MathHelper.DegreesToRadians(45.0f), (float)glControl1.Width / (float)glControl1.Height, 1.0f, 20000.0f); }