Added the start of support for NPOT textures
This commit is contained in:
parent
4535cdfbba
commit
c7853c8c71
|
|
@ -345,6 +345,17 @@ get_supports_cube_map() const {
|
|||
return _supports_cube_map;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GraphicsStateGuardian::get_supports_tex_non_pow2
|
||||
// Access: Published
|
||||
// Description: Returns true if this GSG can handle non power of two
|
||||
// sized textures.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool GraphicsStateGuardian::
|
||||
get_supports_tex_non_pow2() const {
|
||||
return _supports_tex_non_pow2;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GraphicsStateGuardian::get_max_lights
|
||||
// Access: Published
|
||||
|
|
|
|||
|
|
@ -132,7 +132,8 @@ GraphicsStateGuardian(const FrameBufferProperties &properties,
|
|||
|
||||
_supports_3d_texture = false;
|
||||
_supports_cube_map = false;
|
||||
|
||||
_supports_tex_non_pow2 = false;
|
||||
|
||||
// Assume no limits on number of lights or clip planes.
|
||||
_max_lights = -1;
|
||||
_max_clip_planes = -1;
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@ PUBLISHED:
|
|||
|
||||
INLINE bool get_supports_3d_texture() const;
|
||||
INLINE bool get_supports_cube_map() const;
|
||||
INLINE bool get_supports_tex_non_pow2() const;
|
||||
|
||||
INLINE int get_max_lights() const;
|
||||
INLINE int get_max_clip_planes() const;
|
||||
|
|
@ -336,6 +337,7 @@ protected:
|
|||
|
||||
bool _supports_3d_texture;
|
||||
bool _supports_cube_map;
|
||||
bool _supports_tex_non_pow2;
|
||||
|
||||
int _max_lights;
|
||||
int _max_clip_planes;
|
||||
|
|
|
|||
|
|
@ -472,6 +472,9 @@ reset() {
|
|||
|
||||
_supports_multitexture = false;
|
||||
|
||||
_supports_tex_non_pow2 =
|
||||
has_extension("GL_ARB_texture_non_power_of_two");
|
||||
|
||||
if (is_at_least_version(1, 3)) {
|
||||
_supports_multitexture = true;
|
||||
|
||||
|
|
@ -2443,9 +2446,14 @@ framebuffer_copy_to_texture(Texture *tex, int z, const DisplayRegion *dr,
|
|||
|
||||
int xo, yo, w, h;
|
||||
dr->get_region_pixels(xo, yo, w, h);
|
||||
tex->set_x_size(Texture::up_to_power_2(w));
|
||||
tex->set_y_size(Texture::up_to_power_2(h));
|
||||
|
||||
if (_supports_tex_non_pow2) {
|
||||
tex->set_x_size(w);
|
||||
tex->set_y_size(h);
|
||||
} else {
|
||||
tex->set_x_size(Texture::up_to_power_2(w));
|
||||
tex->set_y_size(Texture::up_to_power_2(h));
|
||||
}
|
||||
|
||||
// Sanity check everything.
|
||||
if (z >= 0) {
|
||||
if (!_supports_cube_map) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue