MCPcopy Create free account
hub / github.com/cginternals/globjects / initialize

Method initialize

source/examples/texture/ScreenAlignedQuad.cpp:102–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102void ScreenAlignedQuad::initialize()
103{
104 // By default, counterclockwise polygons are taken to be front-facing.
105 // http://www.opengl.org/sdk/docs/man/xhtml/glFrontFace.xml
106
107 static const std::array<vec2, 4> raw { { vec2(+1.f,-1.f), vec2(+1.f,+1.f), vec2(-1.f,-1.f), vec2(-1.f,+1.f) } };
108
109 m_vao = new VertexArray;
110
111 m_buffer = new Buffer();
112 m_buffer->setData(raw, GL_STATIC_DRAW); //needed for some drivers
113
114 auto binding = m_vao->binding(0);
115 binding->setAttribute(0);
116 binding->setBuffer(m_buffer, 0, sizeof(vec2));
117 binding->setFormat(2, GL_FLOAT, GL_FALSE, 0);
118 m_vao->enable(0);
119
120 setSamplerUniform(0);
121}
122
123void ScreenAlignedQuad::draw()
124{

Callers

nothing calls this directly

Calls 6

bindingMethod · 0.80
setAttributeMethod · 0.80
setBufferMethod · 0.80
setDataMethod · 0.45
setFormatMethod · 0.45
enableMethod · 0.45

Tested by

no test coverage detected