Last change
on this file since 299 was
299,
checked in by epyon, 11 years ago
|
- all bind and update function for graphics objects are done via context (will simplify directx device, and allow for handles instead of objects)
|
File size:
948 bytes
|
Rev | Line | |
---|
[42] | 1 | // Copyright (C) 2012-2013 Kornel Kisielewicz
|
---|
| 2 | // This file is part of NV Libraries.
|
---|
| 3 | // For conditions of distribution and use, see copyright notice in nv.hh
|
---|
| 4 |
|
---|
| 5 | #include "nv/gl/gl_vertex_buffer.hh"
|
---|
| 6 |
|
---|
| 7 | #include "nv/lib/gl.hh"
|
---|
| 8 | #include "nv/gl/gl_enum.hh"
|
---|
| 9 |
|
---|
| 10 | using namespace nv;
|
---|
| 11 |
|
---|
[153] | 12 | gl_vertex_buffer::gl_vertex_buffer( buffer_hint hint, size_t size, const void* data )
|
---|
[42] | 13 | : vertex_buffer( hint, size ), m_name()
|
---|
| 14 | {
|
---|
[299] | 15 | glBindBuffer( GL_ARRAY_BUFFER, m_name.get_value() );
|
---|
[121] | 16 | glBufferData( GL_ARRAY_BUFFER, (GLsizeiptr)m_size, data, buffer_hint_to_enum( m_hint ) );
|
---|
[42] | 17 | glBindBuffer( GL_ARRAY_BUFFER, 0 );
|
---|
| 18 | }
|
---|
| 19 |
|
---|
[153] | 20 | gl_index_buffer::gl_index_buffer( buffer_hint hint, size_t size, const void* data )
|
---|
[44] | 21 | : index_buffer( hint, size ), m_name()
|
---|
| 22 | {
|
---|
[299] | 23 | glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, m_name.get_value() );
|
---|
[121] | 24 | glBufferData( GL_ELEMENT_ARRAY_BUFFER, (GLsizeiptr)m_size, data, buffer_hint_to_enum( m_hint ) );
|
---|
[44] | 25 | glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, 0 );
|
---|
| 26 | }
|
---|
| 27 |
|
---|
Note: See
TracBrowser
for help on using the repository browser.