galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
TextureView.cpp
Go to the documentation of this file.
1
7
8#include <glad/glad.h>
9
10#include "galaxy/utils/Globals.hpp"
11
12#include "TextureView.hpp"
13
14#ifdef GALAXY_WIN_PLATFORM
15#pragma warning(push)
16#pragma warning(disable : 26493)
17#endif
18
19namespace galaxy
20{
21 namespace graphics
22 {
23 TextureView::TextureView(const unsigned int parent, const unsigned int minlevel, const unsigned int numlevels, const unsigned int minlayer, const unsigned int numlayers)
24 : Texture {}
25 {
26 glGenTextures(1, &m_id);
27 glTextureView(m_id, GL_TEXTURE_2D, parent, GL_RGBA8, minlevel, numlevels, minlayer, numlayers);
28 }
29
31 : Texture {std::move(t)}
32 {
33 }
34
36 {
37 if (this != &t)
38 {
39 Texture::operator=(std::move(t));
40 }
41
42 return *this;
43 }
44
46 {
47 // We don't need to destroy the view here.
48 }
49
51 {
52 glBindTexture(GL_TEXTURE_2D, m_id);
53 }
54
56 {
57 glBindTexture(GL_TEXTURE_2D, 0);
58 }
59 } // namespace graphics
60} // namespace galaxy
61
62#ifdef GALAXY_WIN_PLATFORM
63#pragma warning(pop)
64#endif
OpenGL 2D TextureView.
TextureView & operator=(TextureView &&)
Move assignment operator.
void bind() override
Activate context.
TextureView()=delete
Constructor.
virtual ~TextureView()
Destructor.
void unbind() override
Deactivate context.
OpenGL 2D Texture.
Definition Texture.hpp:26
unsigned int m_id
OpenGL id.
Definition Texture.hpp:161
Texture & operator=(Texture &&)
Move assignment operator.
Definition Texture.cpp:49
Animated.cpp galaxy.
Definition Animated.cpp:16
STL namespace.