View Full Version : Problem, Opengl renders the texture inverted..
RoiiG
12-02-2008, 11:24 AM
Hello all,
I have a tricky problem that i don't know how to solve. I'm making an application that loads a figure from a .txt and then renders it. All is ok, then the application can apply a texture for the 3D figure. Well firstly i did it well, i loaded a sphere and applied it a world.bmp texture on it, and it worked very well, (i have calculated the texture coords). BUT
BUUUUT..
i Reworked the main code for the application, so i changed things and now the texture is rendered inverted. I don't know what is causing that and i hope that somebody can point me to a possible conflict.
Here you can see better what i am talking about.
http://img205.imageshack.us/img205/765/strangebz8.jpg
If you need portions of code to help me, i will be there.
Thanks! And sorry ofr my poor english I hope you understood me.
ZbuffeR
12-02-2008, 12:19 PM
This can come from a lot of things.
Can you diff your before/after source codes ? If not, well, that is bad practice. You should at least try to keep some older version manually, or even better, use a version control system (SVN, ...). It helps.
Usual suspects:
- bmp loader, check in-memory representation
- texture coordinates, as well as texture matrix.
- backface culling (maybe everything is correct, but you see only backfaces)
- model and viewport transformations : glScale, gl*Matrix, gluPerspective... (strong suspect)
- screen shot program (probably not)
RoiiG
12-02-2008, 12:58 PM
Thank you ZbuffeR.
I know that i should use a version control system but well you know im in the university and i dont know how SVN works yet. But when i finish those examns i will go to try SVN.
Well
Usual suspects:
- bmp loader, check in-memory representation (I think that no, i didn't touched the loader)
- texture coordinates, as well as texture matrix.
(i have figures with the texture coordinates precalculated, and i didnt changed anything) Texture matrix? can you explain me more?
- backface culling (maybe everything is correct, but you see only backfaces)
well yes, but i dont suspect that is this.
- model and viewport transformations : glScale, gl*Matrix, gluPerspective... (strong suspect)
Yes, i touched a lot of these ^^U...
- screen shot program (probably not)
Ok i go to eat something, then i will upload some code i hope this will clear something.
Thanks for your time ZbuffeR!
ZbuffeR
12-02-2008, 01:45 PM
TI know that i should use a version control system but well you know im in the university and i dont know how SVN works yet.
Even without SVN, keeping older copies on your work on dated directories is good practice. Memory is cheap.
work/assignment31 // <- current working directory
work/assignment31_2008-12-02 // yesterday
work/assignment31_2008-11-25 // older ...
work/assignment31_2008-11-15
...
Texture matrix? can you explain me more?
Yeah sure, there are 3 transformation matrices in opengl : projection, modelview, and texture matrix (http://search.yahoo.com/search?p=opengl+texture+matrix). But your problem is more likely to be in the other transformations.
RoiiG
12-02-2008, 01:48 PM
ZbuffeR I observed with more attention the images, and.. there is a small diference that i think it's the problem.
The sphere is centered on 0 0 0 , and the axis lines too. In the NEW image i can see the axis arriving at (0,0,0) in the OLD image, no...
Then this is indicating that it's the - backface culling (maybe everything is correct, but you see only backfaces) problem?
If it's that the error :S how i can solve it? i accept that i don't know what is causing this and i don't know what to touch to change this.
Thanks
RoiiG
12-03-2008, 05:52 AM
Ok, i solved it:
// glEnable(GL_CULL_FACE);
// glCullFace(GL_BACK);
[censored]... easy :).
Thank you ZbuffeR.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.