ok, don't groan.. lesson 6 problems, yes..

Started by
9 comments, last by sspeedy 17 years, 9 months ago
Hello peoples, I did fine with lessons 1-5 and the tutorials are excellent (ok, so lesson 1 was a bit boring, but 2-5 were a good time!) So yep, I've started Lesson 6 today and when I compile and run it, I get this initialization error? Anyway, so I downloaded the glAux Replacement.cpp and included it in the file like this: #include "glAux Replacement.cpp" Furthermore, I commented out the int LoadGLTextures() and the InitGL() functions in Lesson 6. I'm not sure if I am commenting out the right functions... are they? Ok, so I get these errors now: undeclared identifier \glaux replacement.cpp(42) : error C2065: 'window' : undeclared identifier \glaux replacement.cpp(42) : error C2065: 'Keys' : undeclared identifier \glaux replacement.cpp(42) : error C2065: 'keys' : undeclared identifier \glaux replacement.cpp(43) : error C2448: 'Initialize' : function-style initializer appears to be a function definition \lesson1.cpp(21) : error C2040: 'keys' : 'bool [256]' differs in levels of indirection from ''unknown-type'' The first four errors are related to the glAux Replacement.cpp's Initialize function:

BOOL Initialize (GL_Window* window, Keys* keys)				
{
	g_window	= window;
	g_keys		= keys;

	// Start Of User Initialization
	if (!NeHeLoadBitmap("Data/NeHe.bmp", texture[0]))					// Load The Bitmap
		return FALSE;					
}    


I know most people are sick of this one questions, but as I beginner, I do need the help. Someone vaguely touched on this in my first post, but that's too vague for me. If someone can give me step-by-step directions about how to overcome these errors and successfully compile lesson 6, I will REALLY APPRECIATE IT! I really need those specifics, as a beginner, or I get too frustrated, which doesn't lead to good things :( Plus, if any one of you can help me, this post can help other n00bs who will inevitably run into this problem. ---Edit---- glAux Replacement.cpp is from NeHe main page on the left side. I can try the bmp.h and bmp.cpp suggestions. I just want to be able to compile lesson 6 successfully.. btw, has someone here done so already? [Edited by - sspeedy on July 7, 2006 1:30:04 AM]
Advertisement
Quote:Original post by sspeedy

Anyway, so I downloaded the glAux Replacement.cpp and included it in the file like this:
#include "glAux Replacement.cpp"



#include cpp files in your project is a terrible idea. If you are referring to the post that has the bmp.cpp and bmp.h source code, then you should add the bmp.cpp file to your project and add #include "bmp.h" instead of #include <glaux.h>.
deathkrushPS3/Xbox360 Graphics Programmer, Mass Media.Completed Projects: Stuntman Ignition (PS3), Saints Row 2 (PS3), Darksiders(PS3, 360)
im not too sure about all your other errors, but your 'keys' one looks fairly simple. you have a variable defined as:
bool keys[256];

whereas your using it as Keys, just look at your error.
so instead of putting in Keys, put in keys so its not capital K anymore.

hope that helps,
--nathan
I had a look trough the replacement code on the main Nehe page, and i now know why it didn't work..

1. it's written to work on the nehe basecode and not lesson 6.

2. you should not include the "glAux Replacement.cpp" in the project, you should instead cut and paste the code into the basecode.

So to get it to work you have to replace the LoadGLTextures() function with the NeHeLoadBitmap() function.
Secondly in InitGL() you have to replace the first if statement

if (!LoadGLTextures())
{
return FALSE;
}

with

if (!NeHeLoadBitmap("Data/NeHe.bmp", texture[0]))
return FALSE;

the way this and the replacement code i posted works is simmilar (i even think the original source of the code is the same), exept mine replaces the specific glAux function in question and Nehe's the whole texture loading function.
Quote:Original post by lc_overlord
I had a look trough the replacement code on the main Nehe page, and i now know why it didn't work..

1. it's written to work on the nehe basecode and not lesson 6.

2. you should not include the "glAux Replacement.cpp" in the project, you should instead cut and paste the code into the basecode.

So to get it to work you have to replace the LoadGLTextures() function with the NeHeLoadBitmap() function.
Secondly in InitGL() you have to replace the first if statement

if (!LoadGLTextures())
{
return FALSE;
}

with

if (!NeHeLoadBitmap("Data/NeHe.bmp", texture[0]))
return FALSE;

the way this and the replacement code i posted works is simmilar (i even think the original source of the code is the same), exept mine replaces the specific glAux function in question and Nehe's the whole texture loading function.



hey thanks lc_overlord! How come there are no official, clear instructions on how to fix stuff for lesson 6? That would definitely help n00bs like me out. Plus, with the replacement code, there was an Initialize function. What was that for?

After I made the changes you mentioned, I ran it and got the same initialization error.... and then i realized why.. i don't have a Nehe.bmp! heh, so I just took an image, resized it, and voilah! I stared at my rotating cube in admiration for a min. and a half.

this forum has been so helpful so far. here i go on to lesson 7 tonight!
Quote:Original post by sspeedy
hey thanks lc_overlord! How come there are no official, clear instructions on how to fix stuff for lesson 6? That would definitely help n00bs like me out. Plus, with the replacement code, there was an Initialize function. What was that for?


Trust me, it is going to be rewritten soon, lesson 6 is one of the reasons we are rewriting the lessons instead of just adding to them.
So, yay no more glAux stuff. :)

As i said before, it was written for the nehe basecode and that has BOOL Initialize (GL_Window* window, Keys* keys) instead of InitGL(), and your supposed to replace the top part of it, i have to admit that the documentation is a bit thin, this is why we are working on this.

hey lc, since you've helped me out, I'll ask more questions here. I would've created a new thread, but don't want to look like an attention whore. It's to do with lesson 7, and I'm making mistakes but can't catch 'em. Here they are (if I don't get any responses, guess i'll make a new thread then).

For lesson 7, Nehe modifies the LoadGLTextures() function. I'm using the NeHeLoadBitmap(LPTSTR szFileName, GLuint &texid) function. I tried to do the best I could with the changes he made. For instance, in LoadGLTextures, he uses:

glGenTextures(3, &texture[0]);

So, I modified glGenTextures(1, &texid); in NeHeLoadBitmap to glGenTextures(3, &texid[0]);

Can the argument GLuint &texid be an array? Assuming yes, wherever NeHe used glBindTexture(GL_TEXTURE_2D, texture[0]); I used glBindTexture(GL_TEXTURE_2D, texid[0]); ...and so on (basically substituted texid for texture within the function). Hope ya get the point. When I do this, I get these errors:

C4996: 'fopen' was declared deprecatederror C2109: subscript requires array or pointer typeerror C2109: subscript requires array or pointer typeerror C2109: subscript requires array or pointer typeerror C2109: subscript requires array or pointer type


The errors correspond to these exact lines (I know this is getting repetitive, but can't hurt to show loc):
glGenTextures(3, &texid[0]);glBindTexture(GL_TEXTURE_2D, texid[0]);	glBindTexture(GL_TEXTURE_2D, texid[1]);glBindTexture(GL_TEXTURE_2D, texid[2]);
Did you convert texid to an array, because that error souldn't pop up unless you didn't do that.

GLuint texid[3]; <- it should look like this
GLuint texid; <- and not like this
Quote:Original post by lc_overlord
Did you convert texid to an array, because that error souldn't pop up unless you didn't do that.

GLuint texid[3]; <- it should look like this
GLuint texid; <- and not like this


I remember changing it to GLuint textid[] (w/o the 3). Why should it be
NeHeLoadBitmap(LPTSTR szFileName, GLuint texid[3]) and not
NeHeLoadBitmap(LPTSTR szFileName, GLuint &texid[3])?

forgetting the little things obviously, argh.
actuarly now that i think about it it should perhaps be
bool NeHeLoadBitmap(LPTSTR szFileName, GLuint *texid)
and texture should be an array, it depends a little on how you are solving this.

This topic is closed to new replies.

Advertisement