PLAYGROUND3D: Drop BGRA pixel format

This commit is contained in:
Paweł Kołodziejski 2021-12-04 22:15:39 +01:00
parent 01cc055c3b
commit f155d1796c
No known key found for this signature in database
GPG Key ID: 0BDADC9E74440FF7
3 changed files with 8 additions and 36 deletions

View File

@ -121,10 +121,6 @@ void OpenGLRenderer::loadTextureRGBA(Graphics::Surface *texture) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->w, texture->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, texture->getPixels());
glBindTexture(GL_TEXTURE_2D, _textureRgbaId[1]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->w, texture->h, 0, GL_BGRA, GL_UNSIGNED_BYTE, texture->getPixels());
}
void OpenGLRenderer::loadTextureRGB(Graphics::Surface *texture) {
@ -323,13 +319,6 @@ void OpenGLRenderer::drawRgbaTexture() {
glTranslatef(0.5, 0, 0);
glVertexPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), bitmapVertices);
glTexCoordPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), textCords);
glBindTexture(GL_TEXTURE_2D, _textureRgbaId[1]);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glTranslatef(0.5, 0, 0);
glVertexPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), bitmapVertices);
glTexCoordPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), textCords);
glBindTexture(GL_TEXTURE_2D, _textureRgbId[0]);
@ -342,14 +331,14 @@ void OpenGLRenderer::drawRgbaTexture() {
glBindTexture(GL_TEXTURE_2D, _textureRgb565Id[0]);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glTranslatef(-1.5, -0.5, 0);
glTranslatef(0.5, 0, 0);
glVertexPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), bitmapVertices);
glTexCoordPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), textCords);
glBindTexture(GL_TEXTURE_2D, _textureRgba5551Id[0]);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glTranslatef(0.5, 0, 0);
glTranslatef(-1.5, -0.5, 0);
glVertexPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), bitmapVertices);
glTexCoordPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), textCords);

View File

@ -222,28 +222,22 @@ void ShaderRenderer::drawRgbaTexture() {
offset.setX(-0.3);
offset.setY(0.8);
_bitmapShader->setUniform("offsetXY", offset);
glBindTexture(GL_TEXTURE_2D, _textureRgbaId[1]);
glBindTexture(GL_TEXTURE_2D, _textureRgbId[0]);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
offset.setX(0.2);
offset.setY(0.8);
_bitmapShader->setUniform("offsetXY", offset);
glBindTexture(GL_TEXTURE_2D, _textureRgbId[0]);
glBindTexture(GL_TEXTURE_2D, _textureRgb565Id[0]);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
offset.setX(0.7);
offset.setY(0.8);
_bitmapShader->setUniform("offsetXY", offset);
glBindTexture(GL_TEXTURE_2D, _textureRgb565Id[0]);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
offset.setX(-0.8);
offset.setY(0.2);
_bitmapShader->setUniform("offsetXY", offset);
glBindTexture(GL_TEXTURE_2D, _textureRgba5551Id[0]);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
offset.setX(-0.3);
offset.setX(-0.8);
offset.setY(0.2);
_bitmapShader->setUniform("offsetXY", offset);
glBindTexture(GL_TEXTURE_2D, _textureRgba4444Id[0]);

View File

@ -131,10 +131,6 @@ void TinyGLRenderer::loadTextureRGBA(Graphics::Surface *texture) {
tglTexParameteri(TGL_TEXTURE_2D, TGL_TEXTURE_MIN_FILTER, TGL_NEAREST);
tglTexParameteri(TGL_TEXTURE_2D, TGL_TEXTURE_MAG_FILTER, TGL_NEAREST);
tglTexImage2D(TGL_TEXTURE_2D, 0, TGL_RGBA, texture->w, texture->h, 0, TGL_RGBA, TGL_UNSIGNED_BYTE, texture->getPixels());
tglBindTexture(TGL_TEXTURE_2D, _textureRgbaId[1]);
tglTexParameteri(TGL_TEXTURE_2D, TGL_TEXTURE_MIN_FILTER, TGL_NEAREST);
tglTexParameteri(TGL_TEXTURE_2D, TGL_TEXTURE_MAG_FILTER, TGL_NEAREST);
tglTexImage2D(TGL_TEXTURE_2D, 0, TGL_RGBA, texture->w, texture->h, 0, TGL_BGRA, TGL_UNSIGNED_BYTE, texture->getPixels());
tglUploadBlitImage(_blitImageRgba, *texture, 0, false);
}
@ -352,32 +348,25 @@ void TinyGLRenderer::drawRgbaTexture() {
tglVertexPointer(2, TGL_FLOAT, 2 * sizeof(TGLfloat), bitmapVertices);
tglTexCoordPointer(2, TGL_FLOAT, 2 * sizeof(TGLfloat), textCords);
tglBindTexture(TGL_TEXTURE_2D, _textureRgbaId[1]);
tglBindTexture(TGL_TEXTURE_2D, _textureRgbId[0]);
tglDrawArrays(TGL_TRIANGLE_STRIP, 0, 4);
tglTranslatef(0.501, 0, 0);
//tglTranslatef(0.5, 0, 0); // some gfx issue
tglVertexPointer(2, TGL_FLOAT, 2 * sizeof(TGLfloat), bitmapVertices);
tglTexCoordPointer(2, TGL_FLOAT, 2 * sizeof(TGLfloat), textCords);
tglBindTexture(TGL_TEXTURE_2D, _textureRgbId[0]);
tglDrawArrays(TGL_TRIANGLE_STRIP, 0, 4);
tglTranslatef(0.5, 0, 0);
tglVertexPointer(2, TGL_FLOAT, 2 * sizeof(TGLfloat), bitmapVertices);
tglTexCoordPointer(2, TGL_FLOAT, 2 * sizeof(TGLfloat), textCords);
tglBindTexture(TGL_TEXTURE_2D, _textureRgb565Id[0]);
tglDrawArrays(TGL_TRIANGLE_STRIP, 0, 4);
tglTranslatef(-1.5, -0.5, 0);
tglTranslatef(0.5, 0, 0);
tglVertexPointer(2, TGL_FLOAT, 2 * sizeof(TGLfloat), bitmapVertices);
tglTexCoordPointer(2, TGL_FLOAT, 2 * sizeof(TGLfloat), textCords);
tglBindTexture(TGL_TEXTURE_2D, _textureRgba5551Id[0]);
tglDrawArrays(TGL_TRIANGLE_STRIP, 0, 4);
tglTranslatef(0.5, 0, 0);
tglTranslatef(-1.5, -0.5, 0);
tglVertexPointer(2, TGL_FLOAT, 2 * sizeof(TGLfloat), bitmapVertices);
tglTexCoordPointer(2, TGL_FLOAT, 2 * sizeof(TGLfloat), textCords);