~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to source/gameengine/Ketsji/BL_Texture.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2007-05-17 11:47:59 UTC
  • mfrom: (1.2.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20070517114759-yp4ybrnhp2u7pk66
Tags: 2.44-1
* New upstream release.
* Drop debian/patches/01_64bits_stupidity, not needed anymore: as of this
  version blender is 64 bits safe again. Adjust README.Debian accordingly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
100
100
                glDeleteLists((GLuint)mDisableState, 1);
101
101
                mDisableState =0;
102
102
        }
103
 
 
104
103
        g_textureManager.clear();
105
104
}
106
105
 
130
129
 
131
130
        ActivateUnit(mUnit);
132
131
 
133
 
 
134
132
        if (mTexture != 0) {
135
133
                glBindTexture(GL_TEXTURE_2D, mTexture );
136
134
                Validate();
137
135
                return mOk;
138
136
        }
 
137
 
 
138
        // look for an existing gl image
 
139
        BL_TextureMap::iterator mapLook = g_textureManager.find(img->id.name);
 
140
        if (mapLook != g_textureManager.end())
 
141
        {
 
142
                if (mapLook->second.gl_texture != 0)
 
143
                {
 
144
                        mTexture = mapLook->second.gl_texture;
 
145
                        glBindTexture(GL_TEXTURE_2D, mTexture);
 
146
                        mOk = IsValid();
 
147
                        return mOk;
 
148
                }
 
149
        }
 
150
 
139
151
        mNeedsDeleted = 1;
140
152
        glGenTextures(1, (GLuint*)&mTexture);
141
153
        InitGLTex(ibuf->rect, ibuf->x, ibuf->y, mipmap);
142
 
        
 
154
 
 
155
        // track created units
 
156
        BL_TextureObject obj;
 
157
        obj.gl_texture = mTexture;
 
158
        obj.ref_buffer = img;
 
159
        g_textureManager.insert(std::pair<char*, BL_TextureObject>((char*)img->id.name, obj));
143
160
 
144
161
 
145
162
        glDisable(GL_TEXTURE_2D);