Simple Question about Squeezing Textures

Hey :slight_smile:

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:

outColor = texture2D(texture, vec2(vTexCoord.x, vTexCoord.y));
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

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. :slight_smile: I usually try to solve my problems by myself but the information about shader is very small on the web. :wink:


Do you use a GL_MIN_FILTER that requires mipmaps and you don’t have the correct mipmaps for that texture ?

now i feel really foolish… :whistle: i really used a mipmap in the tex parameters, and without its working. big thx! :slight_smile:
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 :wink:

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.