Added Image::g/setOrigin to help movie plugins tell applications that the imagery

is not the usual OpenGL BOTTOM_LEFT orientation, but with the origin TOP_LEFT.  This
allows geometry setup code to flip the t tex coord to render the movie the correct way up.
This commit is contained in:
Robert Osfield
2007-06-12 16:55:44 +00:00
parent 26eb5672b9
commit a7a0e2c4d3
5 changed files with 31 additions and 3 deletions

View File

@@ -127,6 +127,24 @@ class OSG_EXPORT Image : public Object
*/
void copySubImage(int s_offset,int t_offset,int r_offset,osg::Image* source);
enum Origin
{
BOTTOM_LEFT,
TOP_LEFT
};
/** Set the origin of the image.
* The default value is BOTTOM_LEFT and is consistent with OpenGL.
* TOP_LEFT is used for imagery that follows standard Imagery convention, such as movies,
* and hasn't been flipped yet. For such images one much flip the t axis of the tex coords.
* to handle this origin position. */
void setOrigin(Origin origin) { _origin = origin; }
/** Get the origin of the image.*/
Origin getOrigin() const { return _origin; }
/** Width of image. */
inline int s() const { return _s; }
@@ -271,6 +289,8 @@ class OSG_EXPORT Image : public Object
std::string _fileName;
Origin _origin;
int _s, _t, _r;
GLint _internalTextureFormat;
GLenum _pixelFormat;