myTarget (GL_TEXTURE_2D),
mySizeX (0),
mySizeY (0),
- myTextFormat (GL_FLOAT),
+ myTextFormat (GL_RGBA),
myHasMipmaps (Standard_False),
myParams (theParams)
{
return false;
}
myHasMipmaps = Standard_False;
- myTextFormat = theTextFormat;
+ myTextFormat = thePixelFormat;
+#if !defined(GL_ES_VERSION_2_0)
+ const GLint anIntFormat = theTextFormat;
+#else
+ // ES does not support sized formats and format conversions - them detected from data type
+ const GLint anIntFormat = thePixelFormat;
+#endif
const GLsizei aWidth = theSizeX;
const GLsizei aHeight = theSizeY;
const GLsizei aMaxSize = theCtx->MaxTextureSize();
}
// use proxy to check texture could be created or not
- glTexImage1D (GL_PROXY_TEXTURE_1D, 0, myTextFormat,
+ glTexImage1D (GL_PROXY_TEXTURE_1D, 0, anIntFormat,
aWidthOut, 0,
thePixelFormat, theDataType, NULL);
glGetTexLevelParameteriv (GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &aTestWidth);
return false;
}
- glTexImage1D (GL_TEXTURE_1D, 0, myTextFormat,
+ glTexImage1D (GL_TEXTURE_1D, 0, anIntFormat,
aWidthOut, 0,
thePixelFormat, theDataType, aDataPtr);
if (glGetError() != GL_NO_ERROR)
#if !defined(GL_ES_VERSION_2_0)
// use proxy to check texture could be created or not
- glTexImage2D (GL_PROXY_TEXTURE_2D, 0, myTextFormat,
+ glTexImage2D (GL_PROXY_TEXTURE_2D, 0, anIntFormat,
aWidthOut, aHeightOut, 0,
thePixelFormat, theDataType, NULL);
glGetTexLevelParameteriv (GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &aTestWidth);
}
#endif
- glTexImage2D (GL_TEXTURE_2D, 0, myTextFormat,
+ glTexImage2D (GL_TEXTURE_2D, 0, anIntFormat,
aWidthOut, aHeightOut, 0,
thePixelFormat, theDataType, aDataPtr);
if (glGetError() != GL_NO_ERROR)
{
#if !defined(GL_ES_VERSION_2_0)
// use proxy to check texture could be created or not
- glTexImage2D (GL_PROXY_TEXTURE_2D, 0, myTextFormat,
+ glTexImage2D (GL_PROXY_TEXTURE_2D, 0, anIntFormat,
aWidthOut, aHeightOut, 0,
thePixelFormat, theDataType, NULL);
glGetTexLevelParameteriv (GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &aTestWidth);
#endif
// upload main picture
- glTexImage2D (GL_TEXTURE_2D, 0, myTextFormat,
+ glTexImage2D (GL_TEXTURE_2D, 0, anIntFormat,
aWidthOut, aHeightOut, 0,
thePixelFormat, theDataType, theImage->Data());
if (glGetError() != GL_NO_ERROR)
else
{
#if !defined(GL_ES_VERSION_2_0)
- bool isCreated = gluBuild2DMipmaps (GL_TEXTURE_2D, myTextFormat,
+ bool isCreated = gluBuild2DMipmaps (GL_TEXTURE_2D, anIntFormat,
aWidth, aHeight,
thePixelFormat, theDataType, theImage->Data()) == 0;
if (isCreated)
glTexParameteri (myTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
- myTextFormat = theFormat.Internal();
+ const GLint anIntFormat = theFormat.Internal();
+ myTextFormat = theFormat.Format();
glTexImage2D (GL_PROXY_TEXTURE_RECTANGLE,
0,
- myTextFormat,
+ anIntFormat,
aSizeX,
aSizeY,
0,
glTexImage2D (myTarget,
0,
- myTextFormat,
+ anIntFormat,
aSizeX,
aSizeY,
0,