Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Simple Question about Squeezing Textures

  1. #1
    Newbie Newbie
    Join Date
    Dec 2012
    Posts
    2

    Simple Question about Squeezing Textures

    Hey

    I'm using OpenGL with SDL and i've got a little problem with GLSL if i try to squeeze the image in the Post-Processing-Shader, for example:
    Code :
    outColor = texture2D(texture, vec2(vTexCoord.x, vTexCoord.y));
    and
    outColor = texture2D(texture, vec2(vTexCoord.x * 0.5, vTexCoord.y));
    is working perfectly, first one outputs the normal screen and the second one stretches it and you can't see the complete viewport, but
    Code :
    outColor = texture2D(texture, vec2(vTexCoord.x * 1.5, vTexCoord.y));
    squeezes the output but also makes it much much darker, with 1.2 its not a big deal but with 1.8 its complete black. oO
    (the shader is really that simple for testing, only the inputs, the uniform and this line)

    If i clear the viewport with red for example and don't render anything it is the same.. getting darker and darker red until black with higher values.
    If i try to put a .png file as texture to the shader its working perfectly, no color-differences even with 4.0 or more.
    The Framebuffer-Init-Code is from a Tutorial and with my older GLUT-programs the squeezing works fine, only after switching to SDL (and splitting the code into classes) the result is as described before.

    It would not make any sense to post the complete code, because its too much splitted^^ but if you tell me where the bug could be i can add the lines or look at it myself.

    Any help or tips where i could find help would be very nice. I usually try to solve my problems by myself but the information about shader is very small on the web.

    Thanks,
    Blobby

  2. #2
    Junior Member Regular Contributor
    Join Date
    Dec 2009
    Posts
    212
    Do you use a GL_MIN_FILTER that requires mipmaps and you don't have the correct mipmaps for that texture ?

  3. #3
    Newbie Newbie
    Join Date
    Dec 2012
    Posts
    2
    now i feel really foolish.. i really used a mipmap in the tex parameters, and without its working. big thx!
    but i used the same parameters like in the old glut-programs and there it worked, really confusing.. looks like its time to do some deeper study about mipmaps

Posting Permissions

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