PDA

View Full Version : repeating lines???



cali
10-03-2001, 12:44 AM
Hi

Here is the code that I have been working on for the last few hours....I know that I have to use a for loop to make my lines repeat, but how do I go about doing this?

void DrawPixel( int x, int y )
{
glBegin( GL_POINTS );
glVertex2f( x,y );
glEnd( );
}

void DrawLine( float x0, float y0, float x1, float y1 )
{
//-------------------------------------------
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// repeatedly call DrawPixel from this function
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//-------------------------------------------

for(????)


glutSwapBuffers( );
}

thank you ALLL for everything!
I wish I caould buy you all Drinks! http://www.opengl.org/discussion_boards/ubb/smile.gif

Gavin
10-03-2001, 01:06 AM
Are you drawing straight lines?
why not use GL_LINE etc.?

cali
10-03-2001, 01:13 AM
Hi Gavin,

thanks for the reply, and I am drawing straight lines. How do I go about using GL_Lines???

ahhh!!!!!

cali
10-03-2001, 01:16 AM
Actually, I need to use drawpixel and use my DrawLine function to call drawpixel repeatedly so that can just press a key and have that line repeat over and over....

*sigh*

cal

Gavin
10-03-2001, 01:43 AM
glBegin(GL_LINES);
glVertex3f(sx, sy, sz);
glVertex3f(ex, ey, ez)
glEnd();

Obviously you can repeat this as many times as you want.