Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Sprite won't display with it's texture

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2012

    Sprite won't display with it's texture

    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:

    Code :
    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:

    Code :
    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.

  2. #2
    Member Regular Contributor
    Join Date
    Aug 2008
    One problem I can see is that you're using:
    Code :
    Which should be:
    Code :
    Perhaps that is causing another uniform to be overwritten or something.

  3. #3
    Junior Member Newbie
    Join Date
    Jul 2012
    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts