Click here to Skip to main content
15,611,545 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to draw line in c# using sharpgl but when i compile the code it gives me the console with full of white color not the line,how to solve this this problem or is there any mistake in my code.Here is the code.


private static int width = 400, height = 300;
static void Main(string[] args)
{
Glut.glutInit();
Glut.glutInitDisplayMode(Glut.GLUT_SINGLE | Glut.GLUT_RGB);
Glut.glutInitWindowSize(width, height);
Glut.glutCreateWindow("OpenGL Tutorial");
init();
Glut.glutDisplayFunc(OnDisplay);
Glut.glutMainLoop();
}
private static void OnDisplay()
{
Gl.glClear(Gl.GL_COLOR_BUFFER_BIT);
Gl.glColor3f(0.0f, 0.4f, 0.2f);
Gl.glBegin(Gl.GL_LINES);
Gl.glVertex2i(180, 15);
Gl.glVertex2i(10, 145);
Gl.glEnd();
Gl.glFlush();
}
static void init()
{
Gl.glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
Gl.glMatrixMode(Gl.GL_PROJECTION);
// Gl.glLoadIdentity();
Gl.glOrtho(0.0, 200.0, 0.0, 1.0, -1.0, 1.0);
}
Posted
Updated 28-Jan-15 18:57pm
v2

1 solution

 
Share this answer
 
Comments
Member 11061422 29-Jan-15 1:50am    
That is on Window form but i am doing this on sharpgl console .

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900