X3D libraries
The libraries to work with X3D dataset

opengl_internal.h

Go to the documentation of this file.
00001 /*
00002  *    libx3d render -- internal OpenGL header file
00003  *    Copyright (C) 2005  Made to Order Software, Corp.
00004  *
00005  *    This library is free software; you can redistribute it and/or
00006  *    modify it under the terms of the GNU Lesser General Public
00007  *    License as published by the Free Software Foundation; either
00008  *    version 2.1 of the License, or (at your option) any later version.
00009  *
00010  *    This library is distributed in the hope that it will be useful,
00011  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  *    Lesser General Public License for more details.
00014  *
00015  *    You should have received a copy of the GNU Lesser General Public
00016  *    License along with this library; if not, write to the Free Software
00017  *    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018  *
00019  * File: render/src/opengl_internal.h
00020  * License: GNU Lesser General Public License
00022  * $Revision: 1.6 $
00023  * $Date: 2005/12/19 01:41:44 $
00024  *
00025  * $Log: opengl_internal.h,v $
00026  * Revision 1.6  2005/12/19 01:41:44  alexis
00027  * Properly separated the level 1 and 2 of 2D geometry
00028  *
00029  * Revision 1.5  2005/12/19 01:38:20  alexis
00030  * Added all the 2D geometry shape support
00031  *
00032  * Revision 1.4  2005/12/18 10:43:31  alexis
00033  * This version includes the Sphere and some fixes to the other shapes (some
00034  * would use the wrong direction, I added some front face CW.)
00035  *
00036  * Revision 1.3  2005/12/17 09:20:45  alexis
00037  * Got the Box, Cone, Cylinder to work very nicely!
00038  *
00039  * Revision 1.2  2005/12/11 09:17:23  alexis
00040  * First working version. This can be used to render a Box.
00041  * Supports the Viewpoint and Materials in an Appearance node.
00042  *
00043  * Revision 1.1  2005/12/07 21:23:14  alexis
00044  * Added header and .c++ files to support OpenGL
00045  *
00046  *
00047  *
00048  */
00049 #ifndef __LIBX3D_OPENGL_INTERNAL_H__
00050 #define __LIBX3D_OPENGL_INTERNAL_H__
00051 
00052 
00053 
00054 #include        <x3d/opengl.h>
00055 #include        <GL/gl.h>
00056 #include        <GL/glu.h>
00057 
00058 
00059 
00060 namespace x3dgl
00061 {
00062 
00063 
00064 
00065 
00066 
00067 class OpenGLShape : public x3drender::RenderShape
00068 {
00069 public:
00070                                 OpenGLShape(x3drender::RenderState *render_state, OpenGLProcessor *gl_processor);
00071         virtual                 ~OpenGLShape();
00072 
00073         bool                    Prepare();
00074 
00075 // RenderShape interface
00076         virtual void            RenderProcessorSetup();
00077 
00078 // SFNodeListener interface
00079         virtual void            SFNodeListener_FieldChanged(x3d::SFNode *node, const x3d::FieldInfo *info);
00080 
00081 private:
00082         // texture, materials, etc.
00083         bool                    PrepareAppearance(x3d::Appearance *appearance, bool& invisible);
00084         bool                    PrepareMaterials(x3d::Material *material, bool& invisible);
00085         bool                    PrepareFillProperties(x3d::FillProperties *fill_properties);
00086         void                    UnprepareAppearance(x3d::Appearance *appearance);
00087 
00088         // 3D level 1
00089         bool                    PrepareBox(x3d::Box *box);
00090         bool                    PrepareCone(x3d::Cone *cone);
00091         bool                    PrepareCylinder(x3d::Cylinder *cylinder);
00092         bool                    PrepareSphere(x3d::Sphere *sphere);
00093 
00094         // 2D level 1
00095         bool                    PreparePolyline2D(x3d::Polyline2D *polyline_2d);
00096         bool                    PreparePolypoint2D(x3d::Polypoint2D *polypoint_2d);
00097         bool                    PrepareRectangle2D(x3d::Rectangle2D *rectangle_2d);
00098         bool                    PrepareTriangleSet2D(x3d::TriangleSet2D *triangle_set_2d);
00099 
00100         // 2D level 2
00101         bool                    Prepare2DArc(float start_angle, float end_angle, float radius, int closure_type);
00102         bool                    PrepareArc2D(x3d::Arc2D *arc_2d);
00103         bool                    PrepareArcClose2D(x3d::ArcClose2D *arc_close_2d);
00104         bool                    PrepareCircle2D(x3d::Circle2D *circle_2d);
00105         bool                    PrepareDisk2D(x3d::Disk2D *disk_2d);
00106 
00107         OpenGLProcessor *       f_gl_processor;
00108         bool                    f_dirty;
00109         bool                    f_texture;
00110         bool                    f_filled;
00111         unsigned int            f_gllist;
00112 };
00113 
00114 
00115 
00116 
00117 
00118 };              // namespace x3dgl
00119 
00120 
00121 
00122 // vim: ts=8
00123 #endif          // #ifndef __LIBX3D_OPENGL_H__

00021 * $Id: opengl_internal.h,v 1.6 2005/12/19 01:41:44 alexis Exp $