diff --git a/panda/src/display/graphicsStateGuardian.cxx b/panda/src/display/graphicsStateGuardian.cxx index 8844c421aa..2562d4a343 100644 --- a/panda/src/display/graphicsStateGuardian.cxx +++ b/panda/src/display/graphicsStateGuardian.cxx @@ -122,7 +122,7 @@ GraphicsStateGuardian(const FrameBufferProperties &properties, _supports_generate_mipmap = false; _supports_render_texture = false; - _supported_point_rendering = 0; + _supported_geom_rendering = 0; } //////////////////////////////////////////////////////////////////// @@ -153,20 +153,20 @@ get_supports_multisample() const { } //////////////////////////////////////////////////////////////////// -// Function: GraphicsStateGuardian::get_supported_point_rendering +// Function: GraphicsStateGuardian::get_supported_geom_rendering // Access: Published, Virtual -// Description: Returns the union of Geom::PointRendering values that -// this particular GSG can support directly. If a point +// Description: Returns the union of Geom::GeomRendering values that +// this particular GSG can support directly. If a Geom // needs to be rendered that requires some additional -// properties, the StandardMunger will convert it into -// quads instead. +// properties, the StandardMunger and/or the +// CullableObject will convert it as needed. // // This method is declared virtual solely so that it can // be queried from cullableObject.cxx. //////////////////////////////////////////////////////////////////// int GraphicsStateGuardian:: -get_supported_point_rendering() const { - return _supported_point_rendering; +get_supported_geom_rendering() const { + return _supported_geom_rendering; } //////////////////////////////////////////////////////////////////// @@ -723,10 +723,6 @@ draw_triangles(const qpGeomTriangles *) { //////////////////////////////////////////////////////////////////// void GraphicsStateGuardian:: draw_tristrips(const qpGeomTristrips *primitive) { - CPT(qpGeomPrimitive) new_prim = primitive->decompose(); - if (!new_prim->is_of_type(qpGeomTristrips::get_class_type())) { - new_prim->draw(this); - } } //////////////////////////////////////////////////////////////////// @@ -736,10 +732,6 @@ draw_tristrips(const qpGeomTristrips *primitive) { //////////////////////////////////////////////////////////////////// void GraphicsStateGuardian:: draw_trifans(const qpGeomTrifans *primitive) { - CPT(qpGeomPrimitive) new_prim = primitive->decompose(); - if (!new_prim->is_of_type(qpGeomTrifans::get_class_type())) { - new_prim->draw(this); - } } //////////////////////////////////////////////////////////////////// @@ -758,10 +750,6 @@ draw_lines(const qpGeomLines *) { //////////////////////////////////////////////////////////////////// void GraphicsStateGuardian:: draw_linestrips(const qpGeomLinestrips *primitive) { - CPT(qpGeomPrimitive) new_prim = primitive->decompose(); - if (!new_prim->is_of_type(qpGeomLinestrips::get_class_type())) { - new_prim->draw(this); - } } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/display/graphicsStateGuardian.h b/panda/src/display/graphicsStateGuardian.h index f4cd890c57..085d18ab0f 100644 --- a/panda/src/display/graphicsStateGuardian.h +++ b/panda/src/display/graphicsStateGuardian.h @@ -96,7 +96,7 @@ PUBLISHED: INLINE bool get_supports_generate_mipmap() const; INLINE bool get_supports_render_texture() const; - virtual int get_supported_point_rendering() const; + virtual int get_supported_geom_rendering() const; public: INLINE bool set_scene(SceneSetup *scene_setup); @@ -326,7 +326,7 @@ protected: bool _supports_multisample; bool _supports_generate_mipmap; bool _supports_render_texture; - int _supported_point_rendering; + int _supported_geom_rendering; public: // Statistics diff --git a/panda/src/display/standardMunger.cxx b/panda/src/display/standardMunger.cxx index 34f0d61113..22668e4f11 100644 --- a/panda/src/display/standardMunger.cxx +++ b/panda/src/display/standardMunger.cxx @@ -133,6 +133,41 @@ munge_data_impl(const qpGeomVertexData *data) { return new_data->convert_to(new_format); } +//////////////////////////////////////////////////////////////////// +// Function: StandardMunger::munge_geom_impl +// Access: Protected, Virtual +// Description: Converts a Geom and/or its data as necessary. +//////////////////////////////////////////////////////////////////// +bool StandardMunger:: +munge_geom_impl(CPT(qpGeom) &geom, CPT(qpGeomVertexData) &vertex_data) { + int geom_rendering = geom->get_geom_rendering(); + int supported_geom_rendering = _gsg->get_supported_geom_rendering(); + + int unsupported_bits = geom_rendering & ~supported_geom_rendering; + + if (unsupported_bits != 0) { + // Even beyond munging the vertex format, we have to convert the + // Geom itself into a new primitive type the GSG can render + // directly. + if ((unsupported_bits & qpGeom::GR_composite_bits) != 0) { + // This decomposes everything in the primitive, so that if (for + // instance) the primitive contained both strips and fans, but + // the GSG didn't support fans, it would decompose the strips + // too. To handle this correctly, we'd need a separate + // decompose_fans() and decompose_strips() call; but for now, + // we'll just say it's good enough. In practice, we don't have + // any GSG's that can support strips without also supporting + // fans. + geom = geom->decompose(); + } + if ((unsupported_bits & qpGeom::GR_shade_model_bits) != 0) { + geom = geom->rotate(); + } + } + + return true; +} + //////////////////////////////////////////////////////////////////// // Function: StandardMunger::compare_to_impl // Access: Protected, Virtual diff --git a/panda/src/display/standardMunger.h b/panda/src/display/standardMunger.h index 52e3afe745..0496dc4cd0 100644 --- a/panda/src/display/standardMunger.h +++ b/panda/src/display/standardMunger.h @@ -46,6 +46,7 @@ public: protected: virtual CPT(qpGeomVertexData) munge_data_impl(const qpGeomVertexData *data); virtual int compare_to_impl(const qpGeomMunger *other) const; + virtual bool munge_geom_impl(CPT(qpGeom) &geom, CPT(qpGeomVertexData) &data); virtual int geom_compare_to_impl(const qpGeomMunger *other) const; private: diff --git a/panda/src/dxgsg7/config_dxgsg7.cxx b/panda/src/dxgsg7/config_dxgsg7.cxx index 892838c706..a5a2b4c533 100644 --- a/panda/src/dxgsg7/config_dxgsg7.cxx +++ b/panda/src/dxgsg7/config_dxgsg7.cxx @@ -35,12 +35,6 @@ NotifyCategoryDef(wdxdisplay7, "windisplay"); ConfigVariableBool dx_full_screen ("dx-full-screen", false); -// Configure this true to force the rendering to sync to the video -// refresh, or false to let your frame rate go as high as it can, -// irrespective of the video refresh. -ConfigVariableBool dx_sync_video -("sync-video", true); - // enable this to turn on full-screen anti-aliasing, if the HW supports it // this var is also used in wdxGraphicsWindows.cxx ConfigVariableBool dx_full_screen_antialiasing diff --git a/panda/src/dxgsg7/config_dxgsg7.h b/panda/src/dxgsg7/config_dxgsg7.h index f3385e9dd2..47833756da 100644 --- a/panda/src/dxgsg7/config_dxgsg7.h +++ b/panda/src/dxgsg7/config_dxgsg7.h @@ -29,7 +29,6 @@ NotifyCategoryDecl(dxgsg7, EXPCL_PANDADX, EXPTP_PANDADX); NotifyCategoryDecl(wdxdisplay7, EXPCL_PANDADX, EXPTP_PANDADX); extern ConfigVariableBool dx_full_screen; -extern ConfigVariableBool dx_sync_video; extern ConfigVariableBool dx_no_vertex_fog; extern ConfigVariableBool dx_full_screen_antialiasing; extern ConfigVariableBool dx_use_rangebased_fog; diff --git a/panda/src/dxgsg7/dxGraphicsStateGuardian7.cxx b/panda/src/dxgsg7/dxGraphicsStateGuardian7.cxx index cca427a0e8..cbd1b6c8c0 100644 --- a/panda/src/dxgsg7/dxGraphicsStateGuardian7.cxx +++ b/panda/src/dxgsg7/dxGraphicsStateGuardian7.cxx @@ -4968,7 +4968,7 @@ void DXGraphicsStateGuardian7::show_full_screen_frame(void) { // Normally, we can just do the fast flip operation. DWORD dwFlipFlags = DDFLIP_WAIT; - if (!dx_sync_video) { + if (!sync_video) { // If the user indicated via Config that we shouldn't wait for // video sync, then don't wait (if the hardware supports this). // This will introduce visible artifacts like tearing, and may @@ -5008,7 +5008,7 @@ void DXGraphicsStateGuardian7::show_windowed_frame(void) { DX_DECLARE_CLEAN(DDBLTFX, bltfx); - if (dx_sync_video) { + if (sync_video) { // Wait for the video refresh *before* we blt the rendered image // onto the window. This will (a) prevent the "tearing" of the // image that would occur if only part of the image happened to be @@ -5029,7 +5029,7 @@ void DXGraphicsStateGuardian7::show_windowed_frame(void) { hr = _pScrn->pddsPrimary->Blt( &_pScrn->view_rect, _pScrn->pddsBack, NULL, DDBLT_DDFX | DDBLT_WAIT, &bltfx ); - if (dx_sync_video) { + if (sync_video) { HRESULT hr = _pScrn->pDD->WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN, NULL); if(hr != DD_OK) { dxgsg7_cat.error() << "WaitForVerticalBlank() failed : " << ConvD3DErrorToString(hr) << endl; diff --git a/panda/src/dxgsg8/config_dxgsg8.cxx b/panda/src/dxgsg8/config_dxgsg8.cxx index 9c60ebc26c..68f68e524a 100644 --- a/panda/src/dxgsg8/config_dxgsg8.cxx +++ b/panda/src/dxgsg8/config_dxgsg8.cxx @@ -40,12 +40,6 @@ NotifyCategoryDef(wdxdisplay8, "windisplay"); ConfigVariableBool dx_show_transforms ("dx-show-transforms", false); -// Configure this true to force the rendering to sync to the video -// refresh, or false to let your frame rate go as high as it can, -// irrespective of the video refresh. -ConfigVariableBool dx_sync_video -("sync-video", true); - // Set Level of MultiSampling to be used, if HW supports it. Valid values are 2-16. ConfigVariableInt dx_multisample_antialiasing_level ("dx-multisample-antialiasing-level", 0); diff --git a/panda/src/dxgsg8/config_dxgsg8.h b/panda/src/dxgsg8/config_dxgsg8.h index f51595c37e..701d5cc886 100644 --- a/panda/src/dxgsg8/config_dxgsg8.h +++ b/panda/src/dxgsg8/config_dxgsg8.h @@ -29,7 +29,6 @@ NotifyCategoryDecl(dxgsg8, EXPCL_PANDADX, EXPTP_PANDADX); NotifyCategoryDecl(wdxdisplay8, EXPCL_PANDADX, EXPTP_PANDADX); -extern ConfigVariableBool dx_sync_video; extern ConfigVariableBool dx_no_vertex_fog; extern ConfigVariableBool dx_show_cursor_watermark; extern ConfigVariableBool dx_full_screen_antialiasing; diff --git a/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx b/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx index 974c251899..20d1bc76f6 100644 --- a/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx +++ b/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx @@ -190,38 +190,41 @@ DXGraphicsStateGuardian8:: DXGraphicsStateGuardian8(const FrameBufferProperties &properties) : GraphicsStateGuardian(properties, CS_yup_left) { + reset_panda_gsg(); + + _pScrn = NULL; + _pD3DDevice = NULL; + + _bDXisReady = false; + _transform_stale = false; + _vertex_blending_enabled = false; + _overlay_windows_supported = false; + + _pFvfBufBasePtr = NULL; + _index_buf=NULL; + + _vbuffer_active = false; + _ibuffer_active = false; + + // _max_light_range = __D3DLIGHT_RANGE_MAX; + + // non-dx obj values inited here should not change if resize is + // called and dx objects need to be recreated (otherwise they + // belong in dx_init, with other renderstate + + ZeroMemory(&matIdentity,sizeof(D3DMATRIX)); + matIdentity._11 = matIdentity._22 = matIdentity._33 = matIdentity._44 = 1.0f; + + _cur_read_pixel_buffer=RenderBuffer::T_front; + set_color_clear_value(_color_clear_value); + + // DirectX drivers seem to consistently invert the texture when + // they copy framebuffer-to-texture. Ok. + _copy_texture_inverted = true; - reset_panda_gsg(); - - _pScrn = NULL; - _pD3DDevice = NULL; - - _bDXisReady = false; - _transform_stale = false; - _vertex_blending_enabled = false; - _overlay_windows_supported = false; - - _pFvfBufBasePtr = NULL; - _index_buf=NULL; - - _vbuffer_active = false; - _ibuffer_active = false; - - // _max_light_range = __D3DLIGHT_RANGE_MAX; - - // non-dx obj values inited here should not change if resize is - // called and dx objects need to be recreated (otherwise they - // belong in dx_init, with other renderstate - - ZeroMemory(&matIdentity,sizeof(D3DMATRIX)); - matIdentity._11 = matIdentity._22 = matIdentity._33 = matIdentity._44 = 1.0f; - - _cur_read_pixel_buffer=RenderBuffer::T_front; - set_color_clear_value(_color_clear_value); - - // DirectX drivers seem to consistently invert the texture when - // they copy framebuffer-to-texture. Ok. - _copy_texture_inverted = true; + _supported_geom_rendering = + qpGeom::GR_triangle_strip | qpGeom::GR_triangle_fan | + qpGeom::GR_flat_first_vertex; } //////////////////////////////////////////////////////////////////// @@ -2749,7 +2752,7 @@ draw_triangles(const qpGeomTriangles *primitive) { primitive->get_min_vertex(), primitive->get_max_vertex() - primitive->get_min_vertex() + 1, primitive->get_num_primitives(), - primitive->get_flat_first_vertices(), + primitive->get_vertices(), D3DFMT_INDEX16, _vertex_data->get_array(0)->get_data(), _vertex_data->get_format()->get_array(0)->get_stride()); @@ -2765,8 +2768,6 @@ void DXGraphicsStateGuardian8:: draw_tristrips(const qpGeomTristrips *primitive) { int min_vertex = primitive->get_min_vertex(); int max_vertex = primitive->get_max_vertex(); - // CPTA_ushort vertices = primitive->get_flat_first_vertices(); - CPTA_ushort vertices = primitive->get_vertices(); if (connect_triangle_strips && _current_fill_mode != RenderModeAttrib::M_wireframe) { // One long triangle strip, connected by the degenerate vertices @@ -2779,17 +2780,15 @@ draw_tristrips(const qpGeomTristrips *primitive) { _pD3DDevice->DrawIndexedPrimitive (D3DPT_TRIANGLESTRIP, - primitive->get_min_vertex(), - primitive->get_max_vertex() - primitive->get_min_vertex() + 1, + min_vertex, max_vertex - min_vertex + 1, 0, primitive->get_num_vertices() - 2); } else { _pD3DDevice->DrawIndexedPrimitiveUP (D3DPT_TRIANGLESTRIP, - primitive->get_min_vertex(), - primitive->get_max_vertex() - primitive->get_min_vertex() + 1, + min_vertex, max_vertex - min_vertex + 1, primitive->get_num_vertices() - 2, - vertices, D3DFMT_INDEX16, + primitive->get_vertices(), D3DFMT_INDEX16, _vertex_data->get_array(0)->get_data(), _vertex_data->get_format()->get_array(0)->get_stride()); } @@ -2821,6 +2820,7 @@ draw_tristrips(const qpGeomTristrips *primitive) { } else { CPTA_uchar array_data = _vertex_data->get_array(0)->get_data(); int stride = _vertex_data->get_format()->get_array(0)->get_stride(); + CPTA_ushort vertices = primitive->get_vertices(); unsigned int start = 0; for (size_t i = 0; i < ends.size(); i++) { @@ -2838,6 +2838,59 @@ draw_tristrips(const qpGeomTristrips *primitive) { } } +//////////////////////////////////////////////////////////////////// +// Function: DXGraphicsStateGuardian8::draw_trifans +// Access: Public, Virtual +// Description: Draws a series of triangle fans. +//////////////////////////////////////////////////////////////////// +void DXGraphicsStateGuardian8:: +draw_trifans(const qpGeomTrifans *primitive) { + int min_vertex = primitive->get_min_vertex(); + int max_vertex = primitive->get_max_vertex(); + + // Send the individual triangle fans. There's no connecting fans + // with degenerate vertices, so no worries about that. + CPTA_int ends = primitive->get_ends(); + CPTA_ushort mins = primitive->get_mins(); + CPTA_ushort maxs = primitive->get_maxs(); + nassertv(mins.size() == ends.size() && maxs.size() == ends.size()); + + if (_vbuffer_active) { + IndexBufferContext *ibc = ((qpGeomPrimitive *)primitive)->prepare_now(get_prepared_objects(), this); + nassertv(ibc != (IndexBufferContext *)NULL); + apply_index_buffer(ibc); + + unsigned int start = 0; + for (size_t i = 0; i < ends.size(); i++) { + _vertices_trifan_pcollector.add_level(ends[i] - start); + _pD3DDevice->DrawIndexedPrimitive + (D3DPT_TRIANGLEFAN, + mins[i], maxs[i] - mins[i] + 1, + start, ends[i] - start - 2); + + start = ends[i] + 2; + } + + } else { + CPTA_uchar array_data = _vertex_data->get_array(0)->get_data(); + int stride = _vertex_data->get_format()->get_array(0)->get_stride(); + CPTA_ushort vertices = primitive->get_vertices(); + + unsigned int start = 0; + for (size_t i = 0; i < ends.size(); i++) { + _vertices_trifan_pcollector.add_level(ends[i] - start); + _pD3DDevice->DrawIndexedPrimitiveUP + (D3DPT_TRIANGLEFAN, + mins[i], maxs[i] - mins[i] + 1, + ends[i] - start - 2, + vertices + start, D3DFMT_INDEX16, + array_data, stride); + + start = ends[i] + 2; + } + } +} + //////////////////////////////////////////////////////////////////// // Function: DXGraphicsStateGuardian8::draw_lines // Access: Public, Virtual @@ -2863,7 +2916,7 @@ draw_lines(const qpGeomLines *primitive) { primitive->get_min_vertex(), primitive->get_max_vertex() - primitive->get_min_vertex() + 1, primitive->get_num_primitives(), - primitive->get_flat_first_vertices(), + primitive->get_vertices(), D3DFMT_INDEX16, _vertex_data->get_array(0)->get_data(), _vertex_data->get_format()->get_array(0)->get_stride()); diff --git a/panda/src/dxgsg8/dxGraphicsStateGuardian8.h b/panda/src/dxgsg8/dxGraphicsStateGuardian8.h index f50b939660..6288e12851 100644 --- a/panda/src/dxgsg8/dxGraphicsStateGuardian8.h +++ b/panda/src/dxgsg8/dxGraphicsStateGuardian8.h @@ -95,6 +95,7 @@ public: const qpGeomVertexData *vertex_data); virtual void draw_triangles(const qpGeomTriangles *primitive); virtual void draw_tristrips(const qpGeomTristrips *primitive); + virtual void draw_trifans(const qpGeomTrifans *primitive); virtual void draw_lines(const qpGeomLines *primitive); virtual void end_draw_primitives(); diff --git a/panda/src/dxgsg8/dxIndexBufferContext8.cxx b/panda/src/dxgsg8/dxIndexBufferContext8.cxx index 288f6d312c..02e8e7b4b9 100644 --- a/panda/src/dxgsg8/dxIndexBufferContext8.cxx +++ b/panda/src/dxgsg8/dxIndexBufferContext8.cxx @@ -104,7 +104,7 @@ upload_data() { return; } - memcpy(local_pointer, get_data()->get_flat_first_vertices(), data_size); + memcpy(local_pointer, get_data()->get_vertices(), data_size); _ibuffer->Unlock(); } diff --git a/panda/src/dxgsg8/wdxGraphicsWindow8.cxx b/panda/src/dxgsg8/wdxGraphicsWindow8.cxx index 9deeed14f5..b65160a07e 100644 --- a/panda/src/dxgsg8/wdxGraphicsWindow8.cxx +++ b/panda/src/dxgsg8/wdxGraphicsWindow8.cxx @@ -683,9 +683,12 @@ create_screen_buffers_and_device(DXScreenData &Display, bool force_16bpp_zbuffer pPresParams->BackBufferFormat = Display.DisplayMode.Format; // dont need dest alpha, so just use adapter format - if (dx_sync_video && !(pD3DCaps->Caps & D3DCAPS_READ_SCANLINE)) { - wdxdisplay8_cat.info() << "HW doesnt support syncing to vertical refresh, ignoring dx_sync_video\n"; - dx_sync_video=false; + bool do_sync = sync_video; + + if (do_sync && !(pD3DCaps->Caps & D3DCAPS_READ_SCANLINE)) { + wdxdisplay8_cat.info() + << "HW doesnt support syncing to vertical refresh, ignoring sync-video\n"; + do_sync = false; } // verify the rendertarget fmt one last time @@ -779,7 +782,7 @@ create_screen_buffers_and_device(DXScreenData &Display, bool force_16bpp_zbuffer if (is_fullscreen()) { pPresParams->SwapEffect = D3DSWAPEFFECT_DISCARD; // we dont care about preserving contents of old frame - pPresParams->FullScreen_PresentationInterval = (dx_sync_video ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE); + pPresParams->FullScreen_PresentationInterval = (do_sync ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE); pPresParams->FullScreen_RefreshRateInHz = Display.DisplayMode.RefreshRate; #ifdef _DEBUG @@ -831,7 +834,7 @@ create_screen_buffers_and_device(DXScreenData &Display, bool force_16bpp_zbuffer pPresParams->FullScreen_PresentationInterval = 0; if (dx_multisample_antialiasing_level<2) { - if (dx_sync_video) { + if (do_sync) { pPresParams->SwapEffect = D3DSWAPEFFECT_COPY_VSYNC; } else { pPresParams->SwapEffect = D3DSWAPEFFECT_DISCARD; //D3DSWAPEFFECT_COPY; does this make any difference? diff --git a/panda/src/dxgsg9/config_dxgsg9.cxx b/panda/src/dxgsg9/config_dxgsg9.cxx index dfaa1b3963..b049d85ac4 100755 --- a/panda/src/dxgsg9/config_dxgsg9.cxx +++ b/panda/src/dxgsg9/config_dxgsg9.cxx @@ -37,12 +37,6 @@ NotifyCategoryDef(wdxdisplay9, "windisplay"); ConfigVariableBool dx_show_transforms ("dx-show-transforms", false); -// Configure this true to force the rendering to sync to the video -// refresh, or false to let your frame rate go as high as it can, -// irrespective of the video refresh. -ConfigVariableBool dx_sync_video -("sync-video", true); - // Set Level of MultiSampling to be used, if HW supports it. Valid values are 2-16. ConfigVariableInt dx_multisample_antialiasing_level ("dx-multisample-antialiasing-level", 0); diff --git a/panda/src/dxgsg9/config_dxgsg9.h b/panda/src/dxgsg9/config_dxgsg9.h index 393c4e922e..a31441a522 100755 --- a/panda/src/dxgsg9/config_dxgsg9.h +++ b/panda/src/dxgsg9/config_dxgsg9.h @@ -29,7 +29,6 @@ NotifyCategoryDecl(dxgsg9, EXPCL_PANDADX, EXPTP_PANDADX); NotifyCategoryDecl(wdxdisplay9, EXPCL_PANDADX, EXPTP_PANDADX); -extern ConfigVariableBool dx_sync_video; extern ConfigVariableBool dx_no_vertex_fog; extern ConfigVariableBool dx_show_cursor_watermark; extern ConfigVariableBool dx_full_screen_antialiasing; diff --git a/panda/src/dxgsg9/wdxGraphicsWindow9.cxx b/panda/src/dxgsg9/wdxGraphicsWindow9.cxx index e5bb534969..f1a6d2382f 100755 --- a/panda/src/dxgsg9/wdxGraphicsWindow9.cxx +++ b/panda/src/dxgsg9/wdxGraphicsWindow9.cxx @@ -670,9 +670,12 @@ create_screen_buffers_and_device(DXScreenData &Display, bool force_16bpp_zbuffer pPresParams->BackBufferFormat = Display.DisplayMode.Format; // dont need dest alpha, so just use adapter format - if (dx_sync_video && !(pD3DCaps->Caps & D3DCAPS_READ_SCANLINE)) { - wdxdisplay9_cat.info() << "HW doesnt support syncing to vertical refresh, ignoring dx_sync_video\n"; - dx_sync_video=false; + bool do_sync = sync_video; + + if (do_sync && !(pD3DCaps->Caps & D3DCAPS_READ_SCANLINE)) { + wdxdisplay9_cat.info() + << "HW doesnt support syncing to vertical refresh, ignoring sync-video\n"; + do_sync = false; } // verify the rendertarget fmt one last time @@ -766,7 +769,7 @@ create_screen_buffers_and_device(DXScreenData &Display, bool force_16bpp_zbuffer if (is_fullscreen()) { pPresParams->SwapEffect = D3DSWAPEFFECT_DISCARD; // we dont care about preserving contents of old frame - pPresParams->PresentationInterval = (dx_sync_video ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE); + pPresParams->PresentationInterval = (do_sync ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE); pPresParams->FullScreen_RefreshRateInHz = Display.DisplayMode.RefreshRate; #ifdef _DEBUG @@ -818,7 +821,7 @@ create_screen_buffers_and_device(DXScreenData &Display, bool force_16bpp_zbuffer pPresParams->PresentationInterval = 0; if (dx_multisample_antialiasing_level<2) { - if (dx_sync_video) { + if (do_sync) { pPresParams->SwapEffect = D3DSWAPEFFECT_COPY; } else { pPresParams->SwapEffect = D3DSWAPEFFECT_DISCARD; //D3DSWAPEFFECT_COPY; does this make any difference? diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index bead156fe8..ef3e0ea19c 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -327,7 +327,7 @@ fix_component_ordering(CPTA_uchar orig_image, GLenum external_format, } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::Constructor +// Function: GLGraphicsStateGuardian::Constructor // Access: Public // Description: //////////////////////////////////////////////////////////////////// @@ -342,7 +342,7 @@ CLP(GraphicsStateGuardian)(const FrameBufferProperties &properties) : } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::Destructor +// Function: GLGraphicsStateGuardian::Destructor // Access: Public // Description: //////////////////////////////////////////////////////////////////// @@ -352,7 +352,7 @@ CLP(GraphicsStateGuardian):: } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::reset +// Function: GLGraphicsStateGuardian::reset // Access: Public, Virtual // Description: Resets all internal state as if the gsg were newly // created. @@ -370,6 +370,11 @@ reset() { get_extra_extensions(); report_extensions(); + _supported_geom_rendering = + qpGeom::GR_point | qpGeom::GR_point_uniform_size | + qpGeom::GR_triangle_strip | qpGeom::GR_triangle_fan | + qpGeom::GR_flat_last_vertex; + _supports_point_parameters = false; if (is_at_least_version(1, 4)) { @@ -389,7 +394,9 @@ reset() { _supports_point_parameters = false; } } - if (!_supports_point_parameters) { + if (_supports_point_parameters) { + _supported_geom_rendering |= qpGeom::GR_point_perspective; + } else { _glPointParameterfv = null_glPointParameterfv; } @@ -867,7 +874,7 @@ reset() { //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::clear +// Function: GLGraphicsStateGuardian::clear // Access: Public, Virtual // Description: Clears all of the indicated buffers to their assigned // colors. @@ -936,7 +943,7 @@ do_clear(const RenderBuffer &buffer) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::prepare_display_region +// Function: GLGraphicsStateGuardian::prepare_display_region // Access: Public, Virtual // Description: Prepare a display region for rendering (set up // scissor region and viewport) @@ -972,7 +979,7 @@ prepare_display_region() { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::prepare_lens +// Function: GLGraphicsStateGuardian::prepare_lens // Access: Public, Virtual // Description: Makes the current lens (whichever lens was most // recently specified with set_scene()) active, so @@ -1056,7 +1063,7 @@ begin_frame() { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::end_frame +// Function: GLGraphicsStateGuardian::end_frame // Access: Public, Virtual // Description: Called after each frame is rendered, to allow the // GSG a chance to do any internal cleanup after @@ -1099,7 +1106,7 @@ end_frame() { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::draw_point +// Function: GLGraphicsStateGuardian::draw_point // Access: Public, Virtual // Description: //////////////////////////////////////////////////////////////////// @@ -1170,7 +1177,7 @@ draw_point(GeomPoint *geom, GeomContext *gc) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::draw_line +// Function: GLGraphicsStateGuardian::draw_line // Access: Public, Virtual // Description: //////////////////////////////////////////////////////////////////// @@ -1244,7 +1251,7 @@ draw_line(GeomLine *geom, GeomContext *gc) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::draw_linestrip +// Function: GLGraphicsStateGuardian::draw_linestrip // Access: Public, Virtual // Description: //////////////////////////////////////////////////////////////////// @@ -1343,7 +1350,7 @@ draw_linestrip(GeomLinestrip *geom, GeomContext *gc) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::draw_sprite +// Function: GLGraphicsStateGuardian::draw_sprite // Access: Public, Virtual // Description: CSN, 7/11/00 //////////////////////////////////////////////////////////////////// @@ -1619,7 +1626,7 @@ draw_sprite(GeomSprite *geom, GeomContext *) { //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::draw_polygon +// Function: GLGraphicsStateGuardian::draw_polygon // Access: Public, Virtual // Description: //////////////////////////////////////////////////////////////////// @@ -1701,7 +1708,7 @@ draw_polygon(GeomPolygon *geom, GeomContext *gc) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::draw_tri +// Function: GLGraphicsStateGuardian::draw_tri // Access: Public, Virtual // Description: //////////////////////////////////////////////////////////////////// @@ -1780,7 +1787,7 @@ draw_tri(GeomTri *geom, GeomContext *gc) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::draw_quad +// Function: GLGraphicsStateGuardian::draw_quad // Access: Public, Virtual // Description: //////////////////////////////////////////////////////////////////// @@ -1857,7 +1864,7 @@ draw_quad(GeomQuad *geom, GeomContext *gc) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::draw_tristrip +// Function: GLGraphicsStateGuardian::draw_tristrip // Access: Public, Virtual // Description: //////////////////////////////////////////////////////////////////// @@ -1963,7 +1970,7 @@ draw_tristrip(GeomTristrip *geom, GeomContext *gc) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::draw_trifan +// Function: GLGraphicsStateGuardian::draw_trifan // Access: Public, Virtual // Description: //////////////////////////////////////////////////////////////////// @@ -2063,7 +2070,7 @@ draw_trifan(GeomTrifan *geom, GeomContext *gc) { //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::draw_sphere +// Function: GLGraphicsStateGuardian::draw_sphere // Access: Public, Virtual // Description: //////////////////////////////////////////////////////////////////// @@ -2160,7 +2167,7 @@ draw_sphere(GeomSphere *geom, GeomContext *gc) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::begin_draw_primitives +// Function: GLGraphicsStateGuardian::begin_draw_primitives // Access: Public, Virtual // Description: Called before a sequence of draw_primitive() // functions are called, this should prepare the vertex @@ -2466,7 +2473,7 @@ begin_draw_primitives(const qpGeom *geom, const qpGeomMunger *munger, } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::draw_triangles +// Function: GLGraphicsStateGuardian::draw_triangles // Access: Public, Virtual // Description: Draws a series of disconnected triangles. //////////////////////////////////////////////////////////////////// @@ -2485,7 +2492,7 @@ draw_triangles(const qpGeomTriangles *primitive) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::draw_tristrips +// Function: GLGraphicsStateGuardian::draw_tristrips // Access: Public, Virtual // Description: Draws a series of triangle strips. //////////////////////////////////////////////////////////////////// @@ -2525,7 +2532,7 @@ draw_tristrips(const qpGeomTristrips *primitive) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::draw_lines +// Function: GLGraphicsStateGuardian::draw_lines // Access: Public, Virtual // Description: Draws a series of disconnected line segments. //////////////////////////////////////////////////////////////////// @@ -2544,7 +2551,16 @@ draw_lines(const qpGeomLines *primitive) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::draw_points +// Function: GLGraphicsStateGuardian::draw_linestrips +// Access: Public, Virtual +// Description: Draws a series of line strips. +//////////////////////////////////////////////////////////////////// +void CLP(GraphicsStateGuardian):: +draw_linestrips(const qpGeomLinestrips *primitive) { +} + +//////////////////////////////////////////////////////////////////// +// Function: GLGraphicsStateGuardian::draw_points // Access: Public, Virtual // Description: Draws a series of disconnected points. //////////////////////////////////////////////////////////////////// @@ -2563,7 +2579,7 @@ draw_points(const qpGeomPoints *primitive) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::end_draw_primitives() +// Function: GLGraphicsStateGuardian::end_draw_primitives() // Access: Public, Virtual // Description: Called after a sequence of draw_primitive() // functions are called, this should do whatever cleanup @@ -2606,7 +2622,7 @@ end_draw_primitives() { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::prepare_texture +// Function: GLGraphicsStateGuardian::prepare_texture // Access: Public, Virtual // Description: Creates a new retained-mode representation of the // given texture, and returns a newly-allocated @@ -2633,7 +2649,7 @@ prepare_texture(Texture *tex) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::apply_texture +// Function: GLGraphicsStateGuardian::apply_texture // Access: Public, Virtual // Description: Makes the texture the currently available texture for // rendering. @@ -2661,7 +2677,7 @@ apply_texture(TextureContext *tc) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::release_texture +// Function: GLGraphicsStateGuardian::release_texture // Access: Public, Virtual // Description: Frees the GL resources previously allocated for the // texture. This function should never be called @@ -2680,7 +2696,7 @@ release_texture(TextureContext *tc) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::prepare_geom +// Function: GLGraphicsStateGuardian::prepare_geom // Access: Public, Virtual // Description: Creates a new retained-mode representation of the // given geom, and returns a newly-allocated @@ -2772,7 +2788,7 @@ prepare_geom(Geom *geom) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::release_geom +// Function: GLGraphicsStateGuardian::release_geom // Access: Public, Virtual // Description: Frees the GL resources previously allocated for the // geom. This function should never be called @@ -2789,7 +2805,7 @@ release_geom(GeomContext *gc) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::record_deleted_display_list +// Function: GLGraphicsStateGuardian::record_deleted_display_list // Access: Public // Description: This is intended to be called only from the // GLGeomContext destructor. It saves the indicated @@ -2803,7 +2819,7 @@ record_deleted_display_list(GLuint index) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::prepare_vertex_buffer +// Function: GLGraphicsStateGuardian::prepare_vertex_buffer // Access: Public, Virtual // Description: Creates a new retained-mode representation of the // given data, and returns a newly-allocated @@ -2836,7 +2852,7 @@ prepare_vertex_buffer(qpGeomVertexArrayData *data) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::apply_vertex_buffer +// Function: GLGraphicsStateGuardian::apply_vertex_buffer // Access: Public // Description: Makes the data the currently available data for // rendering. @@ -2873,7 +2889,7 @@ apply_vertex_buffer(VertexBufferContext *vbc) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::release_vertex_buffer +// Function: GLGraphicsStateGuardian::release_vertex_buffer // Access: Public, Virtual // Description: Frees the GL resources previously allocated for the // data. This function should never be called @@ -2899,7 +2915,7 @@ release_vertex_buffer(VertexBufferContext *vbc) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::setup_array_data +// Function: GLGraphicsStateGuardian::setup_array_data // Access: Public // Description: Internal function to bind a buffer object for the // indicated data array, if appropriate, or to unbind a @@ -2936,7 +2952,7 @@ setup_array_data(const qpGeomVertexArrayData *data) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::prepare_index_buffer +// Function: GLGraphicsStateGuardian::prepare_index_buffer // Access: Public, Virtual // Description: Creates a new retained-mode representation of the // given data, and returns a newly-allocated @@ -2967,7 +2983,7 @@ prepare_index_buffer(qpGeomPrimitive *data) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::apply_index_buffer +// Function: GLGraphicsStateGuardian::apply_index_buffer // Access: Public // Description: Makes the data the currently available data for // rendering. @@ -2989,12 +3005,12 @@ apply_index_buffer(IndexBufferContext *ibc) { } if (gibc->changed_size()) { _glBufferData(GL_ELEMENT_ARRAY_BUFFER, gibc->get_data()->get_data_size_bytes(), - gibc->get_data()->get_flat_last_vertices(), + gibc->get_data()->get_vertices(), get_usage(gibc->get_data()->get_usage_hint())); } else { _glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, gibc->get_data_size_bytes(), - gibc->get_data()->get_flat_last_vertices()); + gibc->get_data()->get_vertices()); } gibc->mark_loaded(); @@ -3004,7 +3020,7 @@ apply_index_buffer(IndexBufferContext *ibc) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::release_index_buffer +// Function: GLGraphicsStateGuardian::release_index_buffer // Access: Public, Virtual // Description: Frees the GL resources previously allocated for the // data. This function should never be called @@ -3030,7 +3046,7 @@ release_index_buffer(IndexBufferContext *ibc) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::setup_primitive +// Function: GLGraphicsStateGuardian::setup_primitive // Access: Public // Description: Internal function to bind a buffer object for the // indicated primitive's index list, if appropriate, or @@ -3047,19 +3063,19 @@ const unsigned short *CLP(GraphicsStateGuardian):: setup_primitive(const qpGeomPrimitive *data) { if (!_supports_buffers) { // No support for buffer objects; always render from client. - return data->get_flat_last_vertices(); + return data->get_vertices(); } if (!vertex_buffers || _geom_display_list != 0 || data->get_usage_hint() == qpGeom::UH_client) { // The array specifies client rendering only, or buffer objects // are configured off. _glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); - return data->get_flat_last_vertices(); + return data->get_vertices(); } // Prepare the buffer object and bind it. IndexBufferContext *ibc = ((qpGeomPrimitive *)data)->prepare_now(get_prepared_objects(), this); - nassertr(ibc != (IndexBufferContext *)NULL, data->get_flat_last_vertices()); + nassertr(ibc != (IndexBufferContext *)NULL, data->get_vertices()); apply_index_buffer(ibc); // NULL is the OpenGL convention for the first byte of the buffer object. @@ -3067,7 +3083,7 @@ setup_primitive(const qpGeomPrimitive *data) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::get_geom_munger +// Function: GLGraphicsStateGuardian::get_geom_munger // Access: Public, Virtual // Description: Creates a new GeomMunger object to munge vertices // appropriate to this GSG for the indicated state. @@ -3079,7 +3095,7 @@ get_geom_munger(const RenderState *state) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::framebuffer_copy_to_texture +// Function: GLGraphicsStateGuardian::framebuffer_copy_to_texture // Access: Public, Virtual // Description: Copy the pixels within the indicated display // region from the framebuffer into texture memory. @@ -3140,7 +3156,7 @@ framebuffer_copy_to_texture(Texture *tex, int z, const DisplayRegion *dr, } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::framebuffer_copy_to_ram +// Function: GLGraphicsStateGuardian::framebuffer_copy_to_ram // Access: Public, Virtual // Description: Copy the pixels within the indicated display region // from the framebuffer into system memory, not texture @@ -3263,7 +3279,7 @@ framebuffer_copy_to_ram(Texture *tex, int z, const DisplayRegion *dr, } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::apply_material +// Function: GLGraphicsStateGuardian::apply_material // Access: Public, Virtual // Description: //////////////////////////////////////////////////////////////////// @@ -3308,7 +3324,7 @@ void CLP(GraphicsStateGuardian)::apply_material(const Material *material) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::apply_fog +// Function: GLGraphicsStateGuardian::apply_fog // Access: Public, Virtual // Description: //////////////////////////////////////////////////////////////////// @@ -3333,7 +3349,7 @@ apply_fog(Fog *fog) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::issue_transform +// Function: GLGraphicsStateGuardian::issue_transform // Access: Public, Virtual // Description: Sends the indicated transform matrix to the graphics // API to be applied to future vertices. @@ -3358,7 +3374,7 @@ issue_transform(const TransformState *transform) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::issue_tex_matrix +// Function: GLGraphicsStateGuardian::issue_tex_matrix // Access: Public, Virtual // Description: //////////////////////////////////////////////////////////////////// @@ -3374,7 +3390,7 @@ issue_tex_matrix(const TexMatrixAttrib *attrib) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::issue_tex_gen +// Function: GLGraphicsStateGuardian::issue_tex_gen // Access: Public, Virtual // Description: //////////////////////////////////////////////////////////////////// @@ -3390,7 +3406,7 @@ issue_tex_gen(const TexGenAttrib *attrib) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::issue_shade_model +// Function: GLGraphicsStateGuardian::issue_shade_model // Access: Public, Virtual // Description: //////////////////////////////////////////////////////////////////// @@ -3413,7 +3429,7 @@ issue_shade_model(const ShadeModelAttrib *attrib) { //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::issue_cg_shader_bind +// Function: GLGraphicsStateGuardian::issue_cg_shader_bind // Access: Public, Virtual // Description: Bind shader of current node // and unbind the shader of the previous node @@ -3453,7 +3469,7 @@ issue_cg_shader_bind(const CgShaderAttrib *attrib) { #endif //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::issue_material +// Function: GLGraphicsStateGuardian::issue_material // Access: Public, Virtual // Description: //////////////////////////////////////////////////////////////////// @@ -3471,7 +3487,7 @@ issue_material(const MaterialAttrib *attrib) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::issue_render_mode +// Function: GLGraphicsStateGuardian::issue_render_mode // Access: Public, Virtual // Description: //////////////////////////////////////////////////////////////////// @@ -3480,7 +3496,6 @@ issue_render_mode(const RenderModeAttrib *attrib) { _render_mode = attrib->get_mode(); _point_size = attrib->get_thickness(); _point_perspective = attrib->get_perspective(); - _point_perspective = true; switch (_render_mode) { case RenderModeAttrib::M_unchanged: @@ -3510,7 +3525,7 @@ issue_render_mode(const RenderModeAttrib *attrib) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::issue_antialias +// Function: GLGraphicsStateGuardian::issue_antialias // Access: Public, Virtual // Description: //////////////////////////////////////////////////////////////////// @@ -3566,7 +3581,7 @@ issue_antialias(const AntialiasAttrib *attrib) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::issue_rescale_normal +// Function: GLGraphicsStateGuardian::issue_rescale_normal // Access: Public, Virtual // Description: //////////////////////////////////////////////////////////////////// @@ -3613,7 +3628,7 @@ issue_rescale_normal(const RescaleNormalAttrib *attrib) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::issue_texture_apply +// Function: GLGraphicsStateGuardian::issue_texture_apply // Access: Public, Virtual // Description: //////////////////////////////////////////////////////////////////// @@ -3625,7 +3640,7 @@ issue_texture_apply(const TextureApplyAttrib *) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::issue_color_write +// Function: GLGraphicsStateGuardian::issue_color_write // Access: Public, Virtual // Description: //////////////////////////////////////////////////////////////////// @@ -3656,7 +3671,7 @@ issue_color_write(const ColorWriteAttrib *attrib) { #define PANDA_TO_GL_COMPAREFUNC(PANDACMPFUNC) (PANDACMPFUNC-1 +0x200) //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::issue_depth_test +// Function: GLGraphicsStateGuardian::issue_depth_test // Access: Public, Virtual // Description: //////////////////////////////////////////////////////////////////// @@ -3673,7 +3688,7 @@ issue_depth_test(const DepthTestAttrib *attrib) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::issue_alpha_test +// Function: GLGraphicsStateGuardian::issue_alpha_test // Access: Public, Virtual // Description: //////////////////////////////////////////////////////////////////// @@ -3690,7 +3705,7 @@ issue_alpha_test(const AlphaTestAttrib *attrib) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::issue_depth_write +// Function: GLGraphicsStateGuardian::issue_depth_write // Access: Public, Virtual // Description: //////////////////////////////////////////////////////////////////// @@ -3706,7 +3721,7 @@ issue_depth_write(const DepthWriteAttrib *attrib) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::issue_cull_face +// Function: GLGraphicsStateGuardian::issue_cull_face // Access: Public, Virtual // Description: //////////////////////////////////////////////////////////////////// @@ -3735,7 +3750,7 @@ issue_cull_face(const CullFaceAttrib *attrib) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::issue_fog +// Function: GLGraphicsStateGuardian::issue_fog // Access: Public, Virtual // Description: //////////////////////////////////////////////////////////////////// @@ -3753,7 +3768,7 @@ issue_fog(const FogAttrib *attrib) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::issue_depth_offset +// Function: GLGraphicsStateGuardian::issue_depth_offset // Access: Public, Virtual // Description: //////////////////////////////////////////////////////////////////// @@ -3775,7 +3790,7 @@ issue_depth_offset(const DepthOffsetAttrib *attrib) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::bind_light +// Function: GLGraphicsStateGuardian::bind_light // Access: Public, Virtual // Description: Called the first time a particular light has been // bound to a given id within a frame, this should set @@ -3815,7 +3830,7 @@ bind_light(PointLight *light_obj, const NodePath &light, int light_id) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::bind_light +// Function: GLGraphicsStateGuardian::bind_light // Access: Public, Virtual // Description: Called the first time a particular light has been // bound to a given id within a frame, this should set @@ -3856,7 +3871,7 @@ bind_light(DirectionalLight *light_obj, const NodePath &light, int light_id) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::bind_light +// Function: GLGraphicsStateGuardian::bind_light // Access: Public, Virtual // Description: Called the first time a particular light has been // bound to a given id within a frame, this should set @@ -3896,7 +3911,7 @@ bind_light(Spotlight *light_obj, const NodePath &light, int light_id) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::wants_texcoords +// Function: GLGraphicsStateGuardian::wants_texcoords // Access: Public, Virtual // Description: //////////////////////////////////////////////////////////////////// @@ -3906,7 +3921,7 @@ wants_texcoords() const { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::compute_distance_to +// Function: GLGraphicsStateGuardian::compute_distance_to // Access: Public, Virtual // Description: This function may only be called during a render // traversal; it will compute the distance to the @@ -4084,7 +4099,7 @@ has_extension(const string &extension) const { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::is_at_least_version +// Function: GLGraphicsStateGuardian::is_at_least_version // Access: Public // Description: Returns true if the runtime GL version number is at // least the indicated value, false otherwise. @@ -4105,7 +4120,7 @@ is_at_least_version(int major_version, int minor_version, } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::get_extension_func +// Function: GLGraphicsStateGuardian::get_extension_func // Access: Public, Virtual // Description: Returns the pointer to the GL extension function with // the indicated name. It is the responsibility of the @@ -4121,7 +4136,7 @@ get_extension_func(const char *, const char *) { //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::set_draw_buffer +// Function: GLGraphicsStateGuardian::set_draw_buffer // Access: Protected // Description: Sets up the GLP(DrawBuffer) to render into the buffer // indicated by the RenderBuffer object. This only sets @@ -4170,7 +4185,7 @@ set_draw_buffer(const RenderBuffer &rb) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::set_read_buffer +// Function: GLGraphicsStateGuardian::set_read_buffer // Access: Protected // Description: Sets up the GLP(ReadBuffer) to render into the buffer // indicated by the RenderBuffer object. This only sets @@ -4220,7 +4235,7 @@ set_read_buffer(const RenderBuffer &rb) { //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::bind_texture +// Function: GLGraphicsStateGuardian::bind_texture // Access: Protected // Description: //////////////////////////////////////////////////////////////////// @@ -4245,7 +4260,7 @@ bind_texture(TextureContext *tc) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::specify_texture +// Function: GLGraphicsStateGuardian::specify_texture // Access: Protected // Description: //////////////////////////////////////////////////////////////////// @@ -4371,7 +4386,7 @@ compute_gl_image_size(int x_size, int y_size, int z_size, #endif // NDEBUG //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::apply_texture_immediate +// Function: GLGraphicsStateGuardian::apply_texture_immediate // Access: Protected // Description: Sends the texture image to GL. This can be used to // render a texture in immediate mode, or as part of the @@ -4571,7 +4586,7 @@ apply_texture_immediate(CLP(TextureContext) *gtc, Texture *tex) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::upload_texture_image +// Function: GLGraphicsStateGuardian::upload_texture_image // Access: Protected // Description: Loads a texture image, or one page of a cube map // image, from system RAM to texture memory. @@ -4709,7 +4724,7 @@ upload_texture_image(CLP(TextureContext) *gtc, //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::get_numeric_type +// Function: GLGraphicsStateGuardian::get_numeric_type // Access: Protected, Static // Description: Maps from the Geom's internal numeric type symbols // to GL's. @@ -4735,7 +4750,7 @@ get_numeric_type(qpGeom::NumericType numeric_type) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::get_texture_target +// Function: GLGraphicsStateGuardian::get_texture_target // Access: Protected // Description: Maps from the Texture's texture type symbols to // GL's. @@ -4769,7 +4784,7 @@ get_texture_target(Texture::TextureType texture_type) const { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::get_texture_wrap_mode +// Function: GLGraphicsStateGuardian::get_texture_wrap_mode // Access: Protected, Static // Description: Maps from the Texture's internal wrap mode symbols to // GL's. @@ -4803,7 +4818,7 @@ get_texture_wrap_mode(Texture::WrapMode wm) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::get_texture_filter_type +// Function: GLGraphicsStateGuardian::get_texture_filter_type // Access: Protected, Static // Description: Maps from the Texture's internal filter type symbols // to GL's. @@ -4850,7 +4865,7 @@ get_texture_filter_type(Texture::FilterType ft, bool ignore_mipmaps) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::get_component_type +// Function: GLGraphicsStateGuardian::get_component_type // Access: Protected, Static // Description: Maps from the Texture's internal ComponentType symbols // to GL's. @@ -4872,7 +4887,7 @@ get_component_type(Texture::ComponentType component_type) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::get_external_image_format +// Function: GLGraphicsStateGuardian::get_external_image_format // Access: Protected // Description: Maps from the Texture's Format symbols // to GL's. @@ -4920,7 +4935,7 @@ get_external_image_format(Texture::Format format) const { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::get_internal_image_format +// Function: GLGraphicsStateGuardian::get_internal_image_format // Access: Protected, Static // Description: Maps from the Texture's Format symbols to a // suitable internal format for GL textures. @@ -4972,7 +4987,7 @@ get_internal_image_format(Texture::Format format) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::get_texture_apply_mode_type +// Function: GLGraphicsStateGuardian::get_texture_apply_mode_type // Access: Protected, Static // Description: Maps from the texture stage's mode types // to the corresponding OpenGL ids @@ -4995,7 +5010,7 @@ get_texture_apply_mode_type(TextureStage::Mode am) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::get_texture_combine_type +// Function: GLGraphicsStateGuardian::get_texture_combine_type // Access: Protected, Static // Description: Maps from the texture stage's CombineMode types // to the corresponding OpenGL ids @@ -5019,7 +5034,7 @@ get_texture_combine_type(TextureStage::CombineMode cm) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::get_texture_src_type +// Function: GLGraphicsStateGuardian::get_texture_src_type // Access: Protected, Static // Description: Maps from the texture stage's CombineSource types // to the corresponding OpenGL ids @@ -5041,7 +5056,7 @@ get_texture_src_type(TextureStage::CombineSource cs) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::get_texture_operand_type +// Function: GLGraphicsStateGuardian::get_texture_operand_type // Access: Protected, Static // Description: Maps from the texture stage's CombineOperand types // to the corresponding OpenGL ids @@ -5062,7 +5077,7 @@ get_texture_operand_type(TextureStage::CombineOperand co) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::get_fog_mode_type +// Function: GLGraphicsStateGuardian::get_fog_mode_type // Access: Protected, Static // Description: Maps from the fog types to gl version //////////////////////////////////////////////////////////////////// @@ -5083,7 +5098,7 @@ get_fog_mode_type(Fog::Mode m) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::get_blend_equation_type +// Function: GLGraphicsStateGuardian::get_blend_equation_type // Access: Protected, Static // Description: Maps from ColorBlendAttrib::Mode to glBlendEquation // value. @@ -5114,7 +5129,7 @@ get_blend_equation_type(ColorBlendAttrib::Mode mode) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::get_blend_func +// Function: GLGraphicsStateGuardian::get_blend_func // Access: Protected, Static // Description: Maps from ColorBlendAttrib::Operand to glBlendFunc // value. @@ -5178,7 +5193,7 @@ get_blend_func(ColorBlendAttrib::Operand operand) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::get_usage +// Function: GLGraphicsStateGuardian::get_usage // Access: Public, Static // Description: Maps from UsageHint to the GL symbol. //////////////////////////////////////////////////////////////////// @@ -5206,7 +5221,7 @@ get_usage(qpGeom::UsageHint usage_hint) { //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::print_gfx_visual +// Function: GLGraphicsStateGuardian::print_gfx_visual // Access: Public // Description: Prints a description of the current visual selected. //////////////////////////////////////////////////////////////////// @@ -5254,7 +5269,7 @@ print_gfx_visual() { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::issue_scaled_color +// Function: GLGraphicsStateGuardian::issue_scaled_color // Access: Public // Description: Transform the color by the current color matrix, and // calls the appropriate glColor function. @@ -5271,7 +5286,7 @@ issue_scaled_color(const Colorf &color) const { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::slot_new_light +// Function: GLGraphicsStateGuardian::slot_new_light // Access: Protected, Virtual // Description: This will be called by the base class before a // particular light id will be used for the first time. @@ -5289,7 +5304,7 @@ slot_new_light(int light_id) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::enable_lighting +// Function: GLGraphicsStateGuardian::enable_lighting // Access: Protected, Virtual // Description: Intended to be overridden by a derived class to // enable or disable the use of lighting overall. This @@ -5306,7 +5321,7 @@ enable_lighting(bool enable) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::set_ambient_light +// Function: GLGraphicsStateGuardian::set_ambient_light // Access: Protected, Virtual // Description: Intended to be overridden by a derived class to // indicate the color of the ambient light that should @@ -5319,7 +5334,7 @@ set_ambient_light(const Colorf &color) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::enable_light +// Function: GLGraphicsStateGuardian::enable_light // Access: Protected, Virtual // Description: Intended to be overridden by a derived class to // enable the indicated light id. A specific Light will @@ -5335,7 +5350,7 @@ enable_light(int light_id, bool enable) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::begin_bind_lights +// Function: GLGraphicsStateGuardian::begin_bind_lights // Access: Protected, Virtual // Description: Called immediately before bind_light() is called, // this is intended to provide the derived class a hook @@ -5361,7 +5376,7 @@ begin_bind_lights() { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::end_bind_lights +// Function: GLGraphicsStateGuardian::end_bind_lights // Access: Protected, Virtual // Description: Called after before bind_light() has been called one // or more times (but before any geometry is issued or @@ -5376,7 +5391,7 @@ end_bind_lights() { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::slot_new_clip_plane +// Function: GLGraphicsStateGuardian::slot_new_clip_plane // Access: Protected, Virtual // Description: This will be called by the base class before a // particular clip plane id will be used for the first @@ -5395,7 +5410,7 @@ slot_new_clip_plane(int plane_id) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::enable_clip_plane +// Function: GLGraphicsStateGuardian::enable_clip_plane // Access: Protected, Virtual // Description: Intended to be overridden by a derived class to // enable the indicated clip_plane id. A specific @@ -5412,7 +5427,7 @@ enable_clip_plane(int plane_id, bool enable) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::begin_bind_clip_planes +// Function: GLGraphicsStateGuardian::begin_bind_clip_planes // Access: Protected, Virtual // Description: Called immediately before bind_clip_plane() is called, // this is intended to provide the derived class a hook @@ -5438,7 +5453,7 @@ begin_bind_clip_planes() { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::bind_clip_plane +// Function: GLGraphicsStateGuardian::bind_clip_plane // Access: Protected, Virtual // Description: Called the first time a particular clip_plane has been // bound to a given id within a frame, this should set @@ -5460,7 +5475,7 @@ bind_clip_plane(PlaneNode *plane, int plane_id) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::end_bind_clip_planes +// Function: GLGraphicsStateGuardian::end_bind_clip_planes // Access: Protected, Virtual // Description: Called after before bind_clip_plane() has been called one // or more times (but before any geometry is issued or @@ -5475,7 +5490,7 @@ end_bind_clip_planes() { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::set_blend_mode +// Function: GLGraphicsStateGuardian::set_blend_mode // Access: Protected, Virtual // Description: Called after any of the things that might change // blending state have changed, this function is @@ -5847,7 +5862,7 @@ finish_modify_state() { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::free_pointers +// Function: GLGraphicsStateGuardian::free_pointers // Access: Protected, Virtual // Description: Frees some memory that was explicitly allocated // within the glgsg. @@ -5857,7 +5872,7 @@ free_pointers() { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::get_untextured_state +// Function: GLGraphicsStateGuardian::get_untextured_state // Access: Protected, Static // Description: Returns a RenderState object that represents // texturing off. @@ -5872,7 +5887,7 @@ get_untextured_state() { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::get_smooth_state +// Function: GLGraphicsStateGuardian::get_smooth_state // Access: Protected, Static // Description: Returns a RenderState object that represents // smooth, per-vertex shading. @@ -5887,7 +5902,7 @@ get_smooth_state() { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::get_flat_state +// Function: GLGraphicsStateGuardian::get_flat_state // Access: Protected, Static // Description: Returns a RenderState object that represents // flat, per-primitive shading. @@ -5902,7 +5917,7 @@ get_flat_state() { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::do_auto_rescale_normal +// Function: GLGraphicsStateGuardian::do_auto_rescale_normal // Access: Protected // Description: Issues the appropriate GL commands to either rescale // or normalize the normals according to the current @@ -5938,7 +5953,7 @@ do_auto_rescale_normal() { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::do_issue_texture +// Function: GLGraphicsStateGuardian::do_issue_texture // Access: Protected // Description: This is called by finish_modify_state() when the // texture state has changed. @@ -6125,7 +6140,7 @@ do_issue_texture() { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::do_point_size +// Function: GLGraphicsStateGuardian::do_point_size // Access: Protected // Description: Internally sets the point size parameters after any // of the properties have changed that might affect @@ -6156,7 +6171,7 @@ do_point_size() { #ifndef NDEBUG //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::build_phony_mipmaps +// Function: GLGraphicsStateGuardian::build_phony_mipmaps // Access: Protected // Description: Generates a series of colored mipmap levels to aid in // visualizing the mipmap levels as the hardware applies @@ -6200,7 +6215,7 @@ build_phony_mipmaps(Texture *tex) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::build_phony_mipmap_level +// Function: GLGraphicsStateGuardian::build_phony_mipmap_level // Access: Protected // Description: Generates a single colored mipmap level. //////////////////////////////////////////////////////////////////// @@ -6269,7 +6284,7 @@ build_phony_mipmap_level(int level, int x_size, int y_size) { } //////////////////////////////////////////////////////////////////// -// Function: CLP(GraphicsStateGuardian)::save_mipmap_images +// Function: GLGraphicsStateGuardian::save_mipmap_images // Access: Protected // Description: Saves out each mipmap level of the indicated texture // (which must also be the currently active texture in @@ -6323,1227 +6338,3 @@ save_mipmap_images(Texture *tex) { } while (x_size > 0 || y_size > 0); } #endif // NDEBUG - -TypeHandle CLP(GraphicsStateGuardian)::get_type(void) const { - return get_class_type(); -} - -TypeHandle CLP(GraphicsStateGuardian)::get_class_type(void) { - return _type_handle; -} - -void CLP(GraphicsStateGuardian)::init_type(void) { - GraphicsStateGuardian::init_type(); - register_type(_type_handle, CLASSPREFIX_QUOTED "GraphicsStateGuardian", - GraphicsStateGuardian::get_class_type()); -} - - -#ifdef GSG_VERBOSE - -void CLP(GraphicsStateGuardian):: -dump_state(void) -{ - if (GLCAT.is_debug()) - { - ostream &dump = GLCAT.debug(false); - GLCAT.debug() << "Dumping GL State" << endl; - - dump << "\t\t" << "GL_LINE_SMOOTH " << _line_smooth_enabled << " " << (bool)GLP(IsEnabled)(GL_LINE_SMOOTH) << "\n"; - dump << "\t\t" << "GL_POINT_SMOOTH " << _point_smooth_enabled << " " << (bool)GLP(IsEnabled)(GL_POINT_SMOOTH) << "\n"; - dump << "\t\t" << "GL_LIGHTING " << _lighting_enabled << " " << (bool)GLP(IsEnabled)(GL_LIGHTING) << "\n"; - dump << "\t\t" << "GL_SCISSOR_TEST " << _scissor_enabled << " " << (bool)GLP(IsEnabled)(GL_SCISSOR_TEST) << "\n"; - dump << "\t\t" << "GL_STENCIL_TEST " << " " << (bool)GLP(IsEnabled)(GL_STENCIL_TEST) << "\n"; - dump << "\t\t" << "GL_BLEND " << _blend_enabled << " " << (bool)GLP(IsEnabled)(GL_BLEND) << "\n"; - dump << "\t\t" << "GL_DEPTH_TEST " << _depth_test_enabled << " " << (bool)GLP(IsEnabled)(GL_DEPTH_TEST) << "\n"; - dump << "\t\t" << "GL_FOG " << _fog_enabled << " " << (bool)GLP(IsEnabled)(GL_FOG) << "\n"; - dump << "\t\t" << "GL_ALPHA_TEST " << _alpha_test_enabled << " " << (bool)GLP(IsEnabled)(GL_ALPHA_TEST) << "\n"; - dump << "\t\t" << "GL_POLYGON_OFFSET_FILL " << _polygon_offset_enabled << " " << (bool)GLP(IsEnabled)(GL_POLYGON_OFFSET_FILL) << "\n"; - - dump << endl; - } -} - -#else // GSG_VERBOSE - -// This function does nothing unless GSG_VERBOSE is compiled in. -void CLP(GraphicsStateGuardian):: -dump_state(void) -{ -} - -#endif // GSG_VERBOSE - - -#ifdef GSG_VERBOSE - -// This is a handy function to output a GLenum value as a string, for -// debugging. -ostream &output_gl_enum(ostream &out, GLenum v) { - switch (v) { - case GL_FALSE: - return out << "GL_FALSE"; - case GL_TRUE: - return out << "GL_TRUE"; - - /* Data types */ - case GL_BYTE: - return out << "GL_BYTE"; - case GL_UNSIGNED_BYTE: - return out << "GL_UNSIGNED_BYTE"; - case GL_SHORT: - return out << "GL_SHORT"; - case GL_UNSIGNED_SHORT: - return out << "GL_UNSIGNED_SHORT"; - case GL_INT: - return out << "GL_INT"; - case GL_UNSIGNED_INT: - return out << "GL_UNSIGNED_INT"; - case GL_FLOAT: - return out << "GL_FLOAT"; - case GL_DOUBLE: - return out << "GL_DOUBLE"; - case GL_2_BYTES: - return out << "GL_2_BYTES"; - case GL_3_BYTES: - return out << "GL_3_BYTES"; - case GL_4_BYTES: - return out << "GL_4_BYTES"; - - /* Primitives */ - /* - case GL_LINES: - return out << "GL_LINES"; - case GL_POINTS: - return out << "GL_POINTS"; - */ - case GL_LINE_STRIP: - return out << "GL_LINE_STRIP"; - case GL_LINE_LOOP: - return out << "GL_LINE_LOOP"; - case GL_TRIANGLES: - return out << "GL_TRIANGLES"; - case GL_TRIANGLE_STRIP: - return out << "GL_TRIANGLE_STRIP"; - case GL_TRIANGLE_FAN: - return out << "GL_TRIANGLE_FAN"; - case GL_QUADS: - return out << "GL_QUADS"; - case GL_QUAD_STRIP: - return out << "GL_QUAD_STRIP"; - case GL_POLYGON: - return out << "GL_POLYGON"; - case GL_EDGE_FLAG: - return out << "GL_EDGE_FLAG"; - - /* Vertex Arrays */ - case GL_VERTEX_ARRAY: - return out << "GL_VERTEX_ARRAY"; - case GL_NORMAL_ARRAY: - return out << "GL_NORMAL_ARRAY"; - case GL_COLOR_ARRAY: - return out << "GL_COLOR_ARRAY"; - case GL_INDEX_ARRAY: - return out << "GL_INDEX_ARRAY"; - case GL_TEXTURE_COORD_ARRAY: - return out << "GL_TEXTURE_COORD_ARRAY"; - case GL_EDGE_FLAG_ARRAY: - return out << "GL_EDGE_FLAG_ARRAY"; - case GL_VERTEX_ARRAY_SIZE: - return out << "GL_VERTEX_ARRAY_SIZE"; - case GL_VERTEX_ARRAY_TYPE: - return out << "GL_VERTEX_ARRAY_TYPE"; - case GL_VERTEX_ARRAY_STRIDE: - return out << "GL_VERTEX_ARRAY_STRIDE"; - case GL_NORMAL_ARRAY_TYPE: - return out << "GL_NORMAL_ARRAY_TYPE"; - case GL_NORMAL_ARRAY_STRIDE: - return out << "GL_NORMAL_ARRAY_STRIDE"; - case GL_COLOR_ARRAY_SIZE: - return out << "GL_COLOR_ARRAY_SIZE"; - case GL_COLOR_ARRAY_TYPE: - return out << "GL_COLOR_ARRAY_TYPE"; - case GL_COLOR_ARRAY_STRIDE: - return out << "GL_COLOR_ARRAY_STRIDE"; - case GL_INDEX_ARRAY_TYPE: - return out << "GL_INDEX_ARRAY_TYPE"; - case GL_INDEX_ARRAY_STRIDE: - return out << "GL_INDEX_ARRAY_STRIDE"; - case GL_TEXTURE_COORD_ARRAY_SIZE: - return out << "GL_TEXTURE_COORD_ARRAY_SIZE"; - case GL_TEXTURE_COORD_ARRAY_TYPE: - return out << "GL_TEXTURE_COORD_ARRAY_TYPE"; - case GL_TEXTURE_COORD_ARRAY_STRIDE: - return out << "GL_TEXTURE_COORD_ARRAY_STRIDE"; - case GL_EDGE_FLAG_ARRAY_STRIDE: - return out << "GL_EDGE_FLAG_ARRAY_STRIDE"; - case GL_VERTEX_ARRAY_POINTER: - return out << "GL_VERTEX_ARRAY_POINTER"; - case GL_NORMAL_ARRAY_POINTER: - return out << "GL_NORMAL_ARRAY_POINTER"; - case GL_COLOR_ARRAY_POINTER: - return out << "GL_COLOR_ARRAY_POINTER"; - case GL_INDEX_ARRAY_POINTER: - return out << "GL_INDEX_ARRAY_POINTER"; - case GL_TEXTURE_COORD_ARRAY_POINTER: - return out << "GL_TEXTURE_COORD_ARRAY_POINTER"; - case GL_EDGE_FLAG_ARRAY_POINTER: - return out << "GL_EDGE_FLAG_ARRAY_POINTER"; - case GL_V2F: - return out << "GL_V2F"; - case GL_V3F: - return out << "GL_V3F"; - case GL_C4UB_V2F: - return out << "GL_C4UB_V2F"; - case GL_C4UB_V3F: - return out << "GL_C4UB_V3F"; - case GL_C3F_V3F: - return out << "GL_C3F_V3F"; - case GL_N3F_V3F: - return out << "GL_N3F_V3F"; - case GL_C4F_N3F_V3F: - return out << "GL_C4F_N3F_V3F"; - case GL_T2F_V3F: - return out << "GL_T2F_V3F"; - case GL_T4F_V4F: - return out << "GL_T4F_V4F"; - case GL_T2F_C4UB_V3F: - return out << "GL_T2F_C4UB_V3F"; - case GL_T2F_C3F_V3F: - return out << "GL_T2F_C3F_V3F"; - case GL_T2F_N3F_V3F: - return out << "GL_T2F_N3F_V3F"; - case GL_T2F_C4F_N3F_V3F: - return out << "GL_T2F_C4F_N3F_V3F"; - case GL_T4F_C4F_N3F_V4F: - return out << "GL_T4F_C4F_N3F_V4F"; - - /* Matrix Mode */ - case GL_MATRIX_MODE: - return out << "GL_MATRIX_MODE"; - case GL_MODELVIEW: - return out << "GL_MODELVIEW"; - case GL_PROJECTION: - return out << "GL_PROJECTION"; - case GL_TEXTURE: - return out << "GL_TEXTURE"; - - /* Points */ - case GL_POINT_SMOOTH: - return out << "GL_POINT_SMOOTH"; - case GL_POINT_SIZE: - return out << "GL_POINT_SIZE"; - case GL_POINT_SIZE_GRANULARITY: - return out << "GL_POINT_SIZE_GRANULARITY"; - case GL_POINT_SIZE_RANGE: - return out << "GL_POINT_SIZE_RANGE"; - - /* Lines */ - case GL_LINE_SMOOTH: - return out << "GL_LINE_SMOOTH"; - case GL_LINE_STIPPLE: - return out << "GL_LINE_STIPPLE"; - case GL_LINE_STIPPLE_PATTERN: - return out << "GL_LINE_STIPPLE_PATTERN"; - case GL_LINE_STIPPLE_REPEAT: - return out << "GL_LINE_STIPPLE_REPEAT"; - case GL_LINE_WIDTH: - return out << "GL_LINE_WIDTH"; - case GL_LINE_WIDTH_GRANULARITY: - return out << "GL_LINE_WIDTH_GRANULARITY"; - case GL_LINE_WIDTH_RANGE: - return out << "GL_LINE_WIDTH_RANGE"; - - /* Polygons */ - case GL_POINT: - return out << "GL_POINT"; - case GL_LINE: - return out << "GL_LINE"; - case GL_FILL: - return out << "GL_FILL"; - case GL_CCW: - return out << "GL_CCW"; - case GL_CW: - return out << "GL_CW"; - case GL_FRONT: - return out << "GL_FRONT"; - case GL_BACK: - return out << "GL_BACK"; - case GL_CULL_FACE: - return out << "GL_CULL_FACE"; - case GL_CULL_FACE_MODE: - return out << "GL_CULL_FACE_MODE"; - case GL_POLYGON_SMOOTH: - return out << "GL_POLYGON_SMOOTH"; - case GL_POLYGON_STIPPLE: - return out << "GL_POLYGON_STIPPLE"; - case GL_FRONT_FACE: - return out << "GL_FRONT_FACE"; - case GL_POLYGON_MODE: - return out << "GL_POLYGON_MODE"; - case GL_POLYGON_OFFSET_FACTOR: - return out << "GL_POLYGON_OFFSET_FACTOR"; - case GL_POLYGON_OFFSET_UNITS: - return out << "GL_POLYGON_OFFSET_UNITS"; - case GL_POLYGON_OFFSET_POINT: - return out << "GL_POLYGON_OFFSET_POINT"; - case GL_POLYGON_OFFSET_LINE: - return out << "GL_POLYGON_OFFSET_LINE"; - case GL_POLYGON_OFFSET_FILL: - return out << "GL_POLYGON_OFFSET_FILL"; - - /* Display Lists */ - case GL_COMPILE: - return out << "GL_COMPILE"; - case GL_COMPILE_AND_EXECUTE: - return out << "GL_COMPILE_AND_EXECUTE"; - case GL_LIST_BASE: - return out << "GL_LIST_BASE"; - case GL_LIST_INDEX: - return out << "GL_LIST_INDEX"; - case GL_LIST_MODE: - return out << "GL_LIST_MODE"; - - /* Depth buffer */ - case GL_NEVER: - return out << "GL_NEVER"; - case GL_LESS: - return out << "GL_LESS"; - case GL_GEQUAL: - return out << "GL_GEQUAL"; - case GL_LEQUAL: - return out << "GL_LEQUAL"; - case GL_GREATER: - return out << "GL_GREATER"; - case GL_NOTEQUAL: - return out << "GL_NOTEQUAL"; - case GL_EQUAL: - return out << "GL_EQUAL"; - case GL_ALWAYS: - return out << "GL_ALWAYS"; - case GL_DEPTH_TEST: - return out << "GL_DEPTH_TEST"; - case GL_DEPTH_BITS: - return out << "GL_DEPTH_BITS"; - case GL_DEPTH_CLEAR_VALUE: - return out << "GL_DEPTH_CLEAR_VALUE"; - case GL_DEPTH_FUNC: - return out << "GL_DEPTH_FUNC"; - case GL_DEPTH_RANGE: - return out << "GL_DEPTH_RANGE"; - case GL_DEPTH_WRITEMASK: - return out << "GL_DEPTH_WRITEMASK"; - case GL_DEPTH_COMPONENT: - return out << "GL_DEPTH_COMPONENT"; - - /* Lighting */ - case GL_LIGHTING: - return out << "GL_LIGHTING"; - case GL_LIGHT0: - return out << "GL_LIGHT0"; - case GL_LIGHT1: - return out << "GL_LIGHT1"; - case GL_LIGHT2: - return out << "GL_LIGHT2"; - case GL_LIGHT3: - return out << "GL_LIGHT3"; - case GL_LIGHT4: - return out << "GL_LIGHT4"; - case GL_LIGHT5: - return out << "GL_LIGHT5"; - case GL_LIGHT6: - return out << "GL_LIGHT6"; - case GL_LIGHT7: - return out << "GL_LIGHT7"; - case GL_SPOT_EXPONENT: - return out << "GL_SPOT_EXPONENT"; - case GL_SPOT_CUTOFF: - return out << "GL_SPOT_CUTOFF"; - case GL_CONSTANT_ATTENUATION: - return out << "GL_CONSTANT_ATTENUATION"; - case GL_LINEAR_ATTENUATION: - return out << "GL_LINEAR_ATTENUATION"; - case GL_QUADRATIC_ATTENUATION: - return out << "GL_QUADRATIC_ATTENUATION"; - case GL_AMBIENT: - return out << "GL_AMBIENT"; - case GL_DIFFUSE: - return out << "GL_DIFFUSE"; - case GL_SPECULAR: - return out << "GL_SPECULAR"; - case GL_SHININESS: - return out << "GL_SHININESS"; - case GL_EMISSION: - return out << "GL_EMISSION"; - case GL_POSITION: - return out << "GL_POSITION"; - case GL_SPOT_DIRECTION: - return out << "GL_SPOT_DIRECTION"; - case GL_AMBIENT_AND_DIFFUSE: - return out << "GL_AMBIENT_AND_DIFFUSE"; - case GL_COLOR_INDEXES: - return out << "GL_COLOR_INDEXES"; - case GL_LIGHT_MODEL_TWO_SIDE: - return out << "GL_LIGHT_MODEL_TWO_SIDE"; - case GL_LIGHT_MODEL_LOCAL_VIEWER: - return out << "GL_LIGHT_MODEL_LOCAL_VIEWER"; - case GL_LIGHT_MODEL_AMBIENT: - return out << "GL_LIGHT_MODEL_AMBIENT"; - case GL_FRONT_AND_BACK: - return out << "GL_FRONT_AND_BACK"; - case GL_SHADE_MODEL: - return out << "GL_SHADE_MODEL"; - case GL_FLAT: - return out << "GL_FLAT"; - case GL_SMOOTH: - return out << "GL_SMOOTH"; - case GL_COLOR_MATERIAL: - return out << "GL_COLOR_MATERIAL"; - case GL_COLOR_MATERIAL_FACE: - return out << "GL_COLOR_MATERIAL_FACE"; - case GL_COLOR_MATERIAL_PARAMETER: - return out << "GL_COLOR_MATERIAL_PARAMETER"; - case GL_NORMALIZE: - return out << "GL_NORMALIZE"; - - /* User clipping planes */ - case GL_CLIP_PLANE0: - return out << "GL_CLIP_PLANE0"; - case GL_CLIP_PLANE1: - return out << "GL_CLIP_PLANE1"; - case GL_CLIP_PLANE2: - return out << "GL_CLIP_PLANE2"; - case GL_CLIP_PLANE3: - return out << "GL_CLIP_PLANE3"; - case GL_CLIP_PLANE4: - return out << "GL_CLIP_PLANE4"; - case GL_CLIP_PLANE5: - return out << "GL_CLIP_PLANE5"; - - /* Accumulation buffer */ - case GL_ACCUM_RED_BITS: - return out << "GL_ACCUM_RED_BITS"; - case GL_ACCUM_GREEN_BITS: - return out << "GL_ACCUM_GREEN_BITS"; - case GL_ACCUM_BLUE_BITS: - return out << "GL_ACCUM_BLUE_BITS"; - case GL_ACCUM_ALPHA_BITS: - return out << "GL_ACCUM_ALPHA_BITS"; - case GL_ACCUM_CLEAR_VALUE: - return out << "GL_ACCUM_CLEAR_VALUE"; - case GL_ACCUM: - return out << "GL_ACCUM"; - case GL_ADD: - return out << "GL_ADD"; - case GL_LOAD: - return out << "GL_LOAD"; - case GL_MULT: - return out << "GL_MULT"; - - /* Alpha testing */ - case GL_ALPHA_TEST: - return out << "GL_ALPHA_TEST"; - case GL_ALPHA_TEST_REF: - return out << "GL_ALPHA_TEST_REF"; - case GL_ALPHA_TEST_FUNC: - return out << "GL_ALPHA_TEST_FUNC"; - - /* Blending */ - case GL_BLEND: - return out << "GL_BLEND"; - case GL_BLEND_SRC: - return out << "GL_BLEND_SRC"; - case GL_BLEND_DST: - return out << "GL_BLEND_DST"; - /* - case GL_ZERO: - return out << "GL_ZERO"; - case GL_ONE: - return out << "GL_ONE"; - */ - case GL_SRC_COLOR: - return out << "GL_SRC_COLOR"; - case GL_ONE_MINUS_SRC_COLOR: - return out << "GL_ONE_MINUS_SRC_COLOR"; - case GL_DST_COLOR: - return out << "GL_DST_COLOR"; - case GL_ONE_MINUS_DST_COLOR: - return out << "GL_ONE_MINUS_DST_COLOR"; - case GL_SRC_ALPHA: - return out << "GL_SRC_ALPHA"; - case GL_ONE_MINUS_SRC_ALPHA: - return out << "GL_ONE_MINUS_SRC_ALPHA"; - case GL_DST_ALPHA: - return out << "GL_DST_ALPHA"; - case GL_ONE_MINUS_DST_ALPHA: - return out << "GL_ONE_MINUS_DST_ALPHA"; - case GL_SRC_ALPHA_SATURATE: - return out << "GL_SRC_ALPHA_SATURATE"; - case GL_CONSTANT_COLOR: - return out << "GL_CONSTANT_COLOR"; - case GL_ONE_MINUS_CONSTANT_COLOR: - return out << "GL_ONE_MINUS_CONSTANT_COLOR"; - case GL_CONSTANT_ALPHA: - return out << "GL_CONSTANT_ALPHA"; - case GL_ONE_MINUS_CONSTANT_ALPHA: - return out << "GL_ONE_MINUS_CONSTANT_ALPHA"; - - /* Render Mode */ - case GL_FEEDBACK: - return out << "GL_FEEDBACK"; - case GL_RENDER: - return out << "GL_RENDER"; - case GL_SELECT: - return out << "GL_SELECT"; - - /* Feedback */ - case GL_2D: - return out << "GL_2D"; - case GL_3D: - return out << "GL_3D"; - case GL_3D_COLOR: - return out << "GL_3D_COLOR"; - case GL_3D_COLOR_TEXTURE: - return out << "GL_3D_COLOR_TEXTURE"; - case GL_4D_COLOR_TEXTURE: - return out << "GL_4D_COLOR_TEXTURE"; - case GL_POINT_TOKEN: - return out << "GL_POINT_TOKEN"; - case GL_LINE_TOKEN: - return out << "GL_LINE_TOKEN"; - case GL_LINE_RESET_TOKEN: - return out << "GL_LINE_RESET_TOKEN"; - case GL_POLYGON_TOKEN: - return out << "GL_POLYGON_TOKEN"; - case GL_BITMAP_TOKEN: - return out << "GL_BITMAP_TOKEN"; - case GL_DRAW_PIXEL_TOKEN: - return out << "GL_DRAW_PIXEL_TOKEN"; - case GL_COPY_PIXEL_TOKEN: - return out << "GL_COPY_PIXEL_TOKEN"; - case GL_PASS_THROUGH_TOKEN: - return out << "GL_PASS_THROUGH_TOKEN"; - case GL_FEEDBACK_BUFFER_POINTER: - return out << "GL_FEEDBACK_BUFFER_POINTER"; - case GL_FEEDBACK_BUFFER_SIZE: - return out << "GL_FEEDBACK_BUFFER_SIZE"; - case GL_FEEDBACK_BUFFER_TYPE: - return out << "GL_FEEDBACK_BUFFER_TYPE"; - - /* Selection */ - case GL_SELECTION_BUFFER_POINTER: - return out << "GL_SELECTION_BUFFER_POINTER"; - case GL_SELECTION_BUFFER_SIZE: - return out << "GL_SELECTION_BUFFER_SIZE"; - - /* Fog */ - case GL_FOG: - return out << "GL_FOG"; - case GL_FOG_MODE: - return out << "GL_FOG_MODE"; - case GL_FOG_DENSITY: - return out << "GL_FOG_DENSITY"; - case GL_FOG_COLOR: - return out << "GL_FOG_COLOR"; - case GL_FOG_INDEX: - return out << "GL_FOG_INDEX"; - case GL_FOG_START: - return out << "GL_FOG_START"; - case GL_FOG_END: - return out << "GL_FOG_END"; - case GL_LINEAR: - return out << "GL_LINEAR"; - case GL_EXP: - return out << "GL_EXP"; - case GL_EXP2: - return out << "GL_EXP2"; - - /* Logic Ops */ - case GL_LOGIC_OP: - return out << "GL_LOGIC_OP"; - /* - case GL_INDEX_LOGIC_OP: - return out << "GL_INDEX_LOGIC_OP"; - */ - case GL_COLOR_LOGIC_OP: - return out << "GL_COLOR_LOGIC_OP"; - case GL_LOGIC_OP_MODE: - return out << "GL_LOGIC_OP_MODE"; - case GL_CLEAR: - return out << "GL_CLEAR"; - case GL_SET: - return out << "GL_SET"; - case GL_COPY: - return out << "GL_COPY"; - case GL_COPY_INVERTED: - return out << "GL_COPY_INVERTED"; - case GL_NOOP: - return out << "GL_NOOP"; - case GL_INVERT: - return out << "GL_INVERT"; - case GL_AND: - return out << "GL_AND"; - case GL_NAND: - return out << "GL_NAND"; - case GL_OR: - return out << "GL_OR"; - case GL_NOR: - return out << "GL_NOR"; - case GL_XOR: - return out << "GL_XOR"; - case GL_EQUIV: - return out << "GL_EQUIV"; - case GL_AND_REVERSE: - return out << "GL_AND_REVERSE"; - case GL_AND_INVERTED: - return out << "GL_AND_INVERTED"; - case GL_OR_REVERSE: - return out << "GL_OR_REVERSE"; - case GL_OR_INVERTED: - return out << "GL_OR_INVERTED"; - - /* Stencil */ - case GL_STENCIL_TEST: - return out << "GL_STENCIL_TEST"; - case GL_STENCIL_WRITEMASK: - return out << "GL_STENCIL_WRITEMASK"; - case GL_STENCIL_BITS: - return out << "GL_STENCIL_BITS"; - case GL_STENCIL_FUNC: - return out << "GL_STENCIL_FUNC"; - case GL_STENCIL_VALUE_MASK: - return out << "GL_STENCIL_VALUE_MASK"; - case GL_STENCIL_REF: - return out << "GL_STENCIL_REF"; - case GL_STENCIL_FAIL: - return out << "GL_STENCIL_FAIL"; - case GL_STENCIL_PASS_DEPTH_PASS: - return out << "GL_STENCIL_PASS_DEPTH_PASS"; - case GL_STENCIL_PASS_DEPTH_FAIL: - return out << "GL_STENCIL_PASS_DEPTH_FAIL"; - case GL_STENCIL_CLEAR_VALUE: - return out << "GL_STENCIL_CLEAR_VALUE"; - case GL_STENCIL_INDEX: - return out << "GL_STENCIL_INDEX"; - case GL_KEEP: - return out << "GL_KEEP"; - case GL_REPLACE: - return out << "GL_REPLACE"; - case GL_INCR: - return out << "GL_INCR"; - case GL_DECR: - return out << "GL_DECR"; - - /* Buffers, Pixel Drawing/Reading */ - /* - case GL_NONE: - return out << "GL_NONE"; - */ - case GL_LEFT: - return out << "GL_LEFT"; - case GL_RIGHT: - return out << "GL_RIGHT"; - case GL_FRONT_LEFT: - return out << "GL_FRONT_LEFT"; - case GL_FRONT_RIGHT: - return out << "GL_FRONT_RIGHT"; - case GL_BACK_LEFT: - return out << "GL_BACK_LEFT"; - case GL_BACK_RIGHT: - return out << "GL_BACK_RIGHT"; - case GL_AUX0: - return out << "GL_AUX0"; - case GL_AUX1: - return out << "GL_AUX1"; - case GL_AUX2: - return out << "GL_AUX2"; - case GL_AUX3: - return out << "GL_AUX3"; - case GL_COLOR_INDEX: - return out << "GL_COLOR_INDEX"; - case GL_RED: - return out << "GL_RED"; - case GL_GREEN: - return out << "GL_GREEN"; - case GL_BLUE: - return out << "GL_BLUE"; - case GL_ALPHA: - return out << "GL_ALPHA"; - case GL_LUMINANCE: - return out << "GL_LUMINANCE"; - case GL_LUMINANCE_ALPHA: - return out << "GL_LUMINANCE_ALPHA"; - case GL_ALPHA_BITS: - return out << "GL_ALPHA_BITS"; - case GL_RED_BITS: - return out << "GL_RED_BITS"; - case GL_GREEN_BITS: - return out << "GL_GREEN_BITS"; - case GL_BLUE_BITS: - return out << "GL_BLUE_BITS"; - case GL_INDEX_BITS: - return out << "GL_INDEX_BITS"; - case GL_SUBPIXEL_BITS: - return out << "GL_SUBPIXEL_BITS"; - case GL_AUX_BUFFERS: - return out << "GL_AUX_BUFFERS"; - case GL_READ_BUFFER: - return out << "GL_READ_BUFFER"; - case GL_DRAW_BUFFER: - return out << "GL_DRAW_BUFFER"; - case GL_DOUBLEBUFFER: - return out << "GL_DOUBLEBUFFER"; - case GL_STEREO: - return out << "GL_STEREO"; - case GL_BITMAP: - return out << "GL_BITMAP"; - case GL_COLOR: - return out << "GL_COLOR"; - case GL_DEPTH: - return out << "GL_DEPTH"; - case GL_STENCIL: - return out << "GL_STENCIL"; - case GL_DITHER: - return out << "GL_DITHER"; - case GL_RGB: - return out << "GL_RGB"; - case GL_RGBA: - return out << "GL_RGBA"; - - /* Implementation limits */ - case GL_MAX_LIST_NESTING: - return out << "GL_MAX_LIST_NESTING"; - case GL_MAX_ATTRIB_STACK_DEPTH: - return out << "GL_MAX_ATTRIB_STACK_DEPTH"; - case GL_MAX_MODELVIEW_STACK_DEPTH: - return out << "GL_MAX_MODELVIEW_STACK_DEPTH"; - case GL_MAX_NAME_STACK_DEPTH: - return out << "GL_MAX_NAME_STACK_DEPTH"; - case GL_MAX_PROJECTION_STACK_DEPTH: - return out << "GL_MAX_PROJECTION_STACK_DEPTH"; - case GL_MAX_TEXTURE_STACK_DEPTH: - return out << "GL_MAX_TEXTURE_STACK_DEPTH"; - case GL_MAX_EVAL_ORDER: - return out << "GL_MAX_EVAL_ORDER"; - case GL_MAX_LIGHTS: - return out << "GL_MAX_LIGHTS"; - case GL_MAX_CLIP_PLANES: - return out << "GL_MAX_CLIP_PLANES"; - case GL_MAX_TEXTURE_SIZE: - return out << "GL_MAX_TEXTURE_SIZE"; - case GL_MAX_PIXEL_MAP_TABLE: - return out << "GL_MAX_PIXEL_MAP_TABLE"; - case GL_MAX_VIEWPORT_DIMS: - return out << "GL_MAX_VIEWPORT_DIMS"; - case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: - return out << "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH"; - - /* Gets */ - case GL_ATTRIB_STACK_DEPTH: - return out << "GL_ATTRIB_STACK_DEPTH"; - case GL_CLIENT_ATTRIB_STACK_DEPTH: - return out << "GL_CLIENT_ATTRIB_STACK_DEPTH"; - case GL_COLOR_CLEAR_VALUE: - return out << "GL_COLOR_CLEAR_VALUE"; - case GL_COLOR_WRITEMASK: - return out << "GL_COLOR_WRITEMASK"; - case GL_CURRENT_INDEX: - return out << "GL_CURRENT_INDEX"; - case GL_CURRENT_COLOR: - return out << "GL_CURRENT_COLOR"; - case GL_CURRENT_NORMAL: - return out << "GL_CURRENT_NORMAL"; - case GL_CURRENT_RASTER_COLOR: - return out << "GL_CURRENT_RASTER_COLOR"; - case GL_CURRENT_RASTER_DISTANCE: - return out << "GL_CURRENT_RASTER_DISTANCE"; - case GL_CURRENT_RASTER_INDEX: - return out << "GL_CURRENT_RASTER_INDEX"; - case GL_CURRENT_RASTER_POSITION: - return out << "GL_CURRENT_RASTER_POSITION"; - case GL_CURRENT_RASTER_TEXTURE_COORDS: - return out << "GL_CURRENT_RASTER_TEXTURE_COORDS"; - case GL_CURRENT_RASTER_POSITION_VALID: - return out << "GL_CURRENT_RASTER_POSITION_VALID"; - case GL_CURRENT_TEXTURE_COORDS: - return out << "GL_CURRENT_TEXTURE_COORDS"; - case GL_INDEX_CLEAR_VALUE: - return out << "GL_INDEX_CLEAR_VALUE"; - case GL_INDEX_MODE: - return out << "GL_INDEX_MODE"; - case GL_INDEX_WRITEMASK: - return out << "GL_INDEX_WRITEMASK"; - case GL_MODELVIEW_MATRIX: - return out << "GL_MODELVIEW_MATRIX"; - case GL_MODELVIEW_STACK_DEPTH: - return out << "GL_MODELVIEW_STACK_DEPTH"; - case GL_NAME_STACK_DEPTH: - return out << "GL_NAME_STACK_DEPTH"; - case GL_PROJECTION_MATRIX: - return out << "GL_PROJECTION_MATRIX"; - case GL_PROJECTION_STACK_DEPTH: - return out << "GL_PROJECTION_STACK_DEPTH"; - case GL_RENDER_MODE: - return out << "GL_RENDER_MODE"; - case GL_RGBA_MODE: - return out << "GL_RGBA_MODE"; - case GL_TEXTURE_MATRIX: - return out << "GL_TEXTURE_MATRIX"; - case GL_TEXTURE_STACK_DEPTH: - return out << "GL_TEXTURE_STACK_DEPTH"; - case GL_VIEWPORT: - return out << "GL_VIEWPORT"; - - - /* Evaluators */ - case GL_AUTO_NORMAL: - return out << "GL_AUTO_NORMAL"; - case GL_MAP1_COLOR_4: - return out << "GL_MAP1_COLOR_4"; - case GL_MAP1_GRID_DOMAIN: - return out << "GL_MAP1_GRID_DOMAIN"; - case GL_MAP1_GRID_SEGMENTS: - return out << "GL_MAP1_GRID_SEGMENTS"; - case GL_MAP1_INDEX: - return out << "GL_MAP1_INDEX"; - case GL_MAP1_NORMAL: - return out << "GL_MAP1_NORMAL"; - case GL_MAP1_TEXTURE_COORD_1: - return out << "GL_MAP1_TEXTURE_COORD_1"; - case GL_MAP1_TEXTURE_COORD_2: - return out << "GL_MAP1_TEXTURE_COORD_2"; - case GL_MAP1_TEXTURE_COORD_3: - return out << "GL_MAP1_TEXTURE_COORD_3"; - case GL_MAP1_TEXTURE_COORD_4: - return out << "GL_MAP1_TEXTURE_COORD_4"; - case GL_MAP1_VERTEX_3: - return out << "GL_MAP1_VERTEX_3"; - case GL_MAP1_VERTEX_4: - return out << "GL_MAP1_VERTEX_4"; - case GL_MAP2_COLOR_4: - return out << "GL_MAP2_COLOR_4"; - case GL_MAP2_GRID_DOMAIN: - return out << "GL_MAP2_GRID_DOMAIN"; - case GL_MAP2_GRID_SEGMENTS: - return out << "GL_MAP2_GRID_SEGMENTS"; - case GL_MAP2_INDEX: - return out << "GL_MAP2_INDEX"; - case GL_MAP2_NORMAL: - return out << "GL_MAP2_NORMAL"; - case GL_MAP2_TEXTURE_COORD_1: - return out << "GL_MAP2_TEXTURE_COORD_1"; - case GL_MAP2_TEXTURE_COORD_2: - return out << "GL_MAP2_TEXTURE_COORD_2"; - case GL_MAP2_TEXTURE_COORD_3: - return out << "GL_MAP2_TEXTURE_COORD_3"; - case GL_MAP2_TEXTURE_COORD_4: - return out << "GL_MAP2_TEXTURE_COORD_4"; - case GL_MAP2_VERTEX_3: - return out << "GL_MAP2_VERTEX_3"; - case GL_MAP2_VERTEX_4: - return out << "GL_MAP2_VERTEX_4"; - case GL_COEFF: - return out << "GL_COEFF"; - case GL_DOMAIN: - return out << "GL_DOMAIN"; - case GL_ORDER: - return out << "GL_ORDER"; - - /* Hints */ - case GL_FOG_HINT: - return out << "GL_FOG_HINT"; - case GL_LINE_SMOOTH_HINT: - return out << "GL_LINE_SMOOTH_HINT"; - case GL_PERSPECTIVE_CORRECTION_HINT: - return out << "GL_PERSPECTIVE_CORRECTION_HINT"; - case GL_POINT_SMOOTH_HINT: - return out << "GL_POINT_SMOOTH_HINT"; - case GL_POLYGON_SMOOTH_HINT: - return out << "GL_POLYGON_SMOOTH_HINT"; - case GL_DONT_CARE: - return out << "GL_DONT_CARE"; - case GL_FASTEST: - return out << "GL_FASTEST"; - case GL_NICEST: - return out << "GL_NICEST"; - - /* Scissor box */ - case GL_SCISSOR_TEST: - return out << "GL_SCISSOR_TEST"; - case GL_SCISSOR_BOX: - return out << "GL_SCISSOR_BOX"; - - /* Pixel Mode / Transfer */ - case GL_MAP_COLOR: - return out << "GL_MAP_COLOR"; - case GL_MAP_STENCIL: - return out << "GL_MAP_STENCIL"; - case GL_INDEX_SHIFT: - return out << "GL_INDEX_SHIFT"; - case GL_INDEX_OFFSET: - return out << "GL_INDEX_OFFSET"; - case GL_RED_SCALE: - return out << "GL_RED_SCALE"; - case GL_RED_BIAS: - return out << "GL_RED_BIAS"; - case GL_GREEN_SCALE: - return out << "GL_GREEN_SCALE"; - case GL_GREEN_BIAS: - return out << "GL_GREEN_BIAS"; - case GL_BLUE_SCALE: - return out << "GL_BLUE_SCALE"; - case GL_BLUE_BIAS: - return out << "GL_BLUE_BIAS"; - case GL_ALPHA_SCALE: - return out << "GL_ALPHA_SCALE"; - case GL_ALPHA_BIAS: - return out << "GL_ALPHA_BIAS"; - case GL_DEPTH_SCALE: - return out << "GL_DEPTH_SCALE"; - case GL_DEPTH_BIAS: - return out << "GL_DEPTH_BIAS"; - case GL_PIXEL_MAP_S_TO_S_SIZE: - return out << "GL_PIXEL_MAP_S_TO_S_SIZE"; - case GL_PIXEL_MAP_I_TO_I_SIZE: - return out << "GL_PIXEL_MAP_I_TO_I_SIZE"; - case GL_PIXEL_MAP_I_TO_R_SIZE: - return out << "GL_PIXEL_MAP_I_TO_R_SIZE"; - case GL_PIXEL_MAP_I_TO_G_SIZE: - return out << "GL_PIXEL_MAP_I_TO_G_SIZE"; - case GL_PIXEL_MAP_I_TO_B_SIZE: - return out << "GL_PIXEL_MAP_I_TO_B_SIZE"; - case GL_PIXEL_MAP_I_TO_A_SIZE: - return out << "GL_PIXEL_MAP_I_TO_A_SIZE"; - case GL_PIXEL_MAP_R_TO_R_SIZE: - return out << "GL_PIXEL_MAP_R_TO_R_SIZE"; - case GL_PIXEL_MAP_G_TO_G_SIZE: - return out << "GL_PIXEL_MAP_G_TO_G_SIZE"; - case GL_PIXEL_MAP_B_TO_B_SIZE: - return out << "GL_PIXEL_MAP_B_TO_B_SIZE"; - case GL_PIXEL_MAP_A_TO_A_SIZE: - return out << "GL_PIXEL_MAP_A_TO_A_SIZE"; - case GL_PIXEL_MAP_S_TO_S: - return out << "GL_PIXEL_MAP_S_TO_S"; - case GL_PIXEL_MAP_I_TO_I: - return out << "GL_PIXEL_MAP_I_TO_I"; - case GL_PIXEL_MAP_I_TO_R: - return out << "GL_PIXEL_MAP_I_TO_R"; - case GL_PIXEL_MAP_I_TO_G: - return out << "GL_PIXEL_MAP_I_TO_G"; - case GL_PIXEL_MAP_I_TO_B: - return out << "GL_PIXEL_MAP_I_TO_B"; - case GL_PIXEL_MAP_I_TO_A: - return out << "GL_PIXEL_MAP_I_TO_A"; - case GL_PIXEL_MAP_R_TO_R: - return out << "GL_PIXEL_MAP_R_TO_R"; - case GL_PIXEL_MAP_G_TO_G: - return out << "GL_PIXEL_MAP_G_TO_G"; - case GL_PIXEL_MAP_B_TO_B: - return out << "GL_PIXEL_MAP_B_TO_B"; - case GL_PIXEL_MAP_A_TO_A: - return out << "GL_PIXEL_MAP_A_TO_A"; - case GL_PACK_ALIGNMENT: - return out << "GL_PACK_ALIGNMENT"; - case GL_PACK_LSB_FIRST: - return out << "GL_PACK_LSB_FIRST"; - case GL_PACK_ROW_LENGTH: - return out << "GL_PACK_ROW_LENGTH"; - case GL_PACK_SKIP_PIXELS: - return out << "GL_PACK_SKIP_PIXELS"; - case GL_PACK_SKIP_ROWS: - return out << "GL_PACK_SKIP_ROWS"; - case GL_PACK_SWAP_BYTES: - return out << "GL_PACK_SWAP_BYTES"; - case GL_UNPACK_ALIGNMENT: - return out << "GL_UNPACK_ALIGNMENT"; - case GL_UNPACK_LSB_FIRST: - return out << "GL_UNPACK_LSB_FIRST"; - case GL_UNPACK_ROW_LENGTH: - return out << "GL_UNPACK_ROW_LENGTH"; - case GL_UNPACK_SKIP_PIXELS: - return out << "GL_UNPACK_SKIP_PIXELS"; - case GL_UNPACK_SKIP_ROWS: - return out << "GL_UNPACK_SKIP_ROWS"; - case GL_UNPACK_SWAP_BYTES: - return out << "GL_UNPACK_SWAP_BYTES"; - case GL_ZOOM_X: - return out << "GL_ZOOM_X"; - case GL_ZOOM_Y: - return out << "GL_ZOOM_Y"; - - /* Texture mapping */ - case GL_TEXTURE_ENV: - return out << "GL_TEXTURE_ENV"; - case GL_TEXTURE_ENV_MODE: - return out << "GL_TEXTURE_ENV_MODE"; - case GL_TEXTURE_1D: - return out << "GL_TEXTURE_1D"; - case GL_TEXTURE_2D: - return out << "GL_TEXTURE_2D"; - case GL_TEXTURE_WRAP_S: - return out << "GL_TEXTURE_WRAP_S"; - case GL_TEXTURE_WRAP_T: - return out << "GL_TEXTURE_WRAP_T"; - case GL_TEXTURE_MAG_FILTER: - return out << "GL_TEXTURE_MAG_FILTER"; - case GL_TEXTURE_MIN_FILTER: - return out << "GL_TEXTURE_MIN_FILTER"; - case GL_TEXTURE_ENV_COLOR: - return out << "GL_TEXTURE_ENV_COLOR"; - case GL_TEXTURE_GEN_S: - return out << "GL_TEXTURE_GEN_S"; - case GL_TEXTURE_GEN_T: - return out << "GL_TEXTURE_GEN_T"; - case GL_TEXTURE_GEN_MODE: - return out << "GL_TEXTURE_GEN_MODE"; - case GL_TEXTURE_BORDER_COLOR: - return out << "GL_TEXTURE_BORDER_COLOR"; - case GL_TEXTURE_WIDTH: - return out << "GL_TEXTURE_WIDTH"; - case GL_TEXTURE_HEIGHT: - return out << "GL_TEXTURE_HEIGHT"; - case GL_TEXTURE_BORDER: - return out << "GL_TEXTURE_BORDER"; - case GL_TEXTURE_COMPONENTS: - return out << "GL_TEXTURE_COMPONENTS"; - case GL_TEXTURE_RED_SIZE: - return out << "GL_TEXTURE_RED_SIZE"; - case GL_TEXTURE_GREEN_SIZE: - return out << "GL_TEXTURE_GREEN_SIZE"; - case GL_TEXTURE_BLUE_SIZE: - return out << "GL_TEXTURE_BLUE_SIZE"; - case GL_TEXTURE_ALPHA_SIZE: - return out << "GL_TEXTURE_ALPHA_SIZE"; - case GL_TEXTURE_LUMINANCE_SIZE: - return out << "GL_TEXTURE_LUMINANCE_SIZE"; - case GL_TEXTURE_INTENSITY_SIZE: - return out << "GL_TEXTURE_INTENSITY_SIZE"; - case GL_NEAREST_MIPMAP_NEAREST: - return out << "GL_NEAREST_MIPMAP_NEAREST"; - case GL_NEAREST_MIPMAP_LINEAR: - return out << "GL_NEAREST_MIPMAP_LINEAR"; - case GL_LINEAR_MIPMAP_NEAREST: - return out << "GL_LINEAR_MIPMAP_NEAREST"; - case GL_LINEAR_MIPMAP_LINEAR: - return out << "GL_LINEAR_MIPMAP_LINEAR"; - case GL_OBJECT_LINEAR: - return out << "GL_OBJECT_LINEAR"; - case GL_OBJECT_PLANE: - return out << "GL_OBJECT_PLANE"; - case GL_EYE_LINEAR: - return out << "GL_EYE_LINEAR"; - case GL_EYE_PLANE: - return out << "GL_EYE_PLANE"; - case GL_SPHERE_MAP: - return out << "GL_SPHERE_MAP"; - case GL_DECAL: - return out << "GL_DECAL"; - case GL_MODULATE: - return out << "GL_MODULATE"; - case GL_NEAREST: - return out << "GL_NEAREST"; - case GL_REPEAT: - return out << "GL_REPEAT"; - case GL_CLAMP: - return out << "GL_CLAMP"; - case GL_S: - return out << "GL_S"; - case GL_T: - return out << "GL_T"; - case GL_R: - return out << "GL_R"; - case GL_Q: - return out << "GL_Q"; - case GL_TEXTURE_GEN_R: - return out << "GL_TEXTURE_GEN_R"; - case GL_TEXTURE_GEN_Q: - return out << "GL_TEXTURE_GEN_Q"; - - /* GL 1.1 texturing */ - case GL_PROXY_TEXTURE_1D: - return out << "GL_PROXY_TEXTURE_1D"; - case GL_PROXY_TEXTURE_2D: - return out << "GL_PROXY_TEXTURE_2D"; - case GL_TEXTURE_PRIORITY: - return out << "GL_TEXTURE_PRIORITY"; - case GL_TEXTURE_RESIDENT: - return out << "GL_TEXTURE_RESIDENT"; - case GL_TEXTURE_BINDING_1D: - return out << "GL_TEXTURE_BINDING_1D"; - case GL_TEXTURE_BINDING_2D: - return out << "GL_TEXTURE_BINDING_2D"; - /* - case GL_TEXTURE_INTERNAL_FORMAT: - return out << "GL_TEXTURE_INTERNAL_FORMAT"; - */ - - /* GL 1.2 texturing */ - case GL_PACK_SKIP_IMAGES: - return out << "GL_PACK_SKIP_IMAGES"; - case GL_PACK_IMAGE_HEIGHT: - return out << "GL_PACK_IMAGE_HEIGHT"; - case GL_UNPACK_SKIP_IMAGES: - return out << "GL_UNPACK_SKIP_IMAGES"; - case GL_UNPACK_IMAGE_HEIGHT: - return out << "GL_UNPACK_IMAGE_HEIGHT"; - case GL_TEXTURE_3D: - return out << "GL_TEXTURE_3D"; - case GL_PROXY_TEXTURE_3D: - return out << "GL_PROXY_TEXTURE_3D"; - case GL_TEXTURE_DEPTH: - return out << "GL_TEXTURE_DEPTH"; - case GL_TEXTURE_WRAP_R: - return out << "GL_TEXTURE_WRAP_R"; - case GL_MAX_3D_TEXTURE_SIZE: - return out << "GL_MAX_3D_TEXTURE_SIZE"; - case GL_TEXTURE_BINDING_3D: - return out << "GL_TEXTURE_BINDING_3D"; - - /* Internal texture formats (GL 1.1) */ - case GL_ALPHA4: - return out << "GL_ALPHA4"; - case GL_ALPHA8: - return out << "GL_ALPHA8"; - case GL_ALPHA12: - return out << "GL_ALPHA12"; - case GL_ALPHA16: - return out << "GL_ALPHA16"; - case GL_LUMINANCE4: - return out << "GL_LUMINANCE4"; - case GL_LUMINANCE8: - return out << "GL_LUMINANCE8"; - case GL_LUMINANCE12: - return out << "GL_LUMINANCE12"; - case GL_LUMINANCE16: - return out << "GL_LUMINANCE16"; - case GL_LUMINANCE4_ALPHA4: - return out << "GL_LUMINANCE4_ALPHA4"; - case GL_LUMINANCE6_ALPHA2: - return out << "GL_LUMINANCE6_ALPHA2"; - case GL_LUMINANCE8_ALPHA8: - return out << "GL_LUMINANCE8_ALPHA8"; - case GL_LUMINANCE12_ALPHA4: - return out << "GL_LUMINANCE12_ALPHA4"; - case GL_LUMINANCE12_ALPHA12: - return out << "GL_LUMINANCE12_ALPHA12"; - case GL_LUMINANCE16_ALPHA16: - return out << "GL_LUMINANCE16_ALPHA16"; - case GL_INTENSITY: - return out << "GL_INTENSITY"; - case GL_INTENSITY4: - return out << "GL_INTENSITY4"; - case GL_INTENSITY8: - return out << "GL_INTENSITY8"; - case GL_INTENSITY12: - return out << "GL_INTENSITY12"; - case GL_INTENSITY16: - return out << "GL_INTENSITY16"; - case GL_R3_G3_B2: - return out << "GL_R3_G3_B2"; - case GL_RGB4: - return out << "GL_RGB4"; - case GL_RGB5: - return out << "GL_RGB5"; - case GL_RGB8: - return out << "GL_RGB8"; - case GL_RGB10: - return out << "GL_RGB10"; - case GL_RGB12: - return out << "GL_RGB12"; - case GL_RGB16: - return out << "GL_RGB16"; - case GL_RGBA2: - return out << "GL_RGBA2"; - case GL_RGBA4: - return out << "GL_RGBA4"; - case GL_RGB5_A1: - return out << "GL_RGB5_A1"; - case GL_RGBA8: - return out << "GL_RGBA8"; - case GL_RGB10_A2: - return out << "GL_RGB10_A2"; - case GL_RGBA12: - return out << "GL_RGBA12"; - case GL_RGBA16: - return out << "GL_RGBA16"; - - /* Utility */ - case GL_VENDOR: - return out << "GL_VENDOR"; - case GL_RENDERER: - return out << "GL_RENDERER"; - case GL_VERSION: - return out << "GL_VERSION"; - case GL_EXTENSIONS: - return out << "GL_EXTENSIONS"; - - /* Errors */ - case GL_INVALID_VALUE: - return out << "GL_INVALID_VALUE"; - case GL_INVALID_ENUM: - return out << "GL_INVALID_ENUM"; - case GL_INVALID_OPERATION: - return out << "GL_INVALID_OPERATION"; - case GL_STACK_OVERFLOW: - return out << "GL_STACK_OVERFLOW"; - case GL_STACK_UNDERFLOW: - return out << "GL_STACK_UNDERFLOW"; - case GL_OUT_OF_MEMORY: - return out << "GL_OUT_OF_MEMORY"; - - /* OpenGL 1.2 */ - case GL_RESCALE_NORMAL: - return out << "GL_RESCALE_NORMAL"; - case GL_CLAMP_TO_EDGE: - return out << "GL_CLAMP_TO_EDGE"; - case GL_MAX_ELEMENTS_VERTICES: - return out << "GL_MAX_ELEMENTS_VERTICES"; - case GL_MAX_ELEMENTS_INDICES: - return out << "GL_MAX_ELEMENTS_INDICES"; - case GL_BGR: - return out << "GL_BGR"; - case GL_BGRA: - return out << "GL_BGRA"; - case GL_UNSIGNED_BYTE_3_3_2: - return out << "GL_UNSIGNED_BYTE_3_3_2"; - case GL_UNSIGNED_BYTE_2_3_3_REV: - return out << "GL_UNSIGNED_BYTE_2_3_3_REV"; - case GL_UNSIGNED_SHORT_5_6_5: - return out << "GL_UNSIGNED_SHORT_5_6_5"; - case GL_UNSIGNED_SHORT_5_6_5_REV: - return out << "GL_UNSIGNED_SHORT_5_6_5_REV"; - case GL_UNSIGNED_SHORT_4_4_4_4: - return out << "GL_UNSIGNED_SHORT_4_4_4_4"; - case GL_UNSIGNED_SHORT_4_4_4_4_REV: - return out << "GL_UNSIGNED_SHORT_4_4_4_4_REV"; - case GL_UNSIGNED_SHORT_5_5_5_1: - return out << "GL_UNSIGNED_SHORT_5_5_5_1"; - case GL_UNSIGNED_SHORT_1_5_5_5_REV: - return out << "GL_UNSIGNED_SHORT_1_5_5_5_REV"; - case GL_UNSIGNED_INT_8_8_8_8: - return out << "GL_UNSIGNED_INT_8_8_8_8"; - case GL_UNSIGNED_INT_8_8_8_8_REV: - return out << "GL_UNSIGNED_INT_8_8_8_8_REV"; - case GL_UNSIGNED_INT_10_10_10_2: - return out << "GL_UNSIGNED_INT_10_10_10_2"; - case GL_UNSIGNED_INT_2_10_10_10_REV: - return out << "GL_UNSIGNED_INT_2_10_10_10_REV"; - case GL_LIGHT_MODEL_COLOR_CONTROL: - return out << "GL_LIGHT_MODEL_COLOR_CONTROL"; - case GL_SINGLE_COLOR: - return out << "GL_SINGLE_COLOR"; - case GL_SEPARATE_SPECULAR_COLOR: - return out << "GL_SEPARATE_SPECULAR_COLOR"; - case GL_TEXTURE_MIN_LOD: - return out << "GL_TEXTURE_MIN_LOD"; - case GL_TEXTURE_MAX_LOD: - return out << "GL_TEXTURE_MAX_LOD"; - case GL_TEXTURE_BASE_LEVEL: - return out << "GL_TEXTURE_BASE_LEVEL"; - case GL_TEXTURE_MAX_LEVEL: - return out << "GL_TEXTURE_MAX_LEVEL"; - } - - return out << (int)v; -} -#endif diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.h b/panda/src/glstuff/glGraphicsStateGuardian_src.h index eb59fc1b18..29d5f62ad0 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.h +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.h @@ -100,6 +100,7 @@ public: virtual void draw_triangles(const qpGeomTriangles *primitive); virtual void draw_tristrips(const qpGeomTristrips *primitive); virtual void draw_lines(const qpGeomLines *primitive); + virtual void draw_linestrips(const qpGeomLinestrips *primitive); virtual void draw_points(const qpGeomPoints *primitive); virtual void end_draw_primitives(); @@ -390,16 +391,24 @@ public: typedef pvector DeletedDisplayLists; DeletedDisplayLists _deleted_display_lists; -public: - static GraphicsStateGuardian * - make_GlGraphicsStateGuardian(const FactoryParams ¶ms); + static PStatCollector _vertices_display_list_pcollector; - static TypeHandle get_class_type(void); - static void init_type(void); - virtual TypeHandle get_type(void) const; +public: + virtual TypeHandle get_type() const { + return get_class_type(); + } virtual TypeHandle force_init_type() {init_type(); return get_class_type();} - static PStatCollector _vertices_display_list_pcollector; + static TypeHandle get_class_type() { + return _type_handle; + } + +public: + static void init_type() { + GraphicsStateGuardian::init_type(); + register_type(_type_handle, CLASSPREFIX_QUOTED "GraphicsStateGuardian", + GraphicsStateGuardian::get_class_type()); + } private: static TypeHandle _type_handle; diff --git a/panda/src/gobj/qpgeom.I b/panda/src/gobj/qpgeom.I index 23fda5de84..61babb7ce4 100644 --- a/panda/src/gobj/qpgeom.I +++ b/panda/src/gobj/qpgeom.I @@ -31,6 +31,32 @@ get_primitive_type() const { return cdata->_primitive_type; } +//////////////////////////////////////////////////////////////////// +// Function: qpGeom::get_shade_model +// Access: Published +// Description: Returns the shade model common to all of the +// individual GeomPrimitives that have been added to the +// geom. +//////////////////////////////////////////////////////////////////// +INLINE qpGeom::ShadeModel qpGeom:: +get_shade_model() const { + CDReader cdata(_cycler); + return cdata->_shade_model; +} + +//////////////////////////////////////////////////////////////////// +// Function: qpGeom::get_geom_rendering +// Access: Published +// Description: Returns the set of GeomRendering bits that represent +// the rendering properties required to properly render +// this Geom. +//////////////////////////////////////////////////////////////////// +INLINE int qpGeom:: +get_geom_rendering() const { + CDReader cdata(_cycler); + return cdata->_geom_rendering; +} + //////////////////////////////////////////////////////////////////// // Function: qpGeom::get_usage_hint // Access: Published @@ -48,19 +74,6 @@ get_usage_hint() const { return cdata->_usage_hint; } -//////////////////////////////////////////////////////////////////// -// Function: qpGeom::get_point_rendering -// Access: Published -// Description: Returns the set of PointRendering bits that represent -// the rendering properties required to properly render -// the points (if any) represented within this Geom. -//////////////////////////////////////////////////////////////////// -INLINE int qpGeom:: -get_point_rendering() const { - CDReader cdata(_cycler); - return cdata->_point_rendering; -} - //////////////////////////////////////////////////////////////////// // Function: qpGeom::get_vertex_data // Access: Published @@ -123,6 +136,34 @@ modify_primitive(int i) { return cdata->_primitives[i]; } +//////////////////////////////////////////////////////////////////// +// Function: qpGeom::decompose +// Access: Published +// Description: Decomposes all of the primitives within this Geom, +// returning the result. See +// GeomPrimitive::decompose(). +//////////////////////////////////////////////////////////////////// +INLINE CPT(qpGeom) qpGeom:: +decompose() const { + PT(qpGeom) new_geom = new qpGeom(*this); + new_geom->decompose_in_place(); + return new_geom; +} + +//////////////////////////////////////////////////////////////////// +// Function: qpGeom::rotate +// Access: Published +// Description: Rotates all of the primitives within this Geom, +// returning the result. See +// GeomPrimitive::rotate(). +//////////////////////////////////////////////////////////////////// +INLINE CPT(qpGeom) qpGeom:: +rotate() const { + PT(qpGeom) new_geom = new qpGeom(*this); + new_geom->rotate_in_place(); + return new_geom; +} + //////////////////////////////////////////////////////////////////// // Function: qpGeom::get_modified // Access: Published @@ -179,7 +220,8 @@ operator < (const CacheEntry &other) const { INLINE qpGeom::CData:: CData() : _primitive_type(PT_none), - _point_rendering(0), + _shade_model(SM_uniform), + _geom_rendering(0), _usage_hint(UH_unspecified), _got_usage_hint(false) { @@ -195,7 +237,8 @@ CData(const qpGeom::CData ©) : _data(copy._data), _primitives(copy._primitives), _primitive_type(copy._primitive_type), - _point_rendering(copy._point_rendering), + _shade_model(copy._shade_model), + _geom_rendering(copy._geom_rendering), _usage_hint(copy._usage_hint), _got_usage_hint(copy._got_usage_hint), _modified(copy._modified) diff --git a/panda/src/gobj/qpgeom.cxx b/panda/src/gobj/qpgeom.cxx index ae2670620f..e34bd22dbd 100644 --- a/panda/src/gobj/qpgeom.cxx +++ b/panda/src/gobj/qpgeom.cxx @@ -162,7 +162,7 @@ set_vertex_data(const qpGeomVertexData *data) { CDWriter cdata(_cycler); cdata->_data = (qpGeomVertexData *)data; mark_bound_stale(); - reset_point_rendering(cdata); + reset_geom_rendering(cdata); } //////////////////////////////////////////////////////////////////// @@ -199,10 +199,9 @@ offset_vertices(const qpGeomVertexData *data, int offset) { #endif } - cdata->_got_usage_hint = false; cdata->_modified = qpGeom::get_next_modified(); mark_bound_stale(); - reset_point_rendering(cdata); + reset_geom_rendering(cdata); nassertv(all_is_valid); } @@ -225,25 +224,25 @@ set_primitive(int i, const qpGeomPrimitive *primitive) { nassertv(cdata->_primitive_type == PT_none || cdata->_primitive_type == primitive->get_primitive_type()); - if (cdata->_got_usage_hint && - cdata->_primitives[i]->get_usage_hint() != primitive->get_usage_hint()) { - if (cdata->_primitives[i]->get_usage_hint() < primitive->get_usage_hint()) { - // If we're reducing the usage hint, we might also be reducing - // the minimum usage hit. - cdata->_usage_hint = min(cdata->_usage_hint, primitive->get_usage_hint()); - } else { // (cdata->_primitives[i]->get_usage_hint() > primitive->get_usage_hint()) - // If we're increasing it, we might have to rederive the minimum. - if (cdata->_usage_hint == cdata->_primitives[i]->get_usage_hint()) { - cdata->_got_usage_hint = false; - } - } - } + // They also should have the same fundamental shade model, but + // SM_uniform is compatible with anything. + nassertv(cdata->_shade_model == SM_uniform || + primitive->get_shade_model() == SM_uniform || + cdata->_shade_model == primitive->get_shade_model()); + cdata->_primitives[i] = (qpGeomPrimitive *)primitive; PrimitiveType new_primitive_type = primitive->get_primitive_type(); if (new_primitive_type != cdata->_primitive_type) { cdata->_primitive_type = new_primitive_type; - reset_point_rendering(cdata); } + ShadeModel new_shade_model = primitive->get_shade_model(); + if (new_shade_model != cdata->_shade_model && + new_shade_model != SM_uniform) { + cdata->_shade_model = new_shade_model; + } + + reset_geom_rendering(cdata); + cdata->_got_usage_hint = false; cdata->_modified = qpGeom::get_next_modified(); } @@ -267,16 +266,25 @@ add_primitive(const qpGeomPrimitive *primitive) { nassertv(cdata->_primitive_type == PT_none || cdata->_primitive_type == primitive->get_primitive_type()); + // They also should have the same fundamental shade model, but + // SM_uniform is compatible with anything. + nassertv(cdata->_shade_model == SM_uniform || + primitive->get_shade_model() == SM_uniform || + cdata->_shade_model == primitive->get_shade_model()); + cdata->_primitives.push_back((qpGeomPrimitive *)primitive); PrimitiveType new_primitive_type = primitive->get_primitive_type(); if (new_primitive_type != cdata->_primitive_type) { cdata->_primitive_type = new_primitive_type; - reset_point_rendering(cdata); + } + ShadeModel new_shade_model = primitive->get_shade_model(); + if (new_shade_model != cdata->_shade_model && + new_shade_model != SM_uniform) { + cdata->_shade_model = new_shade_model; } - if (cdata->_got_usage_hint) { - cdata->_usage_hint = min(cdata->_usage_hint, primitive->get_usage_hint()); - } + reset_geom_rendering(cdata); + cdata->_got_usage_hint = false; cdata->_modified = qpGeom::get_next_modified(); } @@ -290,17 +298,13 @@ remove_primitive(int i) { clear_cache(); CDWriter cdata(_cycler); nassertv(i >= 0 && i < (int)cdata->_primitives.size()); - if (cdata->_got_usage_hint && - cdata->_usage_hint == cdata->_primitives[i]->get_usage_hint()) { - // Maybe we're raising the minimum usage_hint; we have to rederive - // the usage_hint later. - cdata->_got_usage_hint = false; - } cdata->_primitives.erase(cdata->_primitives.begin() + i); if (cdata->_primitives.empty()) { cdata->_primitive_type = PT_none; - reset_point_rendering(cdata); + cdata->_shade_model = SM_uniform; } + reset_geom_rendering(cdata); + cdata->_got_usage_hint = false; cdata->_modified = qpGeom::get_next_modified(); } @@ -318,7 +322,73 @@ clear_primitives() { CDWriter cdata(_cycler); cdata->_primitives.clear(); cdata->_primitive_type = PT_none; - reset_point_rendering(cdata); + cdata->_shade_model = SM_uniform; + reset_geom_rendering(cdata); +} + +//////////////////////////////////////////////////////////////////// +// Function: qpGeom::decompose_in_place +// Access: Published +// Description: Decomposes all of the primitives within this Geom, +// leaving the results in place. See +// GeomPrimitive::decompose(). +//////////////////////////////////////////////////////////////////// +void qpGeom:: +decompose_in_place() { + clear_cache(); + CDWriter cdata(_cycler); + +#ifndef NDEBUG + bool all_is_valid = true; +#endif + Primitives::iterator pi; + for (pi = cdata->_primitives.begin(); pi != cdata->_primitives.end(); ++pi) { + CPT(qpGeomPrimitive) new_prim = (*pi)->decompose(); + (*pi) = (qpGeomPrimitive *)new_prim.p(); + +#ifndef NDEBUG + if (!(*pi)->check_valid(cdata->_data)) { + all_is_valid = false; + } +#endif + } + + cdata->_modified = qpGeom::get_next_modified(); + reset_geom_rendering(cdata); + + nassertv(all_is_valid); +} + +//////////////////////////////////////////////////////////////////// +// Function: qpGeom::rotate_in_place +// Access: Published +// Description: Rotates all of the primitives within this Geom, +// leaving the results in place. See +// GeomPrimitive::rotate(). +//////////////////////////////////////////////////////////////////// +void qpGeom:: +rotate_in_place() { + clear_cache(); + CDWriter cdata(_cycler); + +#ifndef NDEBUG + bool all_is_valid = true; +#endif + Primitives::iterator pi; + for (pi = cdata->_primitives.begin(); pi != cdata->_primitives.end(); ++pi) { + CPT(qpGeomPrimitive) new_prim = (*pi)->rotate(); + (*pi) = (qpGeomPrimitive *)new_prim.p(); + +#ifndef NDEBUG + if (!(*pi)->check_valid(cdata->_data)) { + all_is_valid = false; + } +#endif + } + + cdata->_modified = qpGeom::get_next_modified(); + + nassertv(all_is_valid); } //////////////////////////////////////////////////////////////////// @@ -712,26 +782,44 @@ reset_usage_hint(qpGeom::CDWriter &cdata) { } //////////////////////////////////////////////////////////////////// -// Function: qpGeom::reset_point_rendering +// Function: qpGeom::reset_geom_rendering // Access: Private -// Description: Rederives the _point_rendering member. +// Description: Rederives the _geom_rendering member. //////////////////////////////////////////////////////////////////// void qpGeom:: -reset_point_rendering(qpGeom::CDWriter &cdata) { - cdata->_point_rendering = 0; - if (cdata->_primitive_type == PT_points) { - cdata->_point_rendering |= PR_point; +reset_geom_rendering(qpGeom::CDWriter &cdata) { + cdata->_geom_rendering = 0; + Primitives::const_iterator pi; + for (pi = cdata->_primitives.begin(); + pi != cdata->_primitives.end(); + ++pi) { + cdata->_geom_rendering |= (*pi)->get_geom_rendering(); + } + if ((cdata->_geom_rendering & GR_point) != 0) { if (cdata->_data->has_column(InternalName::get_size())) { - cdata->_point_rendering |= PR_per_point_size; + cdata->_geom_rendering |= GR_per_point_size; } if (cdata->_data->has_column(InternalName::get_aspect_ratio())) { - cdata->_point_rendering |= PR_aspect_ratio; + cdata->_geom_rendering |= GR_point_aspect_ratio; } if (cdata->_data->has_column(InternalName::get_rotate())) { - cdata->_point_rendering |= PR_rotate; + cdata->_geom_rendering |= GR_point_rotate; } } + + switch (get_shade_model()) { + case SM_flat_first_vertex: + cdata->_geom_rendering |= GR_flat_first_vertex; + break; + + case SM_flat_last_vertex: + cdata->_geom_rendering |= GR_flat_last_vertex; + break; + + default: + break; + } } //////////////////////////////////////////////////////////////////// @@ -862,7 +950,8 @@ write_datagram(BamWriter *manager, Datagram &dg) const { } dg.add_uint8(_primitive_type); - dg.add_uint16(_point_rendering); + dg.add_uint8(_shade_model); + dg.add_uint16(_geom_rendering); } //////////////////////////////////////////////////////////////////// @@ -905,7 +994,8 @@ fillin(DatagramIterator &scan, BamReader *manager) { } _primitive_type = (PrimitiveType)scan.get_uint8(); - _point_rendering = scan.get_uint16(); + _shade_model = (ShadeModel)scan.get_uint16(); + _geom_rendering = scan.get_uint16(); _got_usage_hint = false; _modified = qpGeom::get_next_modified(); } diff --git a/panda/src/gobj/qpgeom.h b/panda/src/gobj/qpgeom.h index 4909e4b9fd..81d382b960 100644 --- a/panda/src/gobj/qpgeom.h +++ b/panda/src/gobj/qpgeom.h @@ -68,11 +68,12 @@ PUBLISHED: virtual Geom *make_copy() const; INLINE PrimitiveType get_primitive_type() const; + INLINE ShadeModel get_shade_model() const; + INLINE int get_geom_rendering() const; + INLINE UsageHint get_usage_hint() const; void set_usage_hint(UsageHint usage_hint); - INLINE int get_point_rendering() const; - INLINE CPT(qpGeomVertexData) get_vertex_data() const; PT(qpGeomVertexData) modify_vertex_data(); void set_vertex_data(const qpGeomVertexData *data); @@ -86,6 +87,12 @@ PUBLISHED: void remove_primitive(int i); void clear_primitives(); + INLINE CPT(qpGeom) decompose() const; + INLINE CPT(qpGeom) rotate() const; + + void decompose_in_place(); + void rotate_in_place(); + int get_num_bytes() const; INLINE UpdateSeq get_modified() const; @@ -160,7 +167,8 @@ private: PT(qpGeomVertexData) _data; Primitives _primitives; PrimitiveType _primitive_type; - int _point_rendering; + ShadeModel _shade_model; + int _geom_rendering; UsageHint _usage_hint; bool _got_usage_hint; UpdateSeq _modified; @@ -172,7 +180,7 @@ private: typedef CycleDataWriter CDWriter; void reset_usage_hint(CDWriter &cdata); - void reset_point_rendering(CDWriter &cdata); + void reset_geom_rendering(CDWriter &cdata); static UpdateSeq _next_modified; diff --git a/panda/src/gobj/qpgeomEnums.h b/panda/src/gobj/qpgeomEnums.h index 074754db9b..93c69619a6 100644 --- a/panda/src/gobj/qpgeomEnums.h +++ b/panda/src/gobj/qpgeomEnums.h @@ -82,48 +82,68 @@ PUBLISHED: UH_unspecified, }; - // This type specifies a number of bits that are used to - // representing the rendering capabilities and/or requirements for - // fancy points. - enum PointRendering { + // This type specifies a number of bits that are used to represent + // the rendering requirements of a particular Geom, as well as the + // rendering capabilities of the GSG. The difference between the + // two indicates whether the Geom needs to be munged for the GSG. + enum GeomRendering { // If there are any points at all. - PR_point = 0x0001, + GR_point = 0x0001, // If the points are all the same size, other than 1 pixel. - PR_uniform_size = 0x0002, + GR_point_uniform_size = 0x0002, // If the points have a per-vertex size designation. - PR_per_point_size = 0x0004, + GR_per_point_size = 0x0004, // If the points' size is specified in camera units rather than // screen pixels. - PR_perspective = 0x0008, + GR_point_perspective = 0x0008, // If the points have a non-square aspect ratio. - PR_aspect_ratio = 0x0010, + GR_point_aspect_ratio = 0x0010, // If the points are rotated off the orthonormal axis. - PR_rotate = 0x0020, + GR_point_rotate = 0x0020, // If the points require texture coordinates interpolated across // their face, to render textures as sprites. - PR_sprite = 0x0040, + GR_point_sprite = 0x0040, + + // The union of all the above point attributes. + GR_point_bits = 0x007f, + + // If there are any of these composite types. + GR_triangle_strip = 0x0080, + GR_triangle_fan = 0x0100, + GR_line_strip = 0x0200, + + // The union of all of the above composite types. + GR_composite_bits = 0x0380, + + // If the shade model requires a particular vertex for flat shading. + GR_flat_first_vertex = 0x0400, + GR_flat_last_vertex = 0x0800, + + // The union of the above shade model types. + GR_shade_model_bits = 0x0c00, }; - // The shade model controls whether colors and/or lighting effects - // are smoothly interpolated across the face of a triangle, or - // uniform for the entire triangle. + // The shade model specifies whether the per-vertex colors and + // normals indexed by a given primitive truly represent per-vertex + // colors and normals, or whether they actually represent + // per-triangle flat-shaded colors and normals. enum ShadeModel { - // SM_smooth: vertices within a single face have different - // colors/normals that should be smoothed across the face. This - // primitive should be rendered with SmoothModelAttrib::M_smooth. - SM_smooth, - // SM_uniform: all vertices across all faces have the same colors // and normals. It doesn't really matter which ShadeModelAttrib // mode is used to render this primitive. SM_uniform, + // SM_smooth: vertices within a single face have different + // colors/normals that should be smoothed across the face. This + // primitive should be rendered with SmoothModelAttrib::M_smooth. + SM_smooth, + // SM_flat_(first,last)_vertex: each face within the primitive // might have a different color/normal than the other faces, but // across a particular face there is only one color/normal. Each diff --git a/panda/src/gobj/qpgeomLines.cxx b/panda/src/gobj/qpgeomLines.cxx index f5ebafd84b..0b0a6631eb 100644 --- a/panda/src/gobj/qpgeomLines.cxx +++ b/panda/src/gobj/qpgeomLines.cxx @@ -134,7 +134,7 @@ rotate_impl() const { new_vertices.push_back(vertices[begin]); } - nassertr(new_vertices.size() == vertices.size(), vertices); + nassertr(new_vertices.size() == vertices.size(), CPTA_ushort()); return new_vertices; } diff --git a/panda/src/gobj/qpgeomLinestrips.cxx b/panda/src/gobj/qpgeomLinestrips.cxx index 370d1bd96b..8e1929bf47 100644 --- a/panda/src/gobj/qpgeomLinestrips.cxx +++ b/panda/src/gobj/qpgeomLinestrips.cxx @@ -79,6 +79,18 @@ get_primitive_type() const { return PT_lines; } +//////////////////////////////////////////////////////////////////// +// Function: qpGeomLinestrips::get_geom_rendering +// Access: Published, Virtual +// Description: Returns the set of GeomRendering bits that represent +// the rendering properties required to properly render +// this primitive. +//////////////////////////////////////////////////////////////////// +int qpGeomLinestrips:: +get_geom_rendering() const { + return GR_line_strip; +} + //////////////////////////////////////////////////////////////////// // Function: qpGeomLinestrips::get_min_num_vertices_per_primitive // Access: Public, Virtual @@ -167,7 +179,7 @@ rotate_impl() const { } begin = end; } - nassertr(new_vertices.size() == vertices.size(), vertices); + nassertr(new_vertices.size() == vertices.size(), CPTA_ushort()); return new_vertices; } diff --git a/panda/src/gobj/qpgeomLinestrips.h b/panda/src/gobj/qpgeomLinestrips.h index 2d738e5a2a..c11f1991de 100644 --- a/panda/src/gobj/qpgeomLinestrips.h +++ b/panda/src/gobj/qpgeomLinestrips.h @@ -37,7 +37,7 @@ PUBLISHED: public: virtual PT(qpGeomPrimitive) make_copy() const; virtual PrimitiveType get_primitive_type() const; - + virtual int get_geom_rendering() const; virtual int get_min_num_vertices_per_primitive() const; public: diff --git a/panda/src/gobj/qpgeomPoints.cxx b/panda/src/gobj/qpgeomPoints.cxx index bd239dcadf..415aa1523d 100644 --- a/panda/src/gobj/qpgeomPoints.cxx +++ b/panda/src/gobj/qpgeomPoints.cxx @@ -78,6 +78,21 @@ get_primitive_type() const { return PT_points; } +//////////////////////////////////////////////////////////////////// +// Function: qpGeomPoints::get_geom_rendering +// Access: Published, Virtual +// Description: Returns the set of GeomRendering bits that represent +// the rendering properties required to properly render +// this primitive. +//////////////////////////////////////////////////////////////////// +int qpGeomPoints:: +get_geom_rendering() const { + // Fancy point attributes, if any, are based on whether the + // appropriate columns are defined in the associated GeomVertexData; + // these bits will be added by Geom::get_geom_rendering(). + return GR_point; +} + //////////////////////////////////////////////////////////////////// // Function: qpGeomPoints::get_num_vertices_per_primitive // Access: Public, Virtual diff --git a/panda/src/gobj/qpgeomPoints.h b/panda/src/gobj/qpgeomPoints.h index 2300a4e442..61c7365504 100644 --- a/panda/src/gobj/qpgeomPoints.h +++ b/panda/src/gobj/qpgeomPoints.h @@ -37,6 +37,7 @@ PUBLISHED: public: virtual PT(qpGeomPrimitive) make_copy() const; virtual PrimitiveType get_primitive_type() const; + virtual int get_geom_rendering() const; virtual int get_num_vertices_per_primitive() const; virtual int get_min_num_vertices_per_primitive() const; diff --git a/panda/src/gobj/qpgeomPrimitive.I b/panda/src/gobj/qpgeomPrimitive.I index 991bb3976b..b6fe27b0e3 100644 --- a/panda/src/gobj/qpgeomPrimitive.I +++ b/panda/src/gobj/qpgeomPrimitive.I @@ -17,6 +17,36 @@ //////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: qpGeomPrimitive::get_shade_model +// Access: Published +// Description: Returns the ShadeModel hint for this primitive. +// This is intended as a hint to the renderer to tell it +// how the per-vertex colors and normals are applied. +//////////////////////////////////////////////////////////////////// +INLINE qpGeomPrimitive::ShadeModel qpGeomPrimitive:: +get_shade_model() const { + CDReader cdata(_cycler); + return cdata->_shade_model; +} + +//////////////////////////////////////////////////////////////////// +// Function: qpGeomPrimitive::set_shade_model +// Access: Published +// Description: Changes the ShadeModel hint for this primitive. +// This is different from the ShadeModelAttrib that +// might also be applied from the scene graph. This +// does not affect the shade model that is in effect +// when rendering, but rather serves as a hint to the +// renderer to tell it how the per-vertex colors and +// normals on this primitive are applied. +//////////////////////////////////////////////////////////////////// +INLINE void qpGeomPrimitive:: +set_shade_model(qpGeomPrimitive::ShadeModel shade_model) { + CDWriter cdata(_cycler); + cdata->_shade_model = shade_model; +} + //////////////////////////////////////////////////////////////////// // Function: qpGeomPrimitive::get_usage_hint // Access: Published @@ -47,42 +77,10 @@ get_usage_hint() const { //////////////////////////////////////////////////////////////////// INLINE void qpGeomPrimitive:: set_usage_hint(qpGeomPrimitive::UsageHint usage_hint) { - clear_cache(); CDWriter cdata(_cycler); cdata->_usage_hint = usage_hint; } -//////////////////////////////////////////////////////////////////// -// Function: qpGeomPrimitive::get_shade_model -// Access: Published -// Description: Returns the ShadeModel hint for this primitive. -// This is intended as a hint to the renderer to tell it -// how the per-vertex colors and normals are applied. -//////////////////////////////////////////////////////////////////// -INLINE qpGeomPrimitive::ShadeModel qpGeomPrimitive:: -get_shade_model() const { - CDReader cdata(_cycler); - return cdata->_shade_model; -} - -//////////////////////////////////////////////////////////////////// -// Function: qpGeomPrimitive::set_shade_model -// Access: Published -// Description: Changes the ShadeModel hint for this primitive. -// This is different from the ShadeModelAttrib that -// might also be applied from the scene graph. This -// does not affect the shade model that is in effect -// when rendering, but rather serves as a hint to the -// renderer to tell it how the per-vertex colors and -// normals on this primitive are applied. -//////////////////////////////////////////////////////////////////// -INLINE void qpGeomPrimitive:: -set_shade_model(qpGeomPrimitive::ShadeModel shade_model) { - CDWriter cdata(_cycler); - cdata->_shade_model = shade_model; - cdata->_rotated_vertices.clear(); -} - //////////////////////////////////////////////////////////////////// // Function: qpGeomPrimitive::get_num_vertices // Access: Published @@ -246,64 +244,6 @@ get_vertices() const { return cdata->_vertices; } -//////////////////////////////////////////////////////////////////// -// Function: qpGeomPrimitive::get_flat_first_vertices -// Access: Public -// Description: Returns a const pointer to the vertex index array, -// suitable for traversing for a renderer that expects -// the key vertex of each triangle in a flat-shaded -// model to be the triangle's first vertex (as DirectX -// does). -// -// The result of this is dependent on the value -// specified to set_shade_model(). If the shade model -// indicates flat_last_vertex, this will return the -// vertices rotated to bring them into first_vertex -// compliance; otherwise, it will be the unmodified -// result from get_vertices(). -//////////////////////////////////////////////////////////////////// -INLINE CPTA_ushort qpGeomPrimitive:: -get_flat_first_vertices() const { - CDReader cdata(_cycler); - if (cdata->_shade_model == SM_flat_last_vertex) { - if (cdata->_rotated_vertices == (const ushort *)NULL) { - return ((qpGeomPrimitive *)this)->do_rotate(cdata); - } - return cdata->_rotated_vertices; - } else { - return cdata->_vertices; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: qpGeomPrimitive::get_flat_last_vertices -// Access: Public -// Description: Returns a const pointer to the vertex index array, -// suitable for traversing for a renderer that expects -// the key vertex of each triangle in a flat-shaded -// model to be the triangle's last vertex (as OpenGL -// does). -// -// The result of this is dependent on the value -// specified to set_shade_model(). If the shade model -// indicates flat_first_vertex, this will return the -// vertices rotated to bring them into last_vertex -// compliance; otherwise, it will be the unmodified -// result from get_vertices(). -//////////////////////////////////////////////////////////////////// -INLINE CPTA_ushort qpGeomPrimitive:: -get_flat_last_vertices() const { - CDReader cdata(_cycler); - if (cdata->_shade_model == SM_flat_first_vertex) { - if (cdata->_rotated_vertices == (const ushort *)NULL) { - return ((qpGeomPrimitive *)this)->do_rotate(cdata); - } - return cdata->_rotated_vertices; - } else { - return cdata->_vertices; - } -} - //////////////////////////////////////////////////////////////////// // Function: qpGeomPrimitive::get_ends // Access: Public @@ -391,7 +331,6 @@ CData(const qpGeomPrimitive::CData ©) : _usage_hint(copy._usage_hint), _shade_model(copy._shade_model), _vertices(copy._vertices), - _rotated_vertices(copy._rotated_vertices), _ends(copy._ends), _mins(copy._mins), _maxs(copy._maxs), diff --git a/panda/src/gobj/qpgeomPrimitive.cxx b/panda/src/gobj/qpgeomPrimitive.cxx index 9f1d0200cb..9cb2be8030 100644 --- a/panda/src/gobj/qpgeomPrimitive.cxx +++ b/panda/src/gobj/qpgeomPrimitive.cxx @@ -30,7 +30,8 @@ TypeHandle qpGeomPrimitive::_type_handle; -PStatCollector qpGeomPrimitive::_rotate_pcollector("Draw:Rotate"); +PStatCollector qpGeomPrimitive::_decompose_pcollector("Cull:Munge:Decompose"); +PStatCollector qpGeomPrimitive::_rotate_pcollector("Cull:Munge:Rotate"); //////////////////////////////////////////////////////////////////// // Function: qpGeomPrimitive::Constructor @@ -61,24 +62,22 @@ qpGeomPrimitive(const qpGeomPrimitive ©) : //////////////////////////////////////////////////////////////////// qpGeomPrimitive:: ~qpGeomPrimitive() { - // When we destruct, we should ensure that all of our cached - // entries, across all pipeline stages, are properly removed from - // the cache manager. - int num_stages = _cycler.get_num_stages(); - for (int i = 0; i < num_stages; i++) { - if (_cycler.is_stage_unique(i)) { - CData *cdata = _cycler.write_stage(i); - if (cdata->_cache != (CacheEntry *)NULL) { - cdata->_cache->erase(); - cdata->_cache = NULL; - } - _cycler.release_write_stage(i, cdata); - } - } - release_all(); } +//////////////////////////////////////////////////////////////////// +// Function: qpGeomPrimitive::get_geom_rendering +// Access: Published, Virtual +// Description: Returns the set of GeomRendering bits that represent +// the rendering properties required to properly render +// this primitive. +//////////////////////////////////////////////////////////////////// +int qpGeomPrimitive:: +get_geom_rendering() const { + // The default is nothing fancy. + return 0; +} + //////////////////////////////////////////////////////////////////// // Function: qpGeomPrimitive::add_vertex // Access: Published @@ -94,7 +93,6 @@ add_vertex(int vertex) { unsigned short short_vertex = vertex; nassertv((int)short_vertex == vertex); - clear_cache(); CDWriter cdata(_cycler); int num_primitives = get_num_primitives(); @@ -106,7 +104,6 @@ add_vertex(int vertex) { } cdata->_vertices.push_back(short_vertex); - cdata->_rotated_vertices.clear(); if (cdata->_got_minmax) { cdata->_min_vertex = min(cdata->_min_vertex, short_vertex); @@ -139,7 +136,6 @@ add_consecutive_vertices(int start, int num_vertices) { if (num_vertices == 0) { return; } - clear_cache(); int end = (start + num_vertices) - 1; unsigned short short_start = start; unsigned short short_end = end; @@ -158,7 +154,6 @@ add_consecutive_vertices(int start, int num_vertices) { for (unsigned short v = short_start; v <= short_end; ++v) { cdata->_vertices.push_back(v); } - cdata->_rotated_vertices.clear(); if (cdata->_got_minmax) { cdata->_min_vertex = min(cdata->_min_vertex, short_start); @@ -210,7 +205,6 @@ add_next_vertices(int num_vertices) { //////////////////////////////////////////////////////////////////// bool qpGeomPrimitive:: close_primitive() { - clear_cache(); int num_vertices_per_primitive = get_num_vertices_per_primitive(); CDWriter cdata(_cycler); @@ -262,10 +256,8 @@ close_primitive() { //////////////////////////////////////////////////////////////////// void qpGeomPrimitive:: clear_vertices() { - clear_cache(); CDWriter cdata(_cycler); cdata->_vertices.clear(); - cdata->_rotated_vertices.clear(); cdata->_ends.clear(); cdata->_mins.clear(); cdata->_maxs.clear(); @@ -280,10 +272,8 @@ clear_vertices() { //////////////////////////////////////////////////////////////////// void qpGeomPrimitive:: offset_vertices(int offset) { - clear_cache(); CDWriter cdata(_cycler); - cdata->_rotated_vertices.clear(); cdata->_mins.clear(); cdata->_maxs.clear(); cdata->_got_minmax = false; @@ -427,49 +417,44 @@ get_primitive_num_vertices(int n) const { //////////////////////////////////////////////////////////////////// CPT(qpGeomPrimitive) qpGeomPrimitive:: decompose() const { - CPT(qpGeomPrimitive) result; - { - // Use read() and release_read() instead of CDReader, because the - // call to record_primitive() might recursively call back into - // this object, and require a write. - const CData *cdata = _cycler.read(); - if (cdata->_cache != (CacheEntry *)NULL) { - result = cdata->_cache->_decomposed; - _cycler.release_read(cdata); - // Record a cache hit, so this element will stay in the cache a - // while longer. - cdata->_cache->refresh(); - - return result; - } - _cycler.release_read(cdata); - } - - result = decompose_impl(); - if (result.p() == this || result.p() == NULL) { - // decomposing this primitive has no effect or cannot be done. - return this; - } - if (gobj_cat.is_debug()) { gobj_cat.debug() << "Decomposing " << get_type() << ": " << (void *)this << "\n"; } - // Record the result for the future. - CacheEntry *entry; - { - CDWriter cdata(((qpGeomPrimitive *)this)->_cycler); - entry = new CacheEntry; - entry->_source = (qpGeomPrimitive *)this; - entry->_decomposed = result; - cdata->_cache = entry; + PStatTimer timer(_decompose_pcollector); + return decompose_impl(); +} + +//////////////////////////////////////////////////////////////////// +// Function: qpGeomPrimitive::rotate +// Access: Published +// Description: Returns a new primitive with the shade_model reversed +// (if it is flat shaded). +// +// If the current shade_model indicates +// flat_vertex_last, this should bring the last vertex +// to the first position; if it indicates +// flat_vertex_first, this should bring the first vertex +// to the last position. +//////////////////////////////////////////////////////////////////// +CPT(qpGeomPrimitive) qpGeomPrimitive:: +rotate() const { + if (gobj_cat.is_debug()) { + gobj_cat.debug() + << "Rotating " << get_type() << ": " << (void *)this << "\n"; } - // And add *this* object to the cache manager. - entry->record(); + PStatTimer timer(_rotate_pcollector); + CPTA_ushort rotated_vertices = rotate_impl(); - return result; + if (rotated_vertices.is_null()) { + return this; + } + + PT(qpGeomPrimitive) new_prim = make_copy(); + new_prim->set_vertices(rotated_vertices); + return new_prim; } //////////////////////////////////////////////////////////////////// @@ -554,9 +539,7 @@ write(ostream &out, int indent_level) const { //////////////////////////////////////////////////////////////////// PTA_ushort qpGeomPrimitive:: modify_vertices() { - clear_cache(); CDWriter cdata(_cycler); - cdata->_rotated_vertices.clear(); cdata->_got_minmax = false; return cdata->_vertices; } @@ -570,10 +553,8 @@ modify_vertices() { //////////////////////////////////////////////////////////////////// void qpGeomPrimitive:: set_vertices(CPTA_ushort vertices) { - clear_cache(); CDWriter cdata(_cycler); cdata->_vertices = (PTA_ushort &)vertices; - cdata->_rotated_vertices.clear(); cdata->_got_minmax = false; } @@ -591,9 +572,7 @@ set_vertices(CPTA_ushort vertices) { //////////////////////////////////////////////////////////////////// PTA_int qpGeomPrimitive:: modify_ends() { - clear_cache(); CDWriter cdata(_cycler); - cdata->_rotated_vertices.clear(); cdata->_got_minmax = false; return cdata->_ends; } @@ -612,10 +591,8 @@ modify_ends() { //////////////////////////////////////////////////////////////////// void qpGeomPrimitive:: set_ends(CPTA_int ends) { - clear_cache(); CDWriter cdata(_cycler); cdata->_ends = (PTA_int &)ends; - cdata->_rotated_vertices.clear(); cdata->_got_minmax = false; } @@ -660,28 +637,6 @@ get_num_unused_vertices_per_primitive() const { return 0; } -//////////////////////////////////////////////////////////////////// -// Function: qpGeomPrimitive::clear_cache -// Access: Public -// Description: Removes all of the previously-cached results of -// decompose(). -//////////////////////////////////////////////////////////////////// -void qpGeomPrimitive:: -clear_cache() { - // Probably we shouldn't do anything at all here unless we are - // running in pipeline stage 0. - CData *cdata = CDWriter(_cycler); - if (cdata->_cache != (CacheEntry *)NULL) { - cdata->_cache->erase(); - cdata->_cache = NULL; - } - - // This, on the other hand, should be applied to the current - // pipeline stage. - cdata->_modified = qpGeom::get_next_modified(); -} - - //////////////////////////////////////////////////////////////////// // Function: qpGeomPrimitive::prepare // Access: Public @@ -892,13 +847,13 @@ decompose_impl() const { //////////////////////////////////////////////////////////////////// // Function: qpGeomPrimitive::rotate_impl // Access: Protected, Virtual -// Description: The virtual implementation of do_rotate(). +// Description: The virtual implementation of rotate(). //////////////////////////////////////////////////////////////////// CPTA_ushort qpGeomPrimitive:: rotate_impl() const { // The default implementation doesn't even try to do anything. - nassertr(false, get_vertices()); - return get_vertices(); + nassertr(false, CPTA_ushort()); + return CPTA_ushort(); } //////////////////////////////////////////////////////////////////// @@ -914,34 +869,6 @@ void qpGeomPrimitive:: append_unused_vertices(PTA_ushort &, int) { } -//////////////////////////////////////////////////////////////////// -// Function: qpGeomPrimitive::do_rotate -// Access: Private -// Description: Fills _rotated_vertices by rotating the individual -// primitives to bring each flat-colored vertex to the -// opposite position. If the current shade_model -// indicates flat_vertex_last, this should bring the -// last vertex to the first position; if it indicates -// flat_vertex_first, this should bring the first vertex -// to the last position. This is used internally to -// implement get_flat_first_vertices() and -// get_flat_last_vertices(). -//////////////////////////////////////////////////////////////////// -CPTA_ushort qpGeomPrimitive:: -do_rotate(qpGeomPrimitive::CDReader &cdata) { - if (gobj_cat.is_debug()) { - gobj_cat.debug() - << "Rotating " << get_type() << ": " << (void *)this << "\n"; - } - - PStatTimer timer(_rotate_pcollector); - CPTA_ushort rotated_vertices = rotate_impl(); - - CDWriter cdataw(_cycler, cdata); - cdataw->_rotated_vertices = rotated_vertices; - return rotated_vertices; -} - //////////////////////////////////////////////////////////////////// // Function: qpGeomPrimitive::recompute_minmax // Access: Private @@ -1041,46 +968,6 @@ fillin(DatagramIterator &scan, BamReader *manager) { manager->read_cdata(scan, _cycler); } -//////////////////////////////////////////////////////////////////// -// Function: qpGeomPrimitive::CacheEntry::evict_callback -// Access: Public, Virtual -// Description: Called when the entry is evicted from the cache, this -// should clean up the owning object appropriately. -//////////////////////////////////////////////////////////////////// -void qpGeomPrimitive::CacheEntry:: -evict_callback() { - // We have to operate on stage 0 of the pipeline, since that's where - // the cache really counts. Because of the multistage pipeline, we - // might not actually have a cache entry there (it might have been - // added to stage 1 instead). No big deal if we don't. - CData *cdata = _source->_cycler.write_stage(0); - if (cdata->_cache.p() == this) { - cdata->_cache = NULL; - } - _source->_cycler.release_write_stage(0, cdata); -} - -//////////////////////////////////////////////////////////////////// -// Function: qpGeomPrimitive::CacheEntry::get_result_size -// Access: Public, Virtual -// Description: Returns the approximate number of bytes represented -// by the computed result. -//////////////////////////////////////////////////////////////////// -int qpGeomPrimitive::CacheEntry:: -get_result_size() const { - return _decomposed->get_num_bytes(); -} - -//////////////////////////////////////////////////////////////////// -// Function: qpGeomPrimitive::CacheEntry::output -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -void qpGeomPrimitive::CacheEntry:: -output(ostream &out) const { - out << "primitive " << (void *)_source; -} - //////////////////////////////////////////////////////////////////// // Function: qpGeomPrimitive::CData::make_copy // Access: Public, Virtual diff --git a/panda/src/gobj/qpgeomPrimitive.h b/panda/src/gobj/qpgeomPrimitive.h index 68698807ba..128746a7d4 100644 --- a/panda/src/gobj/qpgeomPrimitive.h +++ b/panda/src/gobj/qpgeomPrimitive.h @@ -21,7 +21,6 @@ #include "pandabase.h" #include "qpgeomEnums.h" -#include "qpgeomCacheEntry.h" #include "typedWritableReferenceCount.h" #include "luse.h" #include "updateSeq.h" @@ -72,13 +71,14 @@ PUBLISHED: virtual PT(qpGeomPrimitive) make_copy() const=0; virtual PrimitiveType get_primitive_type() const=0; - - INLINE UsageHint get_usage_hint() const; - INLINE void set_usage_hint(UsageHint usage_hint); + virtual int get_geom_rendering() const; INLINE ShadeModel get_shade_model() const; INLINE void set_shade_model(ShadeModel shade_model); + INLINE UsageHint get_usage_hint() const; + INLINE void set_usage_hint(UsageHint usage_hint); + // The following published methods are provided for safe, high-level // iteration through the vertices and sub-primitives within the // GeomPrimitive class. These work correctly regardless of the @@ -109,6 +109,7 @@ PUBLISHED: INLINE int get_primitive_max_vertex(int n) const; CPT(qpGeomPrimitive) decompose() const; + CPT(qpGeomPrimitive) rotate() const; int get_num_bytes() const; INLINE int get_data_size_bytes() const; @@ -131,8 +132,6 @@ public: // instead. INLINE CPTA_ushort get_vertices() const; - INLINE CPTA_ushort get_flat_first_vertices() const; - INLINE CPTA_ushort get_flat_last_vertices() const; PTA_ushort modify_vertices(); void set_vertices(CPTA_ushort vertices); @@ -147,7 +146,6 @@ public: virtual int get_min_num_vertices_per_primitive() const; virtual int get_num_unused_vertices_per_primitive() const; - void clear_cache(); void prepare(PreparedGraphicsObjects *prepared_objects); public: @@ -172,9 +170,6 @@ protected: virtual CPTA_ushort rotate_impl() const; virtual void append_unused_vertices(PTA_ushort &vertices, int vertex); -protected: - static PStatCollector _rotate_pcollector; - private: // A GeomPrimitive keeps a list (actually, a map) of all the // PreparedGraphicsObjects tables that it has been prepared into. @@ -183,16 +178,6 @@ private: // itself from the other's list. typedef pmap Contexts; Contexts _contexts; - - class CacheEntry : public qpGeomCacheEntry { - public: - virtual void evict_callback(); - virtual int get_result_size() const; - virtual void output(ostream &out) const; - - qpGeomPrimitive *_source; - CPT(qpGeomPrimitive) _decomposed; - }; // This is the data that must be cycled between pipeline stages. class EXPCL_PANDA CData : public CycleData { @@ -206,7 +191,6 @@ private: UsageHint _usage_hint; ShadeModel _shade_model; PTA_ushort _vertices; - CPTA_ushort _rotated_vertices; PTA_int _ends; PTA_ushort _mins; PTA_ushort _maxs; @@ -215,17 +199,17 @@ private: bool _got_minmax; unsigned short _min_vertex; unsigned short _max_vertex; - - PT(CacheEntry) _cache; }; PipelineCycler _cycler; typedef CycleDataReader CDReader; typedef CycleDataWriter CDWriter; - CPTA_ushort do_rotate(CDReader &cdata); void recompute_minmax(CDWriter &cdata); + static PStatCollector _decompose_pcollector; + static PStatCollector _rotate_pcollector; + public: virtual void write_datagram(BamWriter *manager, Datagram &dg); diff --git a/panda/src/gobj/qpgeomTrifans.cxx b/panda/src/gobj/qpgeomTrifans.cxx index 028587ac20..ccf0dd86eb 100644 --- a/panda/src/gobj/qpgeomTrifans.cxx +++ b/panda/src/gobj/qpgeomTrifans.cxx @@ -78,6 +78,18 @@ get_primitive_type() const { return PT_polygons; } +//////////////////////////////////////////////////////////////////// +// Function: qpGeomTrifans::get_geom_rendering +// Access: Published, Virtual +// Description: Returns the set of GeomRendering bits that represent +// the rendering properties required to properly render +// this primitive. +//////////////////////////////////////////////////////////////////// +int qpGeomTrifans:: +get_geom_rendering() const { + return GR_triangle_fan; +} + //////////////////////////////////////////////////////////////////// // Function: qpGeomTrifans::draw // Access: Public, Virtual @@ -147,8 +159,8 @@ CPTA_ushort qpGeomTrifans:: rotate_impl() const { // Actually, we can't rotate fans without chaging the winding order. // It's an error to define a flat shade model for a GeomTrifan. - nassertr(false, get_vertices()); - return get_vertices(); + nassertr(false, CPTA_ushort()); + return CPTA_ushort(); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/gobj/qpgeomTrifans.h b/panda/src/gobj/qpgeomTrifans.h index 265266e02f..00b0f89f09 100644 --- a/panda/src/gobj/qpgeomTrifans.h +++ b/panda/src/gobj/qpgeomTrifans.h @@ -37,6 +37,7 @@ PUBLISHED: public: virtual PT(qpGeomPrimitive) make_copy() const; virtual PrimitiveType get_primitive_type() const; + virtual int get_geom_rendering() const; public: virtual void draw(GraphicsStateGuardianBase *gsg) const; diff --git a/panda/src/gobj/qpgeomTristrips.cxx b/panda/src/gobj/qpgeomTristrips.cxx index 4d4f6b35e5..733d78bf64 100644 --- a/panda/src/gobj/qpgeomTristrips.cxx +++ b/panda/src/gobj/qpgeomTristrips.cxx @@ -79,6 +79,18 @@ get_primitive_type() const { return PT_polygons; } +//////////////////////////////////////////////////////////////////// +// Function: qpGeomTristrips::get_geom_rendering +// Access: Published, Virtual +// Description: Returns the set of GeomRendering bits that represent +// the rendering properties required to properly render +// this primitive. +//////////////////////////////////////////////////////////////////// +int qpGeomTristrips:: +get_geom_rendering() const { + return GR_triangle_strip; +} + //////////////////////////////////////////////////////////////////// // Function: qpGeomTristrips::get_num_unused_vertices_per_primitive // Access: Public, Virtual @@ -256,7 +268,7 @@ rotate_impl() const { // If this assertion is triggered, there was a triangle strip with // an odd number of vertices and either SM_flat_first_vertex or // SM_flat_last_vertex specified--which is not allowed. - nassertr(!any_odd, new_vertices); + nassertr(!any_odd, CPTA_ushort()); return new_vertices; } diff --git a/panda/src/gobj/qpgeomTristrips.h b/panda/src/gobj/qpgeomTristrips.h index 64f5440151..080cb43065 100644 --- a/panda/src/gobj/qpgeomTristrips.h +++ b/panda/src/gobj/qpgeomTristrips.h @@ -37,6 +37,7 @@ PUBLISHED: public: virtual PT(qpGeomPrimitive) make_copy() const; virtual PrimitiveType get_primitive_type() const; + virtual int get_geom_rendering() const; virtual int get_num_unused_vertices_per_primitive() const; public: diff --git a/panda/src/gobj/qpgeomVertexData.cxx b/panda/src/gobj/qpgeomVertexData.cxx index b81d53c7d9..74ef0e9da0 100644 --- a/panda/src/gobj/qpgeomVertexData.cxx +++ b/panda/src/gobj/qpgeomVertexData.cxx @@ -230,7 +230,6 @@ void qpGeomVertexData:: set_array(int i, const qpGeomVertexArrayData *array) { CDWriter cdata(_cycler); nassertv(i >= 0 && i < (int)cdata->_arrays.size()); - nassertv(array->get_array_format() == cdata->_arrays[i]->get_array_format()); cdata->_arrays[i] = (qpGeomVertexArrayData *)array; cdata->_modified = qpGeom::get_next_modified(); cdata->_animated_vertices_modified = UpdateSeq(); diff --git a/panda/src/gsgbase/graphicsStateGuardianBase.h b/panda/src/gsgbase/graphicsStateGuardianBase.h index 0d7df9425f..eae87eff3e 100644 --- a/panda/src/gsgbase/graphicsStateGuardianBase.h +++ b/panda/src/gsgbase/graphicsStateGuardianBase.h @@ -120,7 +120,7 @@ class Lens; class EXPCL_PANDA GraphicsStateGuardianBase : public TypedWritableReferenceCount { public: virtual bool get_supports_multisample() const=0; - virtual int get_supported_point_rendering() const=0; + virtual int get_supported_geom_rendering() const=0; // These functions will be queried by the GeomIssuer to determine if // it should issue normals, texcoords, and/or colors, based on the diff --git a/panda/src/pgraph/cullableObject.cxx b/panda/src/pgraph/cullableObject.cxx index f3d4e45d8a..29d59f579c 100644 --- a/panda/src/pgraph/cullableObject.cxx +++ b/panda/src/pgraph/cullableObject.cxx @@ -51,10 +51,10 @@ munge_geom(GraphicsStateGuardianBase *gsg, CPT(qpGeom) qpgeom = DCAST(qpGeom, _geom); _munged_data = qpgeom->get_vertex_data(); - int point_rendering = _state->get_point_rendering(qpgeom->get_point_rendering()); + int geom_rendering = _state->get_geom_rendering(qpgeom->get_geom_rendering()); GraphicsStateGuardianBase *gsg = traverser->get_gsg(); - if ((point_rendering & ~gsg->get_supported_point_rendering()) != 0) { + if ((geom_rendering & ~gsg->get_supported_geom_rendering() & qpGeom::GR_point_bits) != 0) { // The GSG doesn't support rendering these fancy points // directly; we have to render them in software instead. // Munge them into quads. This will replace the _geom and diff --git a/panda/src/pgraph/renderModeAttrib.I b/panda/src/pgraph/renderModeAttrib.I index ec1ef464cc..988395cfca 100644 --- a/panda/src/pgraph/renderModeAttrib.I +++ b/panda/src/pgraph/renderModeAttrib.I @@ -73,25 +73,25 @@ get_perspective() const { } //////////////////////////////////////////////////////////////////// -// Function: RenderModeAttrib::get_point_rendering +// Function: RenderModeAttrib::get_geom_rendering // Access: Published -// Description: Returns the union of the Geom::PointRendering bits +// Description: Returns the union of the Geom::GeomRendering bits // that will be required once this RenderModeAttrib is // applied to a geom which includes the indicated -// geom_point_rendering bits. +// geom_rendering bits. //////////////////////////////////////////////////////////////////// INLINE int RenderModeAttrib:: -get_point_rendering(int geom_point_rendering) const { +get_geom_rendering(int geom_rendering) const { if (_mode == M_point) { - geom_point_rendering |= qpGeom::PR_point; + geom_rendering |= qpGeom::GR_point; } - if ((geom_point_rendering & qpGeom::PR_point) != 0) { + if ((geom_rendering & qpGeom::GR_point) != 0) { if (_perspective) { - geom_point_rendering |= (qpGeom::PR_perspective | qpGeom::PR_uniform_size); + geom_rendering |= (qpGeom::GR_point_perspective | qpGeom::GR_point_uniform_size); } else if (_thickness != 1.0f) { - geom_point_rendering |= qpGeom::PR_uniform_size; + geom_rendering |= qpGeom::GR_point_uniform_size; } } - return geom_point_rendering; + return geom_rendering; } diff --git a/panda/src/pgraph/renderModeAttrib.h b/panda/src/pgraph/renderModeAttrib.h index a27b146646..e22d7db97b 100644 --- a/panda/src/pgraph/renderModeAttrib.h +++ b/panda/src/pgraph/renderModeAttrib.h @@ -50,7 +50,7 @@ PUBLISHED: INLINE float get_thickness() const; INLINE bool get_perspective() const; - INLINE int get_point_rendering(int geom_point_rendering) const; + INLINE int get_geom_rendering(int geom_rendering) const; public: virtual void issue(GraphicsStateGuardianBase *gsg) const; diff --git a/panda/src/pgraph/renderState.I b/panda/src/pgraph/renderState.I index ae282626fd..fe5bdfe6e2 100644 --- a/panda/src/pgraph/renderState.I +++ b/panda/src/pgraph/renderState.I @@ -250,23 +250,23 @@ get_render_mode() const { } //////////////////////////////////////////////////////////////////// -// Function: RenderState::get_point_rendering +// Function: RenderState::get_geom_rendering // Access: Published -// Description: Returns the union of the Geom::PointRendering bits +// Description: Returns the union of the Geom::GeomRendering bits // that will be required once this RenderState is // applied to a geom which includes the indicated -// geom_point_rendering bits. +// geom_rendering bits. //////////////////////////////////////////////////////////////////// INLINE int RenderState:: -get_point_rendering(int geom_point_rendering) const { +get_geom_rendering(int geom_rendering) const { if (get_render_mode() != (const RenderModeAttrib *)NULL) { - geom_point_rendering = _render_mode->get_point_rendering(geom_point_rendering); + geom_rendering = _render_mode->get_geom_rendering(geom_rendering); } if (get_tex_gen() != (const TexGenAttrib *)NULL) { - geom_point_rendering = _tex_gen->get_point_rendering(geom_point_rendering); + geom_rendering = _tex_gen->get_geom_rendering(geom_rendering); } - return geom_point_rendering; + return geom_rendering; } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/pgraph/renderState.h b/panda/src/pgraph/renderState.h index 08851ace9d..83cec1b842 100644 --- a/panda/src/pgraph/renderState.h +++ b/panda/src/pgraph/renderState.h @@ -127,7 +127,7 @@ PUBLISHED: INLINE const TexGenAttrib *get_tex_gen() const; INLINE const RenderModeAttrib *get_render_mode() const; - INLINE int get_point_rendering(int geom_point_rendering) const; + INLINE int get_geom_rendering(int geom_rendering) const; public: CPT(RenderState) issue_delta_modify(const RenderState *other, diff --git a/panda/src/pgraph/texGenAttrib.I b/panda/src/pgraph/texGenAttrib.I index f8d24d2a73..0e526c6bfa 100755 --- a/panda/src/pgraph/texGenAttrib.I +++ b/panda/src/pgraph/texGenAttrib.I @@ -44,22 +44,22 @@ TexGenAttrib(const TexGenAttrib ©) : } //////////////////////////////////////////////////////////////////// -// Function: TexGenAttrib::get_point_rendering +// Function: TexGenAttrib::get_geom_rendering // Access: Published -// Description: Returns the union of the Geom::PointRendering bits +// Description: Returns the union of the Geom::GeomRendering bits // that will be required once this TexGenAttrib is // applied to a geom which includes the indicated -// geom_point_rendering bits. +// geom_rendering bits. //////////////////////////////////////////////////////////////////// INLINE int TexGenAttrib:: -get_point_rendering(int geom_point_rendering) const { - if ((geom_point_rendering & qpGeom::PR_point) != 0) { +get_geom_rendering(int geom_rendering) const { + if ((geom_rendering & qpGeom::GR_point) != 0) { if (_num_point_sprites > 0) { - return geom_point_rendering |= qpGeom::PR_sprite; + return geom_rendering |= qpGeom::GR_point_sprite; } } - return geom_point_rendering; + return geom_rendering; } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/pgraph/texGenAttrib.h b/panda/src/pgraph/texGenAttrib.h index c8d92f835d..15d4d94afd 100755 --- a/panda/src/pgraph/texGenAttrib.h +++ b/panda/src/pgraph/texGenAttrib.h @@ -104,7 +104,7 @@ PUBLISHED: bool has_stage(TextureStage *stage) const; Mode get_mode(TextureStage *stage) const; - INLINE int get_point_rendering(int geom_point_rendering) const; + INLINE int get_geom_rendering(int geom_rendering) const; public: INLINE const Geom::NoTexCoordStages &get_no_texcoords() const; diff --git a/panda/src/pstatclient/pStatProperties.cxx b/panda/src/pstatclient/pStatProperties.cxx index 056fe64487..700a1ac56f 100644 --- a/panda/src/pstatclient/pStatProperties.cxx +++ b/panda/src/pstatclient/pStatProperties.cxx @@ -129,6 +129,8 @@ static TimeCollectorProperties time_properties[] = { { 1, "Cull:Munge", { 0.3, 0.3, 0.9 } }, { 1, "Cull:Munge:Points", { 0.2, 0.8, 0.4 } }, { 1, "Cull:Munge:Data", { 0.7, 0.5, 0.2 } }, + { 1, "Cull:Munge:Rotate", { 0.9, 0.8, 0.5 } }, + { 1, "Cull:Munge:Decompose", { 0.1, 0.3, 0.1 } }, { 1, "Draw", { 1.0, 0.0, 0.0 }, 1.0 / 30.0 }, { 1, "Draw:Make current", { 0.4, 0.2, 0.6 } }, { 1, "Draw:Copy texture", { 0.2, 0.6, 0.4 } }, @@ -140,7 +142,6 @@ static TimeCollectorProperties time_properties[] = { { 1, "Draw:Flip:End", { 0.9, 0.3, 0.6 } }, { 1, "Draw:Bins", { 0.3, 0.6, 0.0 } }, { 0, "Draw:Primitive", { 0.0, 0.0, 0.5 } }, - { 1, "Draw:Rotate", { 0.9, 0.8, 0.5 } }, { 0, NULL } };