*** empty log message ***

svn path=/trunk/boinc/; revision=2351
This commit is contained in:
Oliver Wang 2003-09-23 19:53:30 +00:00
parent f865e51d73
commit ca88f30ad1
3 changed files with 37 additions and 3 deletions

View File

@ -17,7 +17,8 @@
// Contributor(s):
//
#include "config.h"
//#include "config.h"
#define HAVE_GLUT_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -976,7 +977,6 @@ bool CreateTextureBMP(UINT textureArray[], LPSTR strFileName, int textureID)
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR);
return true;
}
bool CreateTexturePPM(UINT textureArray[], LPSTR strFileName, int textureID)
{
unsigned char* pixels;
@ -992,6 +992,37 @@ bool CreateTexturePPM(UINT textureArray[], LPSTR strFileName, int textureID)
return true;
}
bool CreateTextureTGA(UINT textureArray[], LPSTR strFileName, int textureID)
{
if(!strFileName) // Return from the function if no file name was passed in
return false;
tImageTGA *pImage = LoadTGA(strFileName); // Load the image and store the data
if(pImage == NULL) // If we can't load the file, quit!
exit(0);
glGenTextures(1, &textureArray[textureID]);
glBindTexture(GL_TEXTURE_2D, textureArray[textureID]);
int textureType = GL_RGB;
if(pImage->channels == 4)
{
textureType = GL_RGBA;
}
gluBuild2DMipmaps(GL_TEXTURE_2D, pImage->channels, pImage->sizeX,
pImage->sizeY, textureType, GL_UNSIGNED_BYTE, pImage->data);
// glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
// glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR);
if (pImage) // If we loaded the image
{
if (pImage->data) // If there is texture data
{
delete[] pImage->data; // Free the texture data, we don't need it anymore
}
free(pImage); // Free the image structure
}
return true;
}
//text
UINT listBase[MAX_TEXTURES];

View File

@ -123,6 +123,8 @@ extern void replaceStar(Star* tmpStar);
#include "jpeglib.h"
#include "bmplib.h"
#include "tgalib.h"
#define MAX_TEXTURES 16
#define MAX_FONTS 16
extern UINT g_Texture[MAX_TEXTURES];
@ -130,6 +132,7 @@ extern UINT listBase[MAX_FONTS];
extern bool CreateTextureJPG(UINT textureArray[], LPSTR strFileName, int textureID);
extern bool CreateTextureBMP(UINT textureArray[], LPSTR strFileName, int textureID);
extern bool CreateTexturePPM(UINT textureArray[], LPSTR strFileName, int textureID);
extern bool CreateTextureTGA(UINT textureArray[], LPSTR strFileName, int textureID);
extern tImageJPG *LoadJPG(const char *filename);
extern void print_text(unsigned int base, char *string);
extern void MyCreateFont(unsigned int &base, char *fontName, int Size, int weight);

View File

@ -768,7 +768,7 @@ void REDUCED_ARRAY::draw_axes() {
glEnd();
glBegin(GL_QUADS);
glColor4d(1,1,1,.3);
glColor4d(1,1,1,.2);
glVertex3f(draw_pos[0], draw_pos[1], draw_pos[2]+adj);
glVertex3f(draw_pos[0]+draw_size[0], draw_pos[1], draw_pos[2]+adj);