MCPcopy Create free account
hub / github.com/DanielChappuis/reactphysics3d / create

Method create

testbed/opengl-framework/src/Texture2D.cpp:54–73  ·  view source on GitHub ↗

Create the texture

Source from the content-addressed store, hash-verified

52
53// Create the texture
54void Texture2D::create(uint width, uint height, uint internalFormat, uint format, uint type,
55 void* data) {
56
57 // Destroy the current texture
58 destroy();
59
60 mWidth = width;
61 mHeight = height;
62
63 // Create the OpenGL texture
64 glGenTextures(1, &mID);
65 assert(mID != 0);
66 glBindTexture(GL_TEXTURE_2D, mID);
67 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
68 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
69 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
70 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
71 glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, mWidth, mHeight, 0, format, type, data);
72 glBindTexture(GL_TEXTURE_2D, 0);
73}
74
75// Create the texture
76void Texture2D::create(uint width, uint height, uint internalFormat, uint format, uint type,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected