MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / BindTexture

Class BindTexture

framework/render/gl20/ogl_2_0_renderer.cpp:469–502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

467};
468
469class BindTexture
470{
471 BindTexture(const BindTexture &) = delete;
472
473 public:
474 GLenum bind;
475 int unit;
476 static GLenum getBindEnum(GLenum e)
477 {
478 switch (e)
479 {
480 case gl20::TEXTURE_1D:
481 return gl20::TEXTURE_BINDING_1D;
482 case gl20::TEXTURE_2D:
483 return gl20::TEXTURE_BINDING_2D;
484 case gl20::TEXTURE_3D:
485 return gl20::TEXTURE_BINDING_3D;
486 default:
487 LogError("Unknown texture enum %d", static_cast<int>(e));
488 return gl20::TEXTURE_BINDING_2D;
489 }
490 }
491 BindTexture(GLuint id, GLint unit = 0, GLenum bind = gl20::TEXTURE_2D) : bind(bind), unit(unit)
492 {
493 ActiveTexture a(unit);
494 GLuint prevID;
495 gl20::GetIntegerv(getBindEnum(bind), reinterpret_cast<GLint *>(&prevID));
496 if (prevID == id)
497 {
498 return;
499 }
500 gl20::BindTexture(bind, id);
501 }
502};
503
504template <GLenum param> class TexParam
505{

Callers 1

BindTextureMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected