C++ glaux函数的替换

C++ glaux函数的替换,c++,opengl,C++,Opengl,我正在阅读NeHe的教程,在凹凸贴图方面遇到了一个问题。到目前为止,我一直在使用土壤库将图像文件加载到OpenGL中,效果非常好。但是凹凸贴图教程使用指向图像数据的指针逐像素修改图像的颜色。据我所知,我不能用土壤图书馆做这件事。既然glaux已经被弃用,有没有一个好的方法来获得这种影响?显然,我们试图将alpha通道设置为像素颜色的红色分量的值。另一个注意事项是,我们将这些加载到字符数组中,因为C++不关心字节和char之间的区别(它们大小相同吗?)或者在这些方面我还有什么其他的东西吗? //

我正在阅读NeHe的教程,在凹凸贴图方面遇到了一个问题。到目前为止,我一直在使用土壤库将图像文件加载到OpenGL中,效果非常好。但是凹凸贴图教程使用指向图像数据的指针逐像素修改图像的颜色。据我所知,我不能用土壤图书馆做这件事。既然glaux已经被弃用,有没有一个好的方法来获得这种影响?显然,我们试图将alpha通道设置为像素颜色的红色分量的值。另一个注意事项是,我们将这些加载到字符数组中,因为C++不关心字节和char之间的区别(它们大小相同吗?)或者在这些方面我还有什么其他的东西吗?
// Load The Logo-Bitmaps
if (Image=auxDIBImageLoad("Data/OpenGL_ALPHA.bmp")) {
    alpha=new char[4*Image->sizeX*Image->sizeY];
    // Create Memory For RGBA8-Texture
    for (int a=0; a<Image->sizeX*Image->sizeY; a++)
        alpha[4*a+3]=Image->data[a*3];               // Pick Only Red Value As Alpha!
    if (!(Image=auxDIBImageLoad("Data/OpenGL.bmp"))) status=false;
    for (a=0; a<Image->sizeX*Image->sizeY; a++) {
        alpha[4*a]=Image->data[a*3];             // R
        alpha[4*a+1]=Image->data[a*3+1];         // G
        alpha[4*a+2]=Image->data[a*3+2];         // B
    }
//加载徽标位图
if(Image=auxDIBImageLoad(“Data/OpenGL_ALPHA.bmp”)){
alpha=新字符[4*图像->sizeX*图像->sizeY];
//为RGBA8纹理创建内存
对于(int a=0;asizeX*Image->sizeY;a++)
alpha[4*a+3]=图像->数据[a*3];//只选择红色值作为alpha!
如果(!(Image=auxDIBImageLoad(“Data/OpenGL.bmp”))状态=false;
对于(a=0;asizeX*Image->sizeY;a++){
alpha[4*a]=图像->数据[a*3];//R
alpha[4*a+1]=图像->数据[a*3+1];//G
alpha[4*a+2]=图像->数据[a*3+2];//B
}
土壤加载图像()
应提供原始图像位:

/**
    Loads an image from disk into an array of unsigned chars.
    Note that *channels return the original channel count of the
    image.  If force_channels was other than SOIL_LOAD_AUTO,
    the resulting image has force_channels, but *channels may be
    different (if the original image had a different channel
    count).
    \return 0 if failed, otherwise returns 1
**/
unsigned char*
    SOIL_load_image
    (
        const char *filename,
        int *width, int *height, int *channels,
        int force_channels
    );
SOIL\u load\u image()
应提供原始图像位:

/**
    Loads an image from disk into an array of unsigned chars.
    Note that *channels return the original channel count of the
    image.  If force_channels was other than SOIL_LOAD_AUTO,
    the resulting image has force_channels, but *channels may be
    different (if the original image had a different channel
    count).
    \return 0 if failed, otherwise returns 1
**/
unsigned char*
    SOIL_load_image
    (
        const char *filename,
        int *width, int *height, int *channels,
        int force_channels
    );

如果将假定为8位字节的代码移植到
char
类型大于8位的系统,则需要做大量工作。如果将假定为8位字节的代码移植到
char
类型大于8位的系统,则需要做大量工作。