/** Check if SwapBuffers() swap or copy back to front * @param hDC OpenGL device contect. * @return True if the SwapBuffer function copies back to front. */ bool IsSwapBufferCopyingBackToFront(HDC hDC) { GLbyte bColorDraw[] = {5, 5, 0}, bColorSeen[3]; float fViewport[4]; // Clear screen glClear(GL_COLOR_BUFFER_BIT); // Swap buffers glFlush(); SwapBuffers(hDC); // Display something glLoadIdentity(); glClear(GL_COLOR_BUFFER_BIT); glPushAttrib(GL_ENABLE_BIT | GL_CURRENT_BIT); glDisable(GL_TEXTURE_2D); glColor3bv(bColorDraw); glBegin(GL_TRIANGLES); glVertex2f(0.0f, 0.0f); glVertex2f(0.0f, 5.0f); glVertex2f(5.0f, 0.0f); glEnd(); glPopAttrib(); // Swap buffers glFlush(); SwapBuffers(hDC); // Check if it's still displayed glGetFloatv(GL_VIEWPORT, fViewport); glReadPixels((int)fViewport[0]+1, (int)(fViewport[1]+fViewport[3])-1, 1, 1, GL_RGB, GL_BYTE, bColorSeen); return (abs(bColorSeen[0]-bColorDraw[0]) <= 2 && abs(bColorSeen[1]-bColorDraw[1]) <= 2 && abs(bColorSeen[2]-bColorDraw[2]) <= 2); }
void GeomRenderer::sendColor(GLuint colorIndex) { assert(colorData.size == 3 || colorData.size == 4); switch(colorData.type) { case GL_BYTE: if (colorData.size == 3) glColor3bv((const GLbyte*)((const char*)colorData.pointer + colorIndex*colorData.stride)); if (colorData.size == 4) glColor4bv((const GLbyte*)((const char*)colorData.pointer + colorIndex*colorData.stride)); break; case GL_UNSIGNED_BYTE: if (colorData.size == 3) glColor3ubv((const GLubyte*)((const char*)colorData.pointer + colorIndex*colorData.stride)); if (colorData.size == 4) glColor4ubv((const GLubyte*)((const char*)colorData.pointer + colorIndex*colorData.stride)); break; case GL_SHORT: if (colorData.size == 3) glColor3sv((const GLshort*)((const char*)colorData.pointer + colorIndex*colorData.stride)); if (colorData.size == 4) glColor4sv((const GLshort*)((const char*)colorData.pointer + colorIndex*colorData.stride)); break; case GL_UNSIGNED_SHORT: if (colorData.size == 3) glColor3usv((const GLushort*)((const char*)colorData.pointer + colorIndex*colorData.stride)); if (colorData.size == 4) glColor4usv((const GLushort*)((const char*)colorData.pointer + colorIndex*colorData.stride)); break; case GL_INT: if (colorData.size == 3) glColor3iv((const GLint*)((const char*)colorData.pointer + colorIndex*colorData.stride)); if (colorData.size == 4) glColor4iv((const GLint*)((const char*)colorData.pointer + colorIndex*colorData.stride)); break; case GL_UNSIGNED_INT: if (colorData.size == 3) glColor3uiv((const GLuint*)((const char*)colorData.pointer + colorIndex*colorData.stride)); if (colorData.size == 4) glColor4uiv((const GLuint*)((const char*)colorData.pointer + colorIndex*colorData.stride)); break; case GL_FLOAT: if (colorData.size == 3) glColor3fv((const GLfloat*)((const char*)colorData.pointer + colorIndex*colorData.stride)); if (colorData.size == 4) glColor4fv((const GLfloat*)((const char*)colorData.pointer + colorIndex*colorData.stride)); break; case GL_DOUBLE: if (colorData.size == 3) glColor3dv((const GLdouble*)((const char*)colorData.pointer + colorIndex*colorData.stride)); if (colorData.size == 4) glColor4dv((const GLdouble*)((const char*)colorData.pointer + colorIndex*colorData.stride)); break; } }
M(void, glColor3bv, jobject v) { glColor3bv(BUFF(GLbyte, v)); }
inline void glColor3v( const GLbyte * v ) { glColor3bv( v ); }
void __glXDisp_Color3bv(GLbyte *pc) { glColor3bv( (GLbyte *)(pc + 0) ); }