source: trunk/vizservers/nanovis/RenderContext.h @ 838

Last change on this file since 838 was 838, checked in by vrinside, 17 years ago

Put rendering modes such as toggling wireframe, toggling culling mode. For this, RenderContext? class is added

File size: 1.7 KB
Line 
1#ifndef __RENDER_CONTEXT_H__
2#define __RENDER_CONTEXT_H__
3
4#include <GL/gl.h>
5
6namespace graphics {
7
8class RenderContext {
9public :
10    enum ShadingModel {
11        FLAT = GL_FLAT ,   //!< Flat Shading
12        SMOOTH = GL_SMOOTH, //!< Smooth shading (Goraud shading model)
13    };
14
15    enum PolygonMode {
16        LINE = GL_LINE,
17        FILL = GL_FILL,
18    };
19
20    enum CullMode {
21        NO_CULL,    //!< No culling
22        BACK= GL_BACK,  //!< Back face culling
23        FRONT= GL_FRONT, //!< Front face culling
24    };
25
26private :
27    CullMode _cullMode;
28    PolygonMode _fillMode;
29    ShadingModel _shadingModel;
30   
31public :
32    /**
33     *@brief constructor
34     */
35    RenderContext();
36
37    /**
38     *@brief Destructor
39     */
40    ~RenderContext();
41
42public :
43    /**
44     *@brief Set the shading model such as flat, smooth
45     */
46    void setShadingModel(const ShadingModel shadeModel);
47    ShadingModel getShadingModel() const;
48
49    void setCullMode(const CullMode cullMode);
50    CullMode getCullMode() const;
51
52    void setPolygonMode(const PolygonMode fillMode);
53    PolygonMode getPolygonMode() const;
54
55};
56
57inline void RenderContext::setShadingModel(const RenderContext::ShadingModel shadeModel)
58{
59    _shadingModel = shadeModel;
60}
61
62inline RenderContext::ShadingModel RenderContext::getShadingModel() const
63{
64    return _shadingModel;
65}
66
67inline void RenderContext::setCullMode(const RenderContext::CullMode cullMode)
68{
69    _cullMode = cullMode;
70}
71
72inline RenderContext::CullMode RenderContext::getCullMode() const
73{
74    return _cullMode;
75}
76
77inline void RenderContext::setPolygonMode(const RenderContext::PolygonMode fillMode)
78{
79    _fillMode = fillMode;
80}
81
82inline RenderContext::PolygonMode RenderContext::getPolygonMode() const
83{
84    return _fillMode;
85}
86
87};
88
89#endif //
Note: See TracBrowser for help on using the repository browser.