PDA

View Full Version : Program stops working after driver change.



manasij7479
10-22-2011, 09:48 PM
I use Arch Linux and recently switched from nouveau to the Nvidia provided drivers.
After that, the following function, which I called from the main draw function(which is provided to glutDisplayFunc), stopped working... It compiles, but nothing appears on screen.


void draw_axes_2d(int width,int height, int grad = 10)
{
glBegin(GL_LINE); // Drawing the axes
glVertex2f(-width/2,0);
glVertex2f(width/2,0);
glVertex2f(0,-height/2);
glVertex2f(0,height/2);
glEnd();
glPointSize(2.0);
glBegin(GL_POINT); // Graduations
int c=0;
for(c = 0;c<width/2;c+=grad)
glVertex2i(c,0);
for(c = 0;c>-width/2;c-=grad)
glVertex2i(c,0);
for(c = 0;c<height/2;c+=grad)
glVertex2i(0,c);
for(c = 0;c>-height/2;c-=grad)
glVertex2i(0,c);
glEnd();
glPointSize(1);
}
It is not a problem with coordinate settings, because I can call the following function, and see a circle drawn.


void draw_circle(GLfloat c_x,GLfloat c_y, GLfloat radius, GLfloat degree_gradient=1.0)
{
float pi = 3.14159;
float rg = degree_gradient*pi/180;

glBegin(GL_LINE_LOOP);
for(float f = 0;f<2*pi;f+=rg)
glVertex2f(radius*cos(f)+c_x,radius*sin(f)+c_y);

glEnd();
glBegin(GL_POINT);
glVertex2i(c_x,c_y);
glEnd();
glFlush();
}

mbentrup
10-23-2011, 12:22 AM
glBegin(GL_LINE); // Drawing the axes


That should be GL_LINES (and later GL_POINTS).