[no bug] Texture Y flipped with OpenGL.

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Texture Y flipped with OpenGL.

Post by Nadro »

I just checked a shader code once more and I don't see a line like that:

Code: Select all

gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
but:

Code: Select all

gl_TexCoord[0] = gl_MultiTexCoord0;
In this way auto-flipping can't work in v1.8 too...

You must multiply "gl_TextureMatrix[yourTexUnit]" and texcoord if you use shaders and you want to use auto-flipping feature in v1.8. In trunk "gl_TextureMatrix[yourTexUnit]" isn't active (no overhead due to that), you must pass texture matrix via uniform yourself, it's the only difference.

Why it works like that? If you use vertex shader you have a full control over vertex transformation (no auto transformation by fixed pipeline at this step).

I tested posted sample with both v1.8.3 (up-to date from SVN) and the latest trunk and it looks the same in both cases. Why it "works" on your platform in v1.8? IIRC you have Nvidia card. NV drivers allow developers to do a strange things with OpenGL :P I think that mul by gl_TextureMatrix[0] may be done under the hood by NV drivers, but it's not allowed by OGL specification...
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Re: Texture Y flipped with OpenGL.

Post by devsh »

A) Texture Matrices are not GL core, so they should be removed (if someone wants matrices for their TC, have them as custom user data)
B) Texture Y is flipped in OpenGL natively, and it always has been (texture top is origin)
C) you write custom materials/shaders for GL anyway, so....
D) If you're really not okay with this, then make a texture upload flag which flips the texture lines when uploading them to OpenGL
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: [no bug] Texture Y flipped with OpenGL.

Post by Mel »

Vulkan also uses DX like texture space, with the Y axis inverted with regard to GL. GL chose that to be coherent to their space orientation, but many people just gets confused with it.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Post Reply