Ok-I give up. I’ve been combing the web for weeks and have read most of the redbook and a lot of the blue book and have downloaded lots of example code, but I still haven’t found the answer to my problem. Keep in mind I am a newbie when it comes to OpenGL. I am rewriting my old legacy code which takes real time radar data and draws it to the screen. My legacy code was written using xView and Xlib. The piece of that code that I am working on takes a beam and displays it on the right hand side of the window. The y axis is range and the x axis is beam number, so this is only a two dimensional image. As each new beam comes in on the right hand side, the older beams move over one pixel to the left. I have rgba data for every pixel in the xy plane. What I am seeing is that when the data is first displayed the 500 pixels are not my 500 pixels but are the first 10 (or so) range values stretched out. As each new beam comes in more ranges are displayed. My 500 pixels in the y direction are never all displayed (although over 300 of them are by the time I get to the left hand side of the window). Once the window is filled, the new beams start on the right hand side again and the 3 or so ranges will take up about 25% of the 500 pixels (duplicated by openGL) and then the data will compact slowly again with each new beam. (I am on a linux system with Nvidia hardware and running OpenGL 1.4). In case any of this makes sense, I will include the structure of the openGL calls below:
main:
glutInit (&argC, argV);
glutInitDisplayMode (GLUT_DEPTH | GLUT_RGBA | GLUT_DOUBLE);
glutInitWindowPosition (100, 100);
createGraphics ();
glEnable (GL_DEPTH_TEST);
glClearColor (0., 0., 0., 1.);
glutMainLoop ();
createGraphics:
width = 700;
height = 600;
glutInitWindowSize (width, height);
glutCreateWindow (“TITLE”);
glClearColor (0, 0., 0., 1.);
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glutDisplayFunc (drawBeams);
glutReshapeFunc (changeSize);
glutPostRedisplay ();
glutTimerFunc (0, check_for_data, 0);
drawbeams:
glMatrixMode (GL_PROJECTION);
glPushMatrix ();
glLoadIdentity();
gluOrtho2D (0., width, 0., height);
glViewport (0, 100, width - 100, height - 100);
glutSwapBuffers ();
changeSize:
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
drawArray:
int widthLocal = 599 - currentBeam;
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glRasterPos2i (widthLocal, 150);
glDrawPixels (currentBeam, 500, GL_RGBA, GL_FLOAT, da);
glFlush ();
glutSwapBuffers ();
check_for_data:
gets data from shared memory
converts data into rgba array called da
calls drawArray
glutTimerFunc (10, check_for_data, 0);
I would appreciate it if anyone can tell me what I am doing wrong, as I obviously don’t have a grasp on openGL yet. Any advice I can get from you OpenGL gurus out there is greatly appreciated. Thanks in advance for your time and patience!