I tried what you suggested, but still have not had any success. Here is some minimal code that reproduces what I am seeing:
#include <windows.h>
#include <SFML/Graphics.hpp>
#include <math.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <gl/gl.h>
#include <gl/glu.h>
#include <gl/glut.h>
class Scene {
public:
Scene() {
// Init OpenGL states
glEnableClientState( GL_VERTEX_ARRAY );
glEnableClientState( GL_TEXTURE_COORD_ARRAY );
glEnable( GL_TEXTURE_2D );
}
~Scene() {
// Reset OpenGL states
glDisableClientState( GL_VERTEX_ARRAY );
glDisableClientState( GL_TEXTURE_COORD_ARRAY );
glDisable( GL_TEXTURE_2D );
}
void resize( int w, int h ) {
// OpenGL Reshape
glViewport( 0, 0, w, h );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
gluPerspective( 120.0, (GLdouble)w/(GLdouble)h, 0.5, 500.0 );
glMatrixMode( GL_MODELVIEW );
}
};
float angle = 0.0f;
float lx = 0.0f, lz = -1.0f;
float x = 0.0f, z = 15.0f;
float deltaAngle = 0.0f;
float deltaMove = 0;
using namespace std;
int main(int argc, char **argv) {
sf::RenderWindow window(sf::VideoMode(800, 600, 32), "SFML/OpenGL Tester");
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
Scene scene;
scene.resize(800,600);
sf::Image img1;
img1.loadFromFile("texture.bmp");
GLuint texture1;
glGenTextures(1, &texture1);
glBindTexture(GL_TEXTURE_2D, texture1);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, img1.getSize().x, img1.getSize().y, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const GLvoid*)img1.getPixelsPtr() );
sf::Text text1("Some test text colored red");
text1.setPosition(230,550);
sf::Color Red(255,0,0);
text1.setColor(Red);
sf::Texture tex1;
tex1.loadFromFile("hud.png");
sf::Sprite sprite1;
sprite1.setTexture(tex1);
sprite1.setPosition(50,50);
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
glColorMaterial(GL_FRONT_AND_BACK, GL_EMISSION);
glEnable(GL_COLOR_MATERIAL);
glShadeModel(GL_SMOOTH);
float Y = 1.0f;
while( window.isOpen() ) {
sf::Event event;
while( window.pollEvent( event ) ) {
if( event.type == sf::Event::Closed )
window.close();
}
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(50.0, 1.0, 1.0, 70.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt( x, Y, z,//eye's position
x + lx, Y, z + lz, //where the eye is looking (point)
0.0f, 1.0f, 0.0f);//translations
glColor3f(0.5, 0.2, 0.2);
glBegin(GL_QUADS);
glEnable(GL_TEXTURE_2D);
glBindTexture( GL_TEXTURE_2D, texture1 );
glTexCoord2d(0.0,0.0);
glVertex3f(0,0,0);
glTexCoord2d(1.0,0.0);
glVertex3f(0,1,0);
glTexCoord2d(1.0,1.0);
glVertex3f(1,1,0);
glTexCoord2d(0.0,1.0);
glVertex3f(1,0,0);
glDisable(GL_TEXTURE_2D);
glEnd();
window.pushGLStates();
window.draw(text1);
window.draw(sprite1);
window.popGLStates();
window.display();
}
return 1;
}
This minimal code produces this:
![](http://puu.sh/IOLg)
Sprite 1, the non-green picture, where-ever you see white is actually supposed to be transparent. Text 1 also seems to have some problems aswell, as though where the transparent parts should be are colored what the text color is set to. The green square is a textured quad.