• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# Texture HELL

## Recommended Posts

Hello, I''m in the process of *trying* to learn openGL. Actually, I find most of it pretty easy to understand, but I''m having a lot of texture related problems. After staying up all night, though, I''ve solved all but 2 of those problems. First of all, when I draw my texture, the Red and Blue components seem to be reversed. This is odd because I have a loop in my bitmap loader function that specifically swaps these two values for every color triple. However, even if I comment out this loop from the code, it still looks the same. Does anyone have any idea on a general level what I may be doing wrong? If not, I can post the code here. Secondly, OpenGL is being a little quirky with where I have to put my gentextures, bindtexture, and teximage2d calls. You see, I''m trying to make a simple C++ class that will allow me to easily manipulate and load textuers. The prototype looks like this:

class Texture
{
public:
unsigned int index;
int width;
int height;
unsigned char* data;

Texture();
~Texture();

void WriteDebug(char* filename);
};

When I put my gen, bind, and image2d calls in the function in the main program where I render the scene, it runs fine (albiet, with flipped R and B components). However, when I try to move these calls to the loadBitmapFile(char*) method of my class, it doesn''t work right and gives me a DLL error when I try to exit my program. Thnx for any help in advance. Plz ask if you need more information on my code and I will provide. "You TK''ed my chicken!"