A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/glbuffer_8hpp_source.html below:

NCBI C++ ToolKit: include/gui/opengl/glbuffer.hpp Source File

1 #ifndef GUI_OPENGL___GL_BUFFER__HPP 2 #define GUI_OPENGL___GL_BUFFER__HPP 102 template

<

typename

T>

167 template

<

typename

T>

218

: m_TargetBuffer(target)

221

, m_BufferData(

NULL

)

240 template

<

typename

T>

333 template

<

typename

T>

396

, m_GlBufferId(GL_ZERO)

404  if

(glIsBuffer(m_GlBufferId)) {

405

glDeleteBuffers(1, &m_GlBufferId);

408  if

(this->m_BufferData !=

NULL

) {

413

this->m_BufferSize = 0;

414

this->m_ActiveSize = 0;

421  if

(this->m_BufferData !=

NULL

)

422  LOG_POST

(

Warning

<<

"Warning - reallocating buffer while buffer is mapped."

);

426  if

(m_GlBufferId == 0)

427

glGenBuffers(1, &m_GlBufferId);

431

glBindBuffer(this->m_TargetBuffer, m_GlBufferId);

432

glBufferData(this->m_TargetBuffer,

size

*

sizeof

(

T

),

data

,

usage

);

433

glBindBuffer(this->m_TargetBuffer, 0);

435

this->m_BufferSize =

size

;

436

this->m_ActiveSize = this->m_BufferSize;

443  if

(this->m_BufferSize == 0) {

444  LOG_POST

(

Error

<<

"Error - attempt to map openGL buffer prior to buffer creation"

);

448  if

(this->m_BufferData !=

NULL

) {

449  LOG_POST

(

Warning

<<

"Warning - attempt to map openGL buffer that is already mapped"

);

450  return

this->m_BufferData;

453

glBindBuffer(this->m_TargetBuffer, m_GlBufferId);

454

this->m_BufferData = (

T

*)glMapBuffer(this->m_TargetBuffer, access);

455

glBindBuffer(this->m_TargetBuffer, 0);

458  return

this->m_BufferData;

464

glBindBuffer(this->m_TargetBuffer, m_GlBufferId);

465  bool b

= glUnmapBuffer(this->m_TargetBuffer);

467

this->m_BufferData =

NULL

;

473

BufferData(this->m_BufferSize,

NULL

, m_Usage);

476

glBindBuffer(this->m_TargetBuffer, 0);

484  _ASSERT

(idx < this->m_BufferSize);

485  return

*(this->m_BufferData + idx);

491  if

(this->m_ActiveSize == 0)

499  if

(this->m_BufferData ==

NULL

) {

500

MapBuffer(GL_READ_ONLY);

502  for

(GLsizei

i

=0;

i

< this->m_ActiveSize; ++

i

)

503  data

.push_back((*

this

)[

i

]);

508  for

(GLsizei

i

=0;

i

< this->m_ActiveSize; ++

i

)

509  data

.push_back((*

this

)[

i

]);

516

glBindBuffer(this->m_TargetBuffer, m_GlBufferId);

522

glBindBuffer(this->m_TargetBuffer, 0);

534 template

<

typename

T>

598

this->m_BufferSize = 0;

599

this->m_ActiveSize = 0;

600

this->m_BufferData =

NULL

;

606  if

(this->m_BufferData !=

NULL

)

607  LOG_POST

(

Warning

<<

"Warning - re-allocating buffer while buffer is mapped."

);

612

m_Buffer.resize(

size

);

614  T

* buf_data = &m_Buffer[0];

615

memcpy(buf_data,

data

,

size

*

sizeof

(

T

));

618

this->m_BufferSize =

size

;

619

this->m_ActiveSize = this->m_BufferSize;

625  if

(this->m_BufferSize == 0) {

626  LOG_POST

(

Error

<<

"Error - attempt to map OpenGL buffer prior to buffer creation"

);

630  if

(this->m_BufferData !=

NULL

) {

631  LOG_POST

(

Warning

<<

"Warning - attempt to map openGL buffer that is already mapped"

);

632  return

this->m_BufferData;

635

this->m_BufferData = &m_Buffer[0];

637  return

this->m_BufferData;

643  _ASSERT

(idx < this->m_BufferSize);

644  return

m_Buffer[idx];

650  if

(this->m_ActiveSize == (GLsizei)m_Buffer.size()) {

656  if

(this->m_ActiveSize > 0) {

657  data

.insert(

data

.begin(), m_Buffer.begin(), m_Buffer.begin()+this->m_ActiveSize);

CGlBuffer11 Implement abstract buffer interface using simple STL array.

CGlBuffer20 Implement the abstract buffer interface based on OpenGL vertex buffer objects.

CGlBuffer Concrete buffers (to store vertices, vertex attributes, or indices to vertex buffers) are d...

CGlObject Base class for OpenGl objects like buffers and models.

CGlRenderBuffer This is a thin wrapper for buffer objects derived from CGlBuffer.

IGlBuffer This class provides and abstract interface for an OpenGL buffer.

#define LOG_POST(message)

This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...

void Error(CExceptionArgs_Base &args)

void Warning(CExceptionArgs_Base &args)

GLsizei GetActiveBufferSize() const

Return number of elements currently in use (for rendering)

CGlBuffer20< T > & operator=(const CGlBuffer20< T > &)

void GetData(vector< T > &data)

Return a copy of the buffer (0..m_ActiveSize).

GLsizei GetSize() const

Get allocated buffer size (# of elements T)

bool IsMapped() const

Return true if buffer is currently mapped.

TBufferType * m_BufferData

Pointer to buffer data in memeory when buffer is mapped into memory via MapBuffer,...

bool m_DrawEnabled

Flag to allow renderers to 'turn off' a buffer during a rendering pass.

virtual void Destroy()=0

Do any needed buffer clean-up.

virtual bool IsMapped() const =0

Return true if buffer is currently mapped.

virtual void BindBuffer()=0

Bind buffer - glBindBuffer(target,id) for non-array implementations.

CRef< CGlBuffer< T > > m_Buffer

Underlying concreate implementation buffer.

bool UnmapBuffer()

Unmap buffer data in memory.

virtual GLsizei GetActiveBufferSize() const =0

Return number of elements currently in use (for rendering)

void BufferData(GLsizei num_elements, const T *data, GLenum usage)

Create and, optionally, initialize the buffer.

CGlRenderBuffer(CGlBuffer< T > *buf)

Ctor that sets buffer.

virtual T * GetMappedPtr()=0

Return pointer to buffer if currently mapped, or NULL otherwise.

std::vector< T > m_Buffer

The underlying array.

virtual ~CGlRenderBuffer()

buffer is held as cref so not deleted

T & operator[](GLsizei idx)

Access an entry in the buffer ONLY if it is mapped (if IsMapped()==true)

CGlRenderBuffer(CRef< CGlBuffer< T > > buf)

Ctor that sets buffer.

GLsizei GetActiveBufferSize() const

Get number of elements to be drawn.

T * GetMappedPtr()

Return pointer to buffer if currently mapped, or NULL otherwise.

virtual void BufferData(GLsizei num_elements, const T *data, GLenum usage)=0

Create and, optionally, initialize the buffer.

void BufferData(GLsizei num_elements, const T *data, GLenum usage)

Create and, optionally, initialize the buffer.

bool UnmapBuffer()

Unmap buffer data in memory.

T * MapBuffer(GLenum access)

Map the data into memory for direct (c++ pointer) access.

void Destroy()

Methods forwarded to underlying implementation buffer.

void ReleaseBuffer()

Release buffer - glBindBuffer(target, 0)

CGlBuffer20(const CGlBuffer20< T > &)

GLsizei GetSize() const

Get allocated buffer size (size in use for rendering may be less)

CRef< CGlBuffer< T > > & GetBuffer()

virtual void Destroy()

Delete buffer data. May be re-created via BufferData()

T * MapBuffer(GLenum access)

Return a pointer to the beginning of the buffer to allow direct memory reads/writes.

GLuint m_GlBufferId

OpenGL id for the buffer.

void SetOffset(GLsizei offset)

Set/get the initial byte offset (index of first element to render)

CGlRenderBuffer()

Ctor - can't be used until m_Buffer is set.

void SetDrawEnabled(bool b)

If true, rendering will use this buffer if it is the correct size.

virtual void Destroy()

Delete/clear buffer data.

void BindBuffer()

Bind buffer - glBindBuffer(target, id)

GLsizei m_ActiveSize

Number of elements to use when drawing (m_BufferSize may be larger)

static bool CheckGlError()

Check if there are any OpenGL errors.

virtual GLsizei GetSize() const =0

Get allocated buffer size (size in use for rendering may be less)

T & operator[](GLsizei idx)

Return entry in the buffer ONLY if it is mapped (if IsMapped()==true)

virtual bool UnmapBuffer()=0

Unmap data (pointer may returned by MapBuffer becomes invalid).

virtual T * MapBuffer(GLenum access)=0

Return a pointer to the beginning of the buffer to allow direct memory reads/writes.

CGlBuffer20(GLenum target)

Sets buffer type but does not allocate buffer yet.

virtual ~CGlBuffer11()

destroy buffer

GLsizei GetStride() const

bool GetDrawEnabled() const

CGlBuffer11(GLenum target)

Sets buffer type but does not allocate buffer yet.

void GetData(vector< T > &data)

Return a copy of the buffer (0..m_ActiveSize) - maps/unmaps if needed If buffer already mapped,...

GLenum m_Usage

OpenGL usage (one of): GL_{STATIC, DYNAMIC, STREAM}_{READ, COPY, DRAW}.

GLsizei GetOffset() const

virtual ~CGlBuffer20()

destroy buffer

GLenum m_TargetBuffer

GL_ARRAY_BUFFER (for vertex attributes) or: GL_ELEMENT_ARRAY_BUFFER (for array indices)

T & operator[](GLsizei idx)

Access an entry in the buffer ONLY if it is mapped (if IsMapped()==true)

void SetStride(GLsizei s)

Set/get the stride (number of bytes to skip between elements) A stride of 0 assumes elements are tigh...

GLsizei m_Offset

Number of bytes from the front of the buffer to the first element.

void GetData(vector< T > &data)

Return a copy of the buffer (0..m_ActiveSize) - maps/unmaps if needed If buffer already mapped,...

virtual void GetData(vector< T > &data)=0

Return a copy of the buffer (0..m_ActiveSize).

bool UnmapBuffer()

Unmap data (pointer may returned by MapBuffer becomes invalid).

GLsizei m_Stride

Number of bytes between elements to render (tightly packed=>0)

T * GetMappedPtr()

Get pointer to mapped buffer (NULL if buffer not currently mapped)

T * MapBuffer(GLenum access)

Map the data into memory for direct (c++ pointer) access.

CGlBuffer(GLenum target)

Sets buffer type but does not allocate buffer yet.

void BufferData(GLsizei num_elements, const T *data, GLenum usage)

Create and, optionally, initialize the buffer.

GLsizei m_BufferSize

Number of elements of type "T" that can fit in buffer.

void ReleaseBuffer()

Release buffer - glBindBuffer(target,0) for non-array implementations.

bool IsMapped() const

Returns true if buffer data has been mapped.

void BindBuffer()

Bind buffer - glBindBuffer(target,id) for non-array implementations.

void SetBuffer(CGlBuffer< T > *buf)

Methods specific to this class (not forwarded to underlying buffer)

virtual void ReleaseBuffer()

Release buffer - subclass to implement if needed (2.0 only)

CGlBuffer11< T > & operator=(const CGlBuffer11< T > &)

virtual void BindBuffer()

Bind buffer - subclass to implement if needed (2.0 only)

CGlBuffer11(const CGlBuffer11< T > &)

virtual T & operator[](GLsizei idx)=0

Return entry in the buffer ONLY if it is mapped (if IsMapped()==true)

virtual void ReleaseBuffer()=0

Release buffer - glBindBuffer(target,0) for non-array implementations.

void Reset(void)

Reset reference object.

#define END_NCBI_SCOPE

End previously defined NCBI scope.

#define BEGIN_NCBI_SCOPE

Define ncbi namespace.

const struct ncbi::grid::netcache::search::fields::SIZE size

Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.

Standard mechanism to include OpenGL headers for all platforms.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4