The issue is when I try to render my list of Vertices using the code below, the points are not rendered properly The first point in the deque is always correctly rendered. The rest of the points sometimes shouw up for a frame or two but then disapear (causing them to look like their flickering). Furthermore, additional points that I have not created are drawn in random locations with random colors, they flicker as well. Without further ado...
...the code:
Code :struct VertArray { float position[3]; unsigned char color[3]; }; deque <VertArray *> vertList; GLvoid DrawPoints() { glEnableClientState (GL_VERTEX_ARRAY); glEnableClientState (GL_COLOR_ARRAY); if(!vertList.empty()) { glVertexPointer (3, GL_FLOAT, sizeof (VertArray), (vertList[0]->position)); glColorPointer (3, GL_UNSIGNED_BYTE, sizeof (VertArray), (vertList[0]->color)); glDrawArrays (GL_POINTS, 0, vertList.size()); } glDisableClientState (GL_VERTEX_ARRAY); glDisableClientState (GL_COLOR_ARRAY);
I generate these points elsewhere (obviously) and I am positive that the error is NOT in the generation code. I have a version of this program that is identical expect it uses immediates to render vertList. Why is it not rendering properly with VertexArray's?
Ill attach my initialization code as well in case that may be the cause.
NOTE: its not in order and there are some parts left out because I deemed them highly likely not to be the cause.
Code :PIXELFORMATDESCRIPTOR pfd, *ppfd; int pixelformat; ppfd = &pfd; ppfd->nSize = sizeof(PIXELFORMATDESCRIPTOR); ppfd->nVersion = 1; ppfd->dwFlags = PFD_DRAW_TO_WINDOW | // Draw to window PFD_SUPPORT_OPENGL | // use OpenGL PFD_DOUBLEBUFFER; // use Double Buffer ppfd->dwLayerMask = PFD_MAIN_PLANE; ppfd->iPixelType = PFD_TYPE_RGBA; // Use RGBA format ppfd->cColorBits = 32; // color bits ppfd->cDepthBits = 32; ----------------------------------------------------------------------------- glEnable(GL_LINE_SMOOTH); // Line AA glEnable(GL_POINT_SMOOTH); // Point AA glEnable(GL_BLEND); // Allow Transparency glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); // how transparency acts glHint(GL_LINE_SMOOTH_HINT,GL_NICEST); glHint(GL_POINT_SMOOTH_HINT,GL_FASTEST); glPolygonMode(GL_BACK, GL_LINE); //Draw back, and draw boundries glLineWidth(LINEWIDTH); //Width of lines in OpenGl glPointSize(POINTSIZE); //Size of Points in OpenGL