Re: [Flightgear-devel] opengl texgen - projected textures

2005-06-06 Thread Harald JOHNSEN

Manuel Massing wrote:


Hello Harald,

 


I am trying to project a texture on the scenario background. A priori
everything is setup correctly and the code should
work but at the end I only get a projection on the screen space.
picture here :
   



hmm, don't have the time to delve deeper into your example, but you seem to
be using the same projection matrix for light and camera, so the outcome is
expected...

keep in mind that OpenGL will multiply the texgen matrix with the inverse
of the camera matrix at time of specification. So you have to make sure that
modelview is set to the camera view at that point. If you use the
light point of view, the texgen results in an identity transform + projection.
If the light projection matrix matches the camera, fragment and
texture coordinates will be identical (modulo bias), thus the screen plane
alignment of your projection.

Also, a possible caveat: depending on the storage layout of SGMatrix, you
might need to feed OpenGL the transposed texgen matrix as plane vectors (and
use the transposed bias matrix i have seen lying around :-)).

bye,

Manuel

___
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

 


You are right, it is indeed working with another light view matrix.
Thx ;)

Harald.


___
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d


Re: [Flightgear-devel] opengl texgen - projected textures

2005-06-05 Thread Manuel Massing
Hello Harald,

> I am trying to project a texture on the scenario background. A priori
> everything is setup correctly and the code should
> work but at the end I only get a projection on the screen space.
> picture here :

hmm, don't have the time to delve deeper into your example, but you seem to
be using the same projection matrix for light and camera, so the outcome is
expected...

keep in mind that OpenGL will multiply the texgen matrix with the inverse
of the camera matrix at time of specification. So you have to make sure that
modelview is set to the camera view at that point. If you use the
light point of view, the texgen results in an identity transform + projection.
If the light projection matrix matches the camera, fragment and
texture coordinates will be identical (modulo bias), thus the screen plane
alignment of your projection.

Also, a possible caveat: depending on the storage layout of SGMatrix, you
might need to feed OpenGL the transposed texgen matrix as plane vectors (and
use the transposed bias matrix i have seen lying around :-)).

bye,

Manuel

___
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d


[Flightgear-devel] opengl texgen - projected textures

2005-06-05 Thread Harald JOHNSEN


I am trying to project a texture on the scenario background. A priori 
everything is setup correctly and the code should

work but at the end I only get a projection on the screen space.
picture here : 
http://sites.estvideo.net/tipunch/flightgear/shadow/fgfs-screen-044.jpg
It's the leftmost texture from the bottom of the screen that should be 
projected on the ground. I added a diagonal line to clearly see that 
there is no perspective on the screen projection.

If someone is courageous enought the code is here :
http://sites.estvideo.net/tipunch/flightgear/shadow/shadowmap.cxx <= new 
file
http://sites.estvideo.net/tipunch/flightgear/shadow/shadowmap.hxx <= new 
file
http://sites.estvideo.net/tipunch/flightgear/shadow/render.diff <= patch 
for render.cpp

use an external view.

Harald.



___
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d