| 2598 | } |
| 2599 | |
| 2600 | static void checkContext(unsigned long mask) |
| 2601 | { |
| 2602 | GLfloat f[4]; |
| 2603 | GLboolean b; |
| 2604 | GLint i[4]; |
| 2605 | GLubyte stippleImage[32 * 32], expectedStippleImage[32 * 32]; |
| 2606 | |
| 2607 | GLfloat expectedAccumClearValue = mask & GL_ACCUM_BUFFER_BIT ? 0.5 : 0.0; |
| 2608 | GLfloat expectedColorClearValue = mask & GL_COLOR_BUFFER_BIT ? 0.5 : 0.0; |
| 2609 | GLboolean expectedEdgeFlag = mask & GL_CURRENT_BIT ? GL_FALSE : GL_TRUE; |
| 2610 | GLfloat expectedDepthClearValue = mask & GL_DEPTH_BUFFER_BIT ? 0.5 : 1.0; |
| 2611 | GLboolean expectedLight0 = mask & GL_ENABLE_BIT ? GL_TRUE : GL_FALSE; |
| 2612 | GLint expectedMap1GridSegments = mask & GL_EVAL_BIT ? 2 : 1; |
| 2613 | GLint expectedFogMode = mask & GL_FOG_BIT ? GL_LINEAR : GL_EXP; |
| 2614 | GLint expectedFogHint = mask & GL_HINT_BIT ? GL_FASTEST : GL_DONT_CARE; |
| 2615 | GLint expectedShadeModel = mask & GL_LIGHTING_BIT ? GL_FLAT : GL_SMOOTH; |
| 2616 | GLint expectedLineWidth = mask & GL_LINE_BIT ? 2 : 1; |
| 2617 | GLint expectedListBase = mask & GL_LIST_BIT ? 1 : 0; |
| 2618 | //GLboolean expectedSampleCoverageInvert = |
| 2619 | // mask & GL_MULTISAMPLE_BIT ? GL_TRUE : GL_FALSE; |
| 2620 | GLfloat expectedRedScale = mask & GL_PIXEL_MODE_BIT ? 0.5 : 1.0; |
| 2621 | GLint expectedPointSize = mask & GL_POINT_BIT ? 2 : 1; |
| 2622 | GLint expectedCullFaceMode = mask & GL_POLYGON_BIT ? GL_FRONT : GL_BACK; |
| 2623 | memset(expectedStippleImage, mask & GL_POLYGON_STIPPLE_BIT ? 170 : 255, |
| 2624 | 32 * 4); |
| 2625 | GLint expectedScissorBox = mask & GL_SCISSOR_BIT ? 10 : 20; |
| 2626 | GLint expectedStencilClearValue = mask & GL_STENCIL_BUFFER_BIT ? 128 : 0; |
| 2627 | GLint expectedTextureGenMode = |
| 2628 | mask & GL_TEXTURE_BIT ? GL_OBJECT_LINEAR : GL_EYE_LINEAR; |
| 2629 | GLint expectedMatrixMode = |
| 2630 | mask & GL_TRANSFORM_BIT ? GL_PROJECTION : GL_MODELVIEW; |
| 2631 | GLint expectedViewport = mask & GL_VIEWPORT_BIT ? 10 : 20; |
| 2632 | |
| 2633 | CHECK_FLOAT4(GL_ACCUM_CLEAR_VALUE, expectedAccumClearValue); |
| 2634 | CHECK_FLOAT4(GL_COLOR_CLEAR_VALUE, expectedColorClearValue); |
| 2635 | CHECK_BOOL(GL_EDGE_FLAG, expectedEdgeFlag); |
| 2636 | CHECK_FLOAT1(GL_DEPTH_CLEAR_VALUE, expectedDepthClearValue); |
| 2637 | CHECK_BOOL(GL_LIGHT0, expectedLight0); |
| 2638 | CHECK_INT1(GL_MAP1_GRID_SEGMENTS, expectedMap1GridSegments); |
| 2639 | CHECK_INT1(GL_FOG_MODE, expectedFogMode); |
| 2640 | CHECK_INT1(GL_FOG_HINT, expectedFogHint); |
| 2641 | CHECK_INT1(GL_SHADE_MODEL, expectedShadeModel); |
| 2642 | CHECK_INT1(GL_LINE_WIDTH, expectedLineWidth); |
| 2643 | CHECK_INT1(GL_LIST_BASE, expectedListBase); |
| 2644 | //CHECK_BOOL(GL_SAMPLE_COVERAGE_INVERT, expectedSampleCoverageInvert); |
| 2645 | CHECK_FLOAT1(GL_RED_SCALE, expectedRedScale); |
| 2646 | CHECK_INT1(GL_POINT_SIZE, expectedPointSize); |
| 2647 | CHECK_INT1(GL_CULL_FACE_MODE, expectedCullFaceMode); |
| 2648 | glGetPolygonStipple(stippleImage); |
| 2649 | if(memcmp(stippleImage, expectedStippleImage, 32 * 4)) |
| 2650 | THROWNL("Stipple image"); |
| 2651 | CHECK_INT4(GL_SCISSOR_BOX, expectedScissorBox); |
| 2652 | CHECK_INT1(GL_STENCIL_CLEAR_VALUE, expectedStencilClearValue); |
| 2653 | glGetTexGeniv(GL_Q, GL_TEXTURE_GEN_MODE, i); |
| 2654 | if(i[0] != expectedTextureGenMode) |
| 2655 | THROWNL("GL_TEXTURE_GEN_MODE"); |
| 2656 | CHECK_INT1(GL_MATRIX_MODE, expectedMatrixMode); |
| 2657 | CHECK_INT4(GL_VIEWPORT, expectedViewport); |