OpenGL game programming book...

Started by
4 comments, last by dirtypope 22 years, 8 months ago
k i been reading the book and i was using chapter 18''s model loading code, i typed it out as it was in the book, tried to compile got some errors due to typo''s and such, but now i have 3 errors not due to typo''s and i cant figure them out, i skimmed back through the code in the book and couldnt find the problem, so i went to get the source code off the cd and ummm... well for some reason all the source code zips on the cd are empty which kinda pisses me off, but anyways, heres the errors and code... c:\fc-engine\cx\citizenx\src\model.h(233) : error C2065: ''LoadTexture'' : undeclared identifier c:\fc-engine\cx\citizenx\src\model.h(233) : error C2440: ''='' : cannot convert from ''int'' to ''texture_t *'' Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast c:\fc-engine\cx\citizenx\src\model.h(237) : error C2065: ''SetupMd2Texture'' : undeclared identifier Error executing cl.exe. CitizenX.exe - 3 error(s), 0 warning(s) and heres the small area of code the errors occur in... md2Texture = LoadTexture(textureName); if (md2Texture != NULL) { //set up tex and store it in model data struct SetupMd2Texture(md2Texture); model->modelTex = md2Texture; } now LoadTexture is suposed to be some where else in the code before this, but i didnt see it anywhere but in this area skimming the book, and i was hoping it had the source on the cd like it should so i could just open the file and search for LoadTexture.... but i cant, so has anyone else had any of theese problems before? or can anyone help with this? thanks in advance, dirtypope
Theres no such thing as stupid people... only people with under clocked brains. -dirty
Advertisement
Well, the cd had some problems, the source files wouldn''t unzip, the sdks were messed up and other stuff to i think, you can get a replacement cd if you go here:
OpenGL Game Programming Book you can also download the source if you dont want to wait for the cd. As for your problems, LoadTexture has not been defined as an int or some other identifier prior to its use, so you should define it and all should go well, unless there are some parameters you need to fill in that i don''t know about off the top of my head. Second problem, it looks like you have a pointer, but nothing to point to, I may be totally wrong about that but that''s what it looks like to me. And the third problem is like the first one you just need to define it as an int or something similar and it should work. Hope some of this may have helped.

Hi:

Download the source (zipped) from:

www.prima-tech.com


Sincerely



And when you''''re done, go shoot yourself ...
And when you''re done, go shoot yourself ...
I think it would be very useful to buy a C++/C book (or download a tut) and learn a little bit more about the language in wich you are implementing OpenGL. Else you will have beside the trouble you''ll have learning OpenGL, the trouble not to know how to implement it correctly.

> c:\fc-engine\cx\citizenx\src\model.h(233) : error C2065: ''LoadTexture'' : undeclared identifier
means you doesn''t have declared this identifier before, a function must have a prototype that must be declared before it will be used (at least in C++)
The 3rd problem is the same type, and the second would probably solve if you''ve declared a prototype
The prototype declaration must be done in the top of your file (or in a seperate header file that must be included).
And looks like that:
returnType functionName(parameter1Type, parameter2Type)

e.g.
Texture LoadTexture(char*);
(don''t rely on my return type, its probably wrong, but I don''t remember the right, right now.

Greetings Ben
Ben, i have about 7 books on C++ and im in college for it, im just really new to OpenGL and didnt know which struct to put LoadTexture in(incase it matters)... but anyways, i will download the source and check on egtting a new CD, thanks for the help guys
Theres no such thing as stupid people... only people with under clocked brains. -dirty
If I remember right, I didn''t include the texture loading code in the MD2 code to prevent redundancy. You may want to check out the chapter on textures (ch 8?) for the code. SetupMd2Texture() might be with the texture loading code. I can''t quite remember. In any case, you can download the source code as mentioned and see where everything is.

Kevin

Admin for GameDev.net.

This topic is closed to new replies.

Advertisement