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

Function initialize

source/examples/texture/main.cpp:34–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32
33
34void initialize()
35{
36 // Initialize OpenGL objects
37 static const int w(256);
38 static const int h(256);
39
40 unsigned char data[w * h * 4];
41
42 std::random_device rd;
43 std::mt19937 generator(rd());
44
45 std::poisson_distribution<> r(0.2);
46
47 for (int i = 0; i < w * h * 4; ++i)
48 data[i] = static_cast<unsigned char>(255 - static_cast<unsigned char>(r(generator) * 255));
49
50 g_texture = globjects::Texture::createDefault(GL_TEXTURE_2D);
51 g_texture->ref();
52 g_texture->image2D(0, GL_RGBA8, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
53
54 g_quad = new ScreenAlignedQuad(g_texture);
55 g_quad->ref();
56 g_quad->setSamplerUniform(0);
57}
58
59void deinitialize()
60{

Callers 2

ScreenAlignedQuadMethod · 0.70
mainFunction · 0.70

Calls 4

rFunction · 0.85
refMethod · 0.80
image2DMethod · 0.45
setSamplerUniformMethod · 0.45

Tested by

no test coverage detected