source: trunk/src/gpu/texture.h @ 1992

Last change on this file since 1992 was 1992, checked in by sam, 7 years ago

gpu: allow to specify the pixel format when creating a texture; the
internal format is then automatically deduced. Only a few 8-bit RGB
or RGBA formats are supported for now.

  • Property svn:keywords set to Id
File size: 1.1 KB
Line 
1//
2// Lol Engine
3//
4// Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net>
5//   This program is free software; you can redistribute it and/or
6//   modify it under the terms of the Do What The Fuck You Want To
7//   Public License, Version 2, as published by Sam Hocevar. See
8//   http://sam.zoy.org/projects/COPYING.WTFPL for more details.
9//
10
11//
12// The Texture class
13// -----------------
14//
15
16#if !defined __LOL_TEXTURE_H__
17#define __LOL_TEXTURE_H__
18
19namespace lol
20{
21
22struct PixelFormat
23{
24    /* XXX: make sure to update texture.cpp when this changes */
25    enum Value
26    {
27        Unknown = 0,
28        R8G8B8,
29        A8R8G8B8,
30        A8B8G8R8,
31    }
32    m_value;
33
34    inline PixelFormat() : m_value(Unknown) {}
35    inline PixelFormat(Value v) : m_value(v) {}
36    inline operator Value() { return m_value; }
37};
38
39class Texture
40{
41public:
42    Texture(ivec2 size, PixelFormat format);
43    ~Texture();
44
45    void Bind();
46    void SetData(void *data);
47    void SetSubData(ivec2 origin, ivec2 size, void *data);
48
49private:
50    class TextureData *m_data;
51};
52
53} /* namespace lol */
54
55#endif // __LOL_TEXTURE_H__
56
Note: See TracBrowser for help on using the repository browser.