Advertisement

Help me! Can't get it to work :(

Started by May 23, 2002 01:11 PM
13 comments, last by Xces 22 years, 9 months ago
Hello i have this code:

typedef struct 
{ 
   GLubyte *imageData; // Image Data (Up To 32 Bits) 
   GLuint bpp; // Image Color Depth In Bits Per Pixel. 
   GLuint width; // Image Width 
   GLuint height; // Image Height 
   GLuint texID; // Texture ID Used To Hold the Texture
   GLuint tType;
} TextureImage; 

static GLuint flFontDefault; 
static TextureImage tiFontDefault; 

bool LoadFontWithFIF(GLuint fl, TextureImage ti, char* cFont) 
{ 
   ... 
   glBindTexture(GL_TEXTURE_2D, tiFontDefault.texID); // This works
   (but)
   glBindTexture(GL_TEXTURE_2D, ti.texID); // This doesn't work 
   ... 
} 

I call the function like this: 
   if (!LoadFontWithFIF(flFontDefault, tiFontDefault, "verdana15")) { return FALSE; } 
  
Please look @ above glBindTexture lines and tell me why it does not work... [edited by - Xces on May 23, 2002 2:14:28 PM]
try passing in the address of the structure instead:

bool LoadFontWithFIF(GLuint fl, TextureImage *ti, char* cFont)
{
...
glBindTexture(GL_TEXTURE_2D, ti->texID);
}


call it like this:

if(!LoadFontWithFIF(flFontDefault, &tiFontDefault, "verdana15"))
{
return FALSE;
}


[edited by - glDino on May 23, 2002 2:33:01 PM]
Advertisement
Nope no luck
that's weird... i hope i don't need to review c++ again


[edited by - glDino on May 23, 2002 3:05:54 PM]
I don't know why!

// This works:
glBindTexture(GL_TEXTURE_2D, tiFontDefault.TexID);

// This not:
glBindTexture(GL_TEXTURE_2D, ti->TexID);

// This is the function:
GLvoid glPrint(GLuint fl, TextureImage *ti, GLint size, GLint x, GLint y, const char *string, ...);

// And i call it like this:
glPrint(flFontDefault, &tiFontDefault, 50, 10, 40, cCurFPS);


?????


[edited by - Xces on May 23, 2002 3:16:36 PM]
If you send me the code, or method that fails, I can fix it
comment what''s wrong and send it back.
I have had 15 yeas are C++ programmer.(unless you''re) having a hardware problem, It won''t take long.
james dodd
Advertisement
Can''t you help me without my code?
glDino, be easier just to pass it as a reference, ie change the function parameters to this:

bool LoadFontWithFIF(GLuint fl, TextureImage &ti, char* cFont)

That might work, but I don''t know why your initial code wasn''t working ... it looks okay to me. Is this a run-time or compile-time error? If compile time, what does the compiler say?
The question is not "why a talking monkey," but rather, "why not a talking monkey." -Monkey Island 4
Are you using Visual Studio, and did you create your own project
james dodd
It runs ok, LoadTGA gives no error only my texture sqaures show up as white. And yes i created the code myself, but instead of just using one font, i wanted to load more fonts with 1 function. That''s why i am trying to create it generic...

If i do it like this:
bool LoadFontWithFIF(GLuint fl, TextureImage &ti, char* cFont)

How do i have to treat "ti" in the function itself?

This topic is closed to new replies.

Advertisement