extended ascii (, ,...)

Started by
45 comments, last by Evil Steve 13 years, 4 months ago
Nope, didn't work. I was able to remove characters (making the grid be 5x5 as an example). But making the grid (16x16) and making the loops go from 32 to 256 didnt change anything.

Anyone have a solution?
Advertisement
Quote:Original post by m_power_hax
Nope, didn't work. I was able to remove characters (making the grid be 5x5 as an example). But making the grid (16x16) and making the loops go from 32 to 256 didnt change anything.
What if you save the texture to a BMP file? Does it look correct (I.e. does it have the new characters on it)?
Quote:Original post by Evil Steve
Quote:Original post by m_power_hax
Nope, didn't work. I was able to remove characters (making the grid be 5x5 as an example). But making the grid (16x16) and making the loops go from 32 to 256 didnt change anything.
What if you save the texture to a BMP file? Does it look correct (I.e. does it have the new characters on it)?


I don't know how to save the texture.

Google?
Quote:Original post by m_power_hax
Quote:Original post by Evil Steve
Quote:Original post by m_power_hax
Nope, didn't work. I was able to remove characters (making the grid be 5x5 as an example). But making the grid (16x16) and making the loops go from 32 to 256 didnt change anything.
What if you save the texture to a BMP file? Does it look correct (I.e. does it have the new characters on it)?


I don't know how to save the texture.


Consider a career change. You seem to lack the understand and drive to research things in order to be a programmer.

Quote:Original post by Evil Steve
Google?


I didn't find anything helpful about sending the bitmap.dc to a bmp file or text file.

Quote:Original post by m_power_hax
Quote:Original post by Evil Steve
Google?


I didn't find anything helpful about sending the bitmap.dc to a bmp file or text file.


The first hit in Evil Steve's suggested search query contains a FAQ that is extremely relevant.
Quote:Original post by the_edd
Quote:Original post by m_power_hax
Quote:Original post by Evil Steve
Google?


I didn't find anything helpful about sending the bitmap.dc to a bmp file or text file.


The first hit in Evil Steve's suggested search query contains a FAQ that is extremely relevant.


Yet, nothing i could use. Right now im trying to work on this code to save it in a bitmap :
bool GLFont::createTexture(const Bitmap &bitmap){    int w = bitmap.width;    int h = bitmap.height;    std::vector<unsigned char> pixels;    pixels.resize(w * h);    bitmap.copyBytesAlpha8Bit(&pixels[0]);    glGenTextures(1, &m_textureObject);    glBindTexture(GL_TEXTURE_2D, m_textureObject);    // Only use GL_NEAREST filtering for the min and mag filter. Using anything    // else will cause the font glyphs to be blurred. Using only GL_NEAREST    // filtering ensures that edges of the font glyphs remain crisp and sharp.    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);    glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, w, h, 0, GL_ALPHA,        GL_UNSIGNED_BYTE, &pixels[0]);        //    //trying do to something like bitmap.saveBitmap("test.txt");    //    glBindTexture(GL_TEXTURE_2D, 0);    return true;}




Quote:Original post by m_power_hax
Yet, nothing i could use.
*** Source Snippet Removed ***


I think this will be my last post on this thread.

The FAQ suggests four libraries, by my count, that you could use.
I'd recommend using TGA, since it's really easy to save. Then your code becomes:
#pragma pack(push, 1)struct TGA_HEADER{    BYTE  identsize;          // size of ID field that follows 18 byte header (0 usually)    BYTE  colourmaptype;      // type of colour map 0=none, 1=has palette    BYTE  imagetype;          // type of image 0=none,1=indexed,2=rgb,3=grey,+8=rle packed    short colourmapstart;     // first colour map entry in palette    short colourmaplength;    // number of colours in palette    BYTE  colourmapbits;      // number of bits per palette entry 15,16,24,32    short xstart;             // image x origin    short ystart;             // image y origin    short width;              // image width in pixels    short height;             // image height in pixels    BYTE  bits;               // image bits per pixel 8,16,24,32    BYTE  descriptor;         // image descriptor bits (vh flip bits)}#pragma pack(pop)// Assumes that pixels is 32-bit ARGB databool saveTGA(const char* filename, const void* pixels, int width, int height){   // Open output file   FILE* pFile = fopen(filename, "wb");   if(!pFile)      return false;   // Fill in TGA header   TGA_HEADER header;   memset(&header, 0, sizeof(header));   header.imagetype = 2;   header.width = width;   header.height = height;   header.bits = 32;   header.descriptor = 8;  // 8 bits of alpha, no H or V flip   if(fwrite(&header, sizeof(header), 1, pFile) != sizeof(header))   {      fclose(pFile);      return false;   }   // Write pixel data   if(fwrite(pixels, width*height*4, 1, pFile) != width*height*4)   {      fclose(pFile);      return false;   }   // Done   fclose(pFile);   return true;}

Then you'd use it as:
saveTGA("test.tga", &pixels[0], w, h);

Note that's all untested...

This topic is closed to new replies.

Advertisement