View Full Version : glut or glaux?????

02-09-2001, 03:34 AM
Can anybody tell me how glut can be used instead of glaux for loading a bmp as a texture? I'll need the code for the same. I have a code with glaux which does this though not quite successfully.

PLeeeeeeeeeeeeaaaaaase Help!!!!!


02-09-2001, 03:48 AM
GLUT has no functions at all for managing textures.

02-09-2001, 04:16 AM
Bob's right: GLUT has _NO_ tex-management functions, nor are .bmp files exactly the best format to use -- I use .raw files: which are generally smaller, easier to get, and(for space freeks), very compressible.
I'll post a routine as soon as I can(Monday, probably...)
Big disadvantages, however, with .raw files are that you need to know *everything* about them http://www.opengl.org/discussion_boards/ubb/smile.gif -- height, width, depth, colours, RGB/BGR, etc...

02-12-2001, 05:02 AM

/* Other includes here...*/
#include <stdio.h>
#include <Gl/glut.h>
/* ...and here. */
/* Declaration of function. */
void load_texture(char *file_name, int width, int height, int depth, GLenum colour_type, GLenum filter_type);
/* Actual function. */
void load_texture(char *file_name, int width, int height, int depth, GLenum colour_type, GLenum filter_type)
GLubyte *raw_bitmap;
FILE *file;
if((file = fopen(file_name, "rb"))==NULL)
printf("File Not Found : %s\n", file_name);
raw_bitmap = (GLubyte *) malloc (width * height * depth * (sizeof(GLubyte)));
if(raw_bitmap == NULL)
printf("Cannot allocate memory for texture\n");
fread(raw_bitmap, width * height * depth, 1 , file);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter_type);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter_type);
gluBuild2DMipmaps(GL_TEXTURE_2D, colour_type, width, height, colour_type, GL_UNSIGNED_BYTE, raw_bitmap);

A standard call(for a 256*256 linear RGB texture) would be something like this...
load_texture("earth_r.raw", 256, 256, 3, GL_RGB, GL_LINEAR);
NB: This is NOT my code, all the same: I hope it helps http://www.opengl.org/discussion_boards/ubb/smile.gif
Note also that I've got no idea if this works with multi-texturing: I've no idea as to that subject, so I guess it dosen't...

02-12-2001, 05:38 AM
Of course it works with multitexturing, why shouldn't it? That function is just for loading the texture, not using it.

02-12-2001, 03:13 PM
dont use GLAUX check the faq's even the makers(sgi) of glaux say dont use it but to use glut instead.

for loading textures ild recommend www.openil.org (http://www.openil.org) loads tga,jpg,bmp,png etc very simple to setup and use.
include the library an example of its use is in my opengl appwizard (glut part) http://members.nbci.com/myBollux only works on vc6 at the moment

02-13-2001, 04:56 AM
Well, like I said: I've no idea as to how multitexturing works, as far as I know, the textures could be loaded individually into a dynamic array in VRAM, pointed to by a dword hex number... or they could just be loaded, one at a time from disk, each and every time they're needed...I suspect that this method works with the latter(slower) process, but it's unlikly to work with any other method.