This file is indexed.

/usr/include/Nux-4.0/NuxGraphics/GLPBuffer.h is in libnux-4.0-dev 4.0.8+16.04.20160209-0ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/*
 * Copyright 2010 Inalogic® Inc.
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License, as
 * published by the  Free Software Foundation; either version 2.1 or 3.0
 * of the License.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranties of
 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
 * PURPOSE.  See the applicable version of the GNU Lesser General Public
 * License for more details.
 *
 * You should have received a copy of both the GNU Lesser General Public
 * License along with this program. If not, see <http://www.gnu.org/licenses/>
 *
 * Authored by: Jay Taoko <jaytaoko@inalogic.com>
 *
 */


#ifndef __PBUFFERS_H__
#define __PBUFFERS_H__

#ifndef NUX_OPENGLES_20

#if defined(WIN32)
#include "GLResource.h"

#  pragma warning (disable : 4786)
#elif defined(UNIX)
#  include <GL/glx.h>
#  include <GL/glxext.h>
#elif defined(__APPLE__)
#  include <AGL/agl.h>
#endif

#include <string>
#include <vector>

// The pixel format for the pbuffer is controlled by the mode string passed
// into the PBuffer constructor. This string can have the following attributes:
//
// r			- r pixel format (for float buffer).
// rg			- rg pixel format (for float buffer).
// rgb          - rgb pixel format. 8 bit or 16/32 bit in float buffer mode
// rgba         - same as "rgb alpha" string
// alpha        - must have alpha channel
// depth        - must have a depth buffer
// depth=n      - must have n-bit depth buffer
// stencil      - must have a stencil buffer
// double       - must support double buffered rendering
// samples=n    - must support n-sample antialiasing (n can be 2 or 4)
// float=n      - must support n-bit per channel floating point
//
// texture2D
// textureRECT
// textureCUBE  - must support binding pbuffer as texture to specified target
//              - binding the depth buffer is also supporting by specifying
//                '=depth' like so: texture2D=depth or textureRECT=depth
//              - the internal format of the texture will be rgba by default or
//                float if pbuffer is floating point
//

namespace nux
{

  class PBuffer
  {
  public:
    // see above for documentation on strMode format
    // set managed to true if you want the class to cleanup OpenGL objects in destructor
    PBuffer (const char *strMode, bool managed = false);
    ~PBuffer();

    bool Initialize (int iWidth, int iHeight, bool bShareContexts, bool bShareObjects);
    void Destroy();

    void Activate (PBuffer *current = NULL); // to switch between pbuffers, pass active pbuffer as argument
    void Deactivate();

#if defined(WIN32)
    int Bind (int iBuffer);
    int Release (int iBuffer);

    void HandleModeSwitch();
#endif

    unsigned int GetSizeInBytes();
    unsigned int CopyToBuffer (void *ptr, int w = -1, int h = -1);

    inline int GetNumComponents()
    {
      return m_iNComponents;
    }

    inline int GetBitsPerComponent()
    {
      return m_iBitsPerComponent;
    }

    inline int GetWidth()
    {
      return m_iWidth;
    }

    inline int GetHeight()
    {
      return m_iHeight;
    }

    inline bool IsSharedContext()
    {
      return m_bSharedContext;
    }

#if defined(WIN32)
    inline bool IsTexture()
    {
      return m_bIsTexture;
    }
#endif

  protected:
#if defined(NUX_OS_WINDOWS)
    HDC         m_hDC;     ///< Handle to a device context.
    HGLRC       m_hGLRC;   ///< Handle to a GL context.
    HPBUFFERARB m_hPBuffer;///< Handle to a pbuffer.

    HGLRC       m_hOldGLRC;
    HDC         m_hOldDC;

    std::vector<int> m_pfAttribList;
    std::vector<int> m_pbAttribList;

    bool m_bIsTexture;
#elif defined(NUX_OS_LINUX)
    Display    *m_pDisplay;
    GLXPbuffer  m_glxPbuffer;
    GLXContext  m_glxContext;

    Display    *m_pOldDisplay;
    GLXPbuffer  m_glxOldDrawable;
    GLXContext  m_glxOldContext;

    std::vector<int> m_pfAttribList;
    std::vector<int> m_pbAttribList;
#elif defined(NUX_OS_MACOSX)
    AGLContext  m_context;
    WindowPtr   m_window;
    std::vector<int> m_pfAttribList;
#endif

    int m_iWidth;
    int m_iHeight;
    int m_iNComponents;
    int m_iBitsPerComponent;

    const char *m_strMode;
    bool m_bSharedContext;
    bool m_bShareObjects;

  private:
    std::string getStringValue (std::string token);
    int getIntegerValue (std::string token);
#if defined(NUX_OS_WINDOWS) || defined(NUX_OS_LINUX)
    void parseModeString (const char *modeString, std::vector<int> *pfAttribList, std::vector<int> *pbAttribList);

    bool m_bIsActive;
    bool m_bManaged;
#endif
  };
}

#endif // NUX_OPENGLES_20

#endif // __PBUFFERS_H__