42 #define GL_STATE_UPDATE
59 : m_MatrixMode(GL_NONE)
60 , m_CurrentMode(GL_NONE)
79 LOG_POST(
Error <<
"CRenderCommon::Vertex3f() called without first calling CGlRender::Begin");
95 _TRACE(
"Warning: Rendering triangle pairs for quads in line mode");
120 LOG_POST(
Error <<
"CRenderCommon::Rectf() called between Begin() and End()");
125 Begin(GL_LINE_STRIP);
134 Begin(GL_TRIANGLE_STRIP);
145 #ifdef GL_STATE_UPDATE
166 if (attrib_size == vert_size) {
170 else if (attrib_size == vert_size + 1) {
175 if (attrib_size < vert_size) {
180 else if (attrib_size > vert_size + 1) {
181 LOG_POST(
Error <<
"Error - color attributes exceed expected count");
203 if (attrib_size == vert_size) {
207 else if (attrib_size == vert_size + 1) {
212 if (attrib_size < vert_size) {
217 else if (attrib_size > vert_size + 1) {
218 LOG_POST(
Error <<
"Error - texcoord2 attributes exceed expected count");
250 LOG_POST(
Error <<
"Unable to write text - must call BeginText() first");
265 LOG_POST(
Error <<
"Unable to write text - must call BeginText() first");
316 LOG_POST(
Error <<
"Error - GL_POLYGON rendering not supported");
320 LOG_POST(
Error <<
"Error - GL_QUAD_STRIP rendering not supported");
333 LOG_POST(
Error <<
"CRenderCommon::End() called without first calling CGlRender::Begin");
338 if (vert_size == 0) {
406 default_color =
colors.back();
421 if (vecs.size() > 0) {
422 default_value = vecs.back();
426 vecs.insert(vecs.end(),
437 if (vecs.size() > 0) {
438 default_value = vecs.back();
442 vecs.insert(vecs.end(),
CGlModel2D Base class for a model set up for rendering purposes.
CGlState Class to encapsulate Rendering state so that a set of user-selected GL state options can be ...
CGlVboNode A rendering node that holds a vertex buffer object.
virtual void TexCoord2f(GLfloat s, GLfloat t)
Texture coords.
virtual TModelUnit TextWidth(const CGlTextureFont *font, const char *text) const
virtual void Begin(GLenum mode)
Start rendering.
virtual TModelUnit GetFontDescender(const CGlTextureFont *font) const
virtual void BeginText(const CGlTextureFont *font, const CRgbaColor &color)
Text is drawn is pixel coordinates.
virtual void WriteText(TModelUnit x, TModelUnit y, const char *text, TModelUnit rotate_degrees=0.0)
Write text at specified model coords.
CGlVboNode m_RenderNode
vertex buffer node for rendering all Begin()/End() renders
CRef< CGlState > m_State
state used by all nodes
CRgbaColor m_TextColor
color and alpha for text only (other GL options do not apply to text)
virtual TModelUnit GetMaxWidth(const CGlTextureFont *font, int max_num) const
virtual void Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
Rect() functions also do Begin() and End() (as in OpenGL)
GLenum m_CurrentMode
rendering mode from Begin()
virtual void Clear()
Clear/delete any graphics/OpenGL memory.
virtual TModelUnit GetAdvance(const CGlTextureFont *font, char c) const
virtual TModelUnit GetMetric(const CGlTextureFont *font, IGlFont::EMetric metric, const char *text=NULL, int len=-1) const
Calls the standard font metric functions except for pdf in which case it first replaces any bitmap fo...
const CGlTextureFont * m_CurrentFont
text parameters
virtual void Render(CGlPane &pane, CGlModel2D *model)
virtual TModelUnit TextHeight(const CGlTextureFont *font) const
virtual void EndText()
Pops matrices and attributes after writing text.
GLint m_Viewport[4]
current projection set by Viewport()
vector< CVect2< float > > m_TexCoord2DBuffer1
vector< CRgbaColor > m_ColorBuffer
void x_SyncAttribs(vector< CRgbaColor > &colors)
virtual void End()
Finish rendering (create buffer and send to renderer)
virtual void Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
virtual void Vertex3f(GLfloat x, GLfloat y, GLfloat z)
Explicit support not currently available for: GLbyte, GlShort and GLint calls, e.g.
GLenum m_MatrixMode
current modelview matrix and matrix mode
virtual void GetViewport(GLint *params)
virtual void ColorC(const CRgbaColor &color)
Colors (also defined in IGlState since they can be set either before or inside of Begin()/End().
virtual void x_RenderBuffer(CGlVboNode *node)
vector< CVect3< float > > m_VertexBuffer
class CRgbaColor provides a simple abstraction for managing colors.
static const Colors colors
#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 SetTexCoordBuffer(const vector< CVect2< float > > &data)
GLenum GetPolygonMode() const
static CGlResMgr & Instance()
virtual CMatrix4< float > GetModelViewMatrix() const =0
CIRef< IRender > GetCurrentRenderer()
Returns current renderer, or NULL.
virtual void Render()
Set state and call x_Render() to render geometry.
IRender & GetGl()
convenience function for getting current render manager
void WriteText(TModelUnit x, TModelUnit y, const char *text, TModelUnit rotate_degrees=0.0) const
Write text at specified model coords.
CIRef< IVboGeom > GetVBOGeom()
void SetVertexBuffer3D(const vector< CVect3< float > > &data)
virtual TModelUnit GetFontDescender() const
void SetPosition(const CMatrix4< float > &mat)
Set 1 transformation and have it be "mat".
void SetState(CGlState *state)
Set/get current OpenGL state.
void SetVBOGeom(IVboGeom *geom)
Set/get geometry object. These can be shared between nodes.
void BeginText() const
WriteText interface The WriteText functions produce the same results as TextOut but they are more eff...
TModelUnit GetMaxWidth(int max_num) const
returns minimal space sufficient to render any number in [0, max_num].
CRgbaColor GetColor() const
void EndText() const
Pops matrices and attributes after writing text.
virtual TModelUnit GetMetric(EMetric metric, const char *text=NULL, int len=-1) const
virtual TModelUnit TextWidth(const char *text) const
Compute and return font metrics.
virtual TModelUnit TextHeight(void) const
void SetColorBuffer(const vector< CRgbaColor > &data)
virtual void Render(CGlPane &pane)
Draw to the screen.
TModelUnit GetAdvance(char c) const
virtual void ColorC(const CRgbaColor &c)
float GetBlue(void) const
float GetGreen(void) const
float GetAlpha(void) const
const float * GetColorArray(void) const
Access the color array directly.
float GetRed(void) const
Get specific channels in floating point values.
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
TObjectType & GetObject(void)
Get object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static void text(MDB_val *v)