Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualKevn

Posted 13 October 2012 - 09:53 PM

not sure what that means Posted Image
Well, I got my program to draw a line one pixel at a time using glDrawPixels. Only it repeats the same line over and over to the right and left of the line I told it to draw. So like if I told it to draw a line from position (100,100) to (600,600). there will be a line there but then another like from (300,100) to (900, 600). and another so many pixels to the right and left in the x direction over.

the code in question, the linebres just uses a line algorithm that calls setPixel however many times needed to draw the line:
struct RGBType {
float r;
float g;
float b;
};
RGBType *pixel_buffer = new RGBType[800 * 1200];
using namespace std;
int window_height = 800;
int window_width = 1200;
void setPixel(int x, int y)
{
  pixel_buffer[800*y + x].r=0.5;
  pixel_buffer[800*y + x].g=0.5;
  pixel_buffer[800*y + x].b=0.5;
}

void display(void) {
glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT);
lineBres(100, 100, 600, 600);
glDrawPixels(window_width, window_height, GL_RGB, GL_FLOAT, pixel_buffer);
glutSwapBuffers();
delete[] pixel_buffer;
glLoadIdentity();
}
int main(int argc, char* argv[])
{
glutInit(&argc, argv);		  
glutInitWindowSize (window_width, window_height);
glutInitWindowPosition (100,100);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
glutCreateWindow ("Project 1");
glViewport(0, 0, 800, 1200);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity( );
glMatrixMode(GL_PROJECTION);
glLoadIdentity( );
gluOrtho2D(0.0, 800.0, 0.0, 1200.0);
glutDisplayFunc(display);
glutMainLoop();

return 0;
}

#5Kevn

Posted 13 October 2012 - 09:53 PM

not sure what that means Posted Image
Well, I got my program to draw a line one pixel at a time using glDrawPixels. Only it repeats the same line over and over to the right and left of the line I told it to draw. So like if I told it to draw a line from position (100,100) to (600,600). there will be a line there but then another like from (300,100) to (900, 600). and another so many pixels to the right and left in the x direction over.

the code in question, the linebres just uses a line algorithm that calls setPixel however many times needed to draw the line:
struct RGBType {
float r;
float g;
float b;
};
RGBType *pixel_buffer = new RGBType[800 * 1200];
using namespace std;
int window_height = 800;
int window_width = 1200;
void setPixel(int x, int y)
{
  pixel_buffer[800*y + x].r=0.5;
  pixel_buffer[800*y + x].g=0.5;
  pixel_buffer[800*y + x].b=0.5;
}

void display(void) {
glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT);
lineBres(100, 100, 600, 600);
glDrawPixels(window_width, window_height, GL_RGB, GL_FLOAT, pixel_buffer);
glutSwapBuffers();
delete[] pixel_buffer;
glLoadIdentity();
}
int main(int argc, char* argv[])
{
glutInit(&argc, argv);		  
glutInitWindowSize (window_width, window_height);
glutInitWindowPosition (100,100);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
glutCreateWindow ("Project 1");
glViewport(0, 0, 800, 1200);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity( );
glMatrixMode(GL_PROJECTION);
glLoadIdentity( );
gluOrtho2D(0.0, 800.0, 0.0, 1200.0);
glutDisplayFunc(display);[/sup]
[sup]glutMainLoop();

return 0;
}

#4Kevn

Posted 13 October 2012 - 09:47 PM

not sure what that means Posted Image
Well, I got my program to draw a line one pixel at a time using glDrawPixels. Only it repeats the same line over and over to the right and left of the line I told it to draw. So like if I told it to draw a line from position (100,100) to (600,600). there will be a line there but then another like from (300,100) to (900, 600). and another so many pixels to the right and left in the x direction over.

the code in question, the linebres just uses a line algorithm that calls setPixel however many times needed to draw the line:
struct RGBType {
float r;
float g;
float b;
};
RGBType *pixel_buffer = new RGBType[800 * 1200];
using namespace std;
int window_height = 800;
int window_width = 1200;
void setPixel(int x, int y)
{
  pixel_buffer[800*y + x].r=0.5;
  pixel_buffer[800*y + x].g=0.5;
  pixel_buffer[800*y + x].b=0.5;
}

void display(void) {
glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT);
lineBres(100, 100, 600, 600);
glDrawPixels(window_width, window_height, GL_RGB, GL_FLOAT, pixel_buffer);
glutSwapBuffers();
delete[] pixel_buffer;
glLoadIdentity();
}
int main(int argc, char* argv[])
{
glutInit(&argc, argv);		  
glutInitWindowSize (window_width, window_height);
glutInitWindowPosition (100,100);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
glutCreateWindow ("Project 1");
glViewport(0, 0, 800, 1200);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity( );
glMatrixMode(GL_PROJECTION);
glLoadIdentity( );
gluOrtho2D(0.0, 800.0, 0.0, 1200.0);
glutDisplayFunc(display);[/sup]
[sup]glutMainLoop();

return 0;
}

#3Kevn

Posted 13 October 2012 - 09:45 PM

not sure what that means Posted Image
Well, I got my program to draw a line one pixel at a time using glDrawPixels. Only it repeats the same line over and over to the right and left of the line I told it to draw. So like if I told it to draw a line from position (100,100) to (600,600). there will be a line there but then another like from (300,100) to (900, 600). and another so many pixels to the right and left in the x direction over.

the code in question, the linebres just uses a line algorithm that calls setPixel however many times needed to draw the line:
[/sup]
[sup]struct RGBType {
float r;
float g;
float b;
};[/sup]
[sup]RGBType *pixel_buffer = new RGBType[800 * 1200];
using namespace std;
int window_height = 800;
int window_width = 1200;[/sup]
[sup]void setPixel(int x, int y)
{
  pixel_buffer[800*y + x].r=0.5; 
  pixel_buffer[800*y + x].g=0.5; 
  pixel_buffer[800*y + x].b=0.5;
}[/sup]

[sup]void display(void) {
glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT);[/sup]
[sup]lineBres(100, 100, 600, 600);[/sup]
[sup]glDrawPixels(window_width, window_height, GL_RGB, GL_FLOAT, pixel_buffer);
glutSwapBuffers();[/sup]
[sup]delete[] pixel_buffer;
glLoadIdentity();
}[/sup]
[sup]int main(int argc, char* argv[])
{
glutInit(&argc, argv);		  
glutInitWindowSize (window_width, window_height);
glutInitWindowPosition (100,100);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
glutCreateWindow ("Project 1");[/sup]
[sup]glViewport(0, 0, 800, 1200);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity( );
glMatrixMode(GL_PROJECTION);
glLoadIdentity( );
gluOrtho2D(0.0, 800.0, 0.0, 1200.0);[/sup]
[sup]glutDisplayFunc(display);[/sup]
[sup]glutMainLoop();

return 0;
}[/sup]
[sup]

#2Kevn

Posted 13 October 2012 - 09:35 PM

not sure what that means Posted Image
Well, I got my program to draw a line one pixel at a time using glDrawPixels. Only it repeats the same line over and over to the right and left of the line I told it to draw. So like if I told it to draw a line from position (100,100) to (600,600). there will be a line there but then another like from (300,100) to (900, 600). and another so many pixels to the right and left in the x direction over.

#1Kevn

Posted 13 October 2012 - 09:01 PM

not sure what that means :(
Well, I got my program to draw a line one pixel at a time using glDrawPixels. Only it repeats the same line over and over to the right and left of the line I told it to draw. So like if I told it to draw a line from position (100,100) to (600,600). there will be a line there but then another like from like (300,100) to (900, 600). and another so many pixels to the right and left in the x direction over.

PARTNERS