citrun

watch C/C++ source code execute
Log | Files | Refs | LICENSE

gl_buffer.h (1445B)


      1 /*
      2  * Copyright 2012 Google, Inc. All Rights Reserved.
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *     http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  *
     16  * Google Author(s): Behdad Esfahbod
     17  */
     18 
     19 #ifndef GL_BUFFER_H
     20 #define GL_BUFFER_H
     21 
     22 #include <vector>
     23 
     24 #include "demo-common.h"
     25 #include "gl_font.h"		// citrun::gl_font
     26 #include "gl_shader.h"		// citrun::glyph_vertex_t
     27 
     28 
     29 namespace citrun {
     30 
     31 class gl_buffer
     32 {
     33 	unsigned int			 m_refcount;
     34 	glyphy_point_t			 m_cursor;
     35 	std::vector<citrun::glyph_vertex_t> m_vertices;
     36 	glyphy_extents_t		 m_ink_extents;
     37 	glyphy_extents_t		 m_logical_extents;
     38 	bool				 m_dirty;
     39 	GLuint				 m_buf_name;
     40 
     41 	citrun::gl_shader		 shader;
     42 
     43 public:
     44 	gl_buffer();
     45 
     46 	void		reference();
     47 	void		clear();
     48 	void		extents(glyphy_extents_t *, glyphy_extents_t *);
     49 	void		move_to(const glyphy_point_t *);
     50 	void		current_point(glyphy_point_t *);
     51 	void		add_text(const char *, citrun::gl_font &, double);
     52 	void		draw();
     53 };
     54 
     55 } // namespace citrun
     56 #endif // GL_BUFFER_H