Changeset 42 for trunk


Ignore:
Timestamp:
05/28/13 12:21:27 (12 years ago)
Author:
epyon
Message:
  • vertex_buffer interface and implementation
Location:
trunk
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/nv/gl/gl_device.hh

    r38 r42  
    2323                virtual window* create_window( uint16 width, uint16 height );
    2424                virtual program* create_program( const string& vs_source, const string& fs_source );
     25                virtual vertex_buffer* create_vertex_buffer( buffer_hint hint, int size, void* source = nullptr );
    2526                virtual ~gl_device();
    2627        private:
  • trunk/nv/gl/gl_enum.hh

    r35 r42  
    1515#include <nv/interface/clear_state.hh>
    1616#include <nv/interface/render_state.hh>
     17#include <nv/interface/vertex_buffer.hh>
    1718#include <nv/types.hh>
    1819
     
    2829        unsigned int stencil_function_to_enum( stencil_test_face::function_type type );
    2930        unsigned int stencil_operation_to_enum( stencil_test_face::operation type );
     31        unsigned int buffer_hint_to_enum( buffer_hint hint );
    3032
    3133        unsigned int type_to_gl_enum( type type );
  • trunk/nv/interface/device.hh

    r39 r42  
    1515#include <nv/common.hh>
    1616#include <nv/string.hh>
     17#include <nv/interface/vertex_buffer.hh>
    1718
    1819namespace nv
     
    2627                virtual window* create_window( uint16 width, uint16 height ) = 0;
    2728                virtual program* create_program( const string& vs_source, const string& fs_source ) = 0;
     29                virtual vertex_buffer* create_vertex_buffer( buffer_hint hint, int size, void* source = nullptr ) = 0;
    2830        };
    2931
  • trunk/src/gl/gl_device.cc

    r38 r42  
    77#include "nv/gl/gl_window.hh"
    88#include "nv/gl/gl_program.hh"
     9#include "nv/gl/gl_vertex_buffer.hh"
    910#include "nv/logging.hh"
    1011#include "nv/lib/sdl12.hh"
     
    5051}
    5152
     53vertex_buffer* gl_device::create_vertex_buffer( buffer_hint hint, int size, void* source /*= nullptr */ )
     54{
     55        return new gl_vertex_buffer( hint, size, source );
     56}
    5257
    5358gl_device::~gl_device()
     
    5560        SDL_Quit();
    5661}
     62
  • trunk/src/gl/gl_enum.cc

    r40 r42  
    123123}
    124124
     125unsigned int nv::buffer_hint_to_enum( buffer_hint hint )
     126{
     127        switch( hint )
     128        {
     129        case STATIC_DRAW   : return GL_STATIC_DRAW;
     130        case STREAM_DRAW   : return GL_STREAM_DRAW;
     131        case DYNAMIC_DRAW  : return GL_DYNAMIC_DRAW;
     132        default : return 0; // TODO: throw!
     133        }
     134}
     135
    125136unsigned int nv::type_to_gl_enum( type type )
    126137{
Note: See TracChangeset for help on using the changeset viewer.