View Full Version : Sprite won't display with it's texture

07-05-2012, 06:45 AM
Hey there.

It's been three days, other people tried to help me (on another forum), but it was no use.
What I have is:

A sprite & image class. You can use them in following way:

Image test_img("image.png");
Sprite test_spr(5.0f,25.0f,test_img);

Sprite that should display along with it's texture. Instead, after I do this:

gl_FragColor = texture2D(mytexture,UV_coord) * color;

in my fragment shader, gl_FragColor's RGBA is always 0.0. (So actual output after test_spr.Draw is nothing. When I add gl_FragColor[3] = 1.0 to the fragment shader, I get a black rectangle of the x, y, width and height it was supposed to be)
I have checked and it's not a problem with color uniform (which takes it's values correctly).

Also, I've used glGetError() everywhere I could - with no errors being reported.
And also I've checked UV coordinates - they're 100% correct.

There's not much left I could do... Therefore I post both classes in two separate links:

Image class.


Sprite class.


Please help, because I've lost hope already.

Dan Bartlett
07-05-2012, 08:45 AM
One problem I can see is that you're using:

Which should be:

Perhaps that is causing another uniform to be overwritten or something.

07-05-2012, 08:57 AM
Yep, I've spotted that few hours before and changed it to glUniform1i(uniform_myTexture,0);. (It was producing an error being given to me by glGetError)

But still, it didn't help. :(