Archived

This topic is now archived and is closed to further replies.

Amir Vaxman

Texture mapping simply doesn't work!

Recommended Posts

Hello, I tried to perform texture mapping in an openGL program, been doing what the tutorials said, and even copying from examples. But yet, it simply doesn''t work! I get, instead of a textured polygon, a polygon colored in its former color. Now, I think it has something to do with, maybe, one of these: 1. when I call glGetTextures, it doesn''t provide me back with any new ID! why is that? 2. I might not be doing something I should have been doing before trying to define the texture - change of some variables? some registers? defining a valid viewport before, or something? I simply don''t have a clue. If someone ran into a similiar problem, or knows why this happens, please give me a hand here. Thanks in Advance, Amir

Share this post


Link to post
Share on other sites
I can''t, it''s not understandable (part of a big program, using lots of unfamiliar variables). I will try, if no one could give me a general solution..

Thanks in Advance,
Amir

Share this post


Link to post
Share on other sites
You may have either written to memory that doesn''t exist, or done something else weird... make sure you use GenTextures ONCE only, check your arrays, and do stuff. It''s almost definitely the loading/creation of the texture objects that''s causing the problem.

Share this post


Link to post
Share on other sites
1. Yes, I ment glGenTextures, sorry :-)

2. I tried to bind the texture, as written how-to, but I believe the problem is as early as (1), that doesn''t produce an ID.

3. "You may have either written to memory that doesn''t exist, or done something else weird... make sure you use GenTextures ONCE only" - is openGL accumulative even after closing the application? how can I trace errors?

4. It''s a 64*64.

5. "Make sure you have a valid context before you tries to call any other opengl command" - what does that mean? can''t I upload a texture before using the "wglCreateContext" and such?

Share this post


Link to post
Share on other sites
quote:
Original post by Amir Vaxman
5. "Make sure you have a valid context before you tries to call any other opengl command" - what does that mean? can''t I upload a texture before using the "wglCreateContext" and such?


exactly. you must have a valid context before using opengl.

"What is darkness? It doesn''t exist where there''s light, and without light, it''s nothing..."

Share this post


Link to post
Share on other sites
Thank you all very much!

The thing is, al openGL commands must come after a wglMakeCurrent() call with the proper rendering context. It is never explicitly announced in the red book, as much as I can tell..

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
When something doesn''t work and you are desperate, check some Nehe sources and try them on your computer to see if the problem comes from the gfx card, the computer or you

Share this post


Link to post
Share on other sites