Render to texture problem

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Blizzard
Posts: 71
Joined: Thu Apr 20, 2006 5:27 pm
Location: Italy

Render to texture problem

Post by Blizzard »

Hi,
I've a problem with render to texture ando openGL.
I'm using irrlicht 1.0 and I wanto to put the scene render in a texture and then render the texture on screen with driver->draw2DImage(...);

The texture is of the same dimension of the screen.

The problem is that when I draw the texture, the texture is deformed, moved on bottom right and rotated by 180° T_T

I've rewrite the code using gl code, so I've created a quad with the dimensions from (-1,1) [top left] to (1,-1) [bottom right] .
I've load identity matrices on modelview and projection matrix.
The restult is the same.
So I've correct the texture u,v with the glTexCoord2f(...) and I've rotated the texture by 180° in the right way... but the translation and deformation are still present...

Why happen this problem???

Thanks to anyone want to help me!
Everyone for the game and the game for everyone
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Maybe you should not create a texture with non-power-of-2 dimensions. So dont use 800x600, but 1024x1024 and discard the unused parts by choosing the correct texture coords.
Blizzard
Posts: 71
Joined: Thu Apr 20, 2006 5:27 pm
Location: Italy

Post by Blizzard »

you're my hero hybrid! :D

I've used 512x512 texture and now it works correctly.

Previously I've used 640x480 texture with the bad results

Thanks a lot!

Bye
Everyone for the game and the game for everyone
Post Reply