VR-Forces 4.6.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtFormatRenderer.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2010 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
12 #include <GL/glew.h>
13 #include <iostream>
14 
15 namespace makVrv
16 {
20  {
21  public:
22 
29  static unsigned int theVertexCountToModeMap[5];
30  };
31 
34  template <typename VertexFormat>
36  {
37  public:
38  //Draw arrays using server memory.
39  void drawArrays(unsigned int vertexCount, unsigned int vbo, unsigned int index, unsigned int count)
40  {
41  glBindBuffer(GL_ARRAY_BUFFER,vbo);
42 
44  glDrawArrays(DtRenderModes::theVertexCountToModeMap[vertexCount],index,count);
46 
47  glBindBuffer(GL_ARRAY_BUFFER,0);
48  }
49 
50  //Draw elements using server memory.
51  void drawElements(unsigned int vbo, unsigned int vertexCount, const unsigned int* indices, unsigned int count )
52  {
53  glBindBuffer(GL_ARRAY_BUFFER,vbo);
54  //glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,ibo);
55 
56  bindVertexArrays(0);
57  glDrawElements(DtRenderModes::theVertexCountToModeMap[vertexCount], count, GL_UNSIGNED_INT, indices);
59 
60  glBindBuffer(GL_ARRAY_BUFFER,0);
61  //glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0);
62  }
63 
64  protected:
65  virtual void bindVertexArrays(const VertexFormat* vertexArray) = 0;
66  virtual void unbindVertexArrays() = 0;
67  };
68 
69 }
70 

Document ID: Generated on Wed Jul 25 16:57:45 EDT 2018 from SVN revision 190790
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)