Advertisement

NeHe Lesson 6

Started by February 04, 2003 08:19 AM
4 comments, last by Psycho_Bastard 22 years ago
I have modified lesson 6 to allow a second texture... which works fine. When I tried to put in a third texture, I always get a wierd error saying that I can''t unregister the class. Any ideas why this is ? I have looked through the code stage by stage, and it all seems to be fine... I can''t figure out what I have missed I am a fish...... I am out of the water .... Damn
I am a fish...... I am out of the water .... Damn :(
how big is your array for texture indexies ?
Advertisement
Hmmm... read your note and tried increasing the number in the array beyond what I needed..... Problem * vanished *

I don''t understand why increasing the number of storage spaces for the textures would fix it though...

Could you lend your wisdom and let me know ?

Ta.

I am a fish...... I am out of the water .... Damn
I am a fish...... I am out of the water .... Damn :(
;-)))
hard to believe, how could this fix the problem ;-)
void glGenTextures(GLsizei n,GLuint * textures);
well, the glGenTextures fills array ''textures'' with the number of ''n'' indexies. If your array has not enough storage (less then n), it places the indexies beyound. This corrupted somthing in
the memory, corupting code, resulting to that error message.
it the tutorial, you have
GLuint texture[1];// Storage For One Texture ( NEW )
:
glGenTextures(1, &texture[0]);

so you have to exchange only the 1''s with 3''s. There are also
other 1''s used with textures, but i don''t think, there are more important. It depends on the modifications, you have made.
If it still does not give a sense, just tell me.
But now i''m going home. So maybe tomorrow.
ermmm.... you mean that I have to change the number 1 to the number of textures I am planning to use in all of the lines of code like this ?
glGenTextures(1, &texture[0]);
glGenTextures(1, &texture[1]);
glGenTextures(1, &texture[2]);


or do you mean incrementally ?


glGenTextures(1, &texture[0]);
glGenTextures(2, &texture[1]);
glGenTextures(3, &texture[2]);

I am a fish...... I am out of the water .... Damn
I am a fish...... I am out of the water .... Damn :(
The first one is correct, and this one is the same:
You just call glGenTextures(3, &texture[0]); once
this tells opengl to do something like this :
texture[0]=index1;
texture[1]=index2;
texture[2]=index3;
So it fills an array ''texture'' with 3 indexies starting
in the array form index 0.
And you have to define GLuint texture[3]; to
have enough space for these 3 indexies.

This topic is closed to new replies.

Advertisement