Exemple #1
0
   void
   ImageTexture2D::overwriteWith(float const * redPixels, float const * greenPixels, float const * bluePixels)
   {
      unsigned const format = extPixelFormat[3];
      unsigned const type = GL_FLOAT;

      float * pixels = new float[3 * _width * _height];

      interleavePixels(_width, _height, redPixels, greenPixels, bluePixels, pixels);
      glBindTexture(_textureTarget, _textureID);
      glTexSubImage2D(_textureTarget, 0, 0, 0, _width, _height, format, type, pixels);

      delete [] pixels;
      checkGLErrorsHere1(_texName);
   }
Exemple #2
0
void ImageTexture2D::overwriteWith(uchar const * redPixels,
		uchar const * greenPixels, uchar const * bluePixels,
		uchar const * alphaPixels) {
	unsigned const format = extPixelFormat[4];
	unsigned const type = GL_UNSIGNED_BYTE;

	unsigned char * pixels = new unsigned char[4 * _width * _height];

	interleavePixels(_width, _height, redPixels, greenPixels, bluePixels,
			alphaPixels, pixels);
	glBindTexture(_textureTarget, _textureID);
	glTexSubImage2D(_textureTarget, 0, 0, 0, _width, _height, format, type,
			pixels);

	delete[] pixels;
	checkGLErrorsHere1(_texName);
}