Jump to content
  • Advertisement


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


Texture HELL

This topic is 5694 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
	unsigned int index;
	int width;
	int height;
	unsigned char* data;

	void loadBitmapFile(char* filename);
	void loadTargaFile(char* filename);
	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!"

Share this post

Link to post
Share on other sites
1. you can determine the color format

RGB RBG.....
2. make sure you load your textures after opengl has be initialized if you uses nehe`s base code place you loadtexture function calls to the init gl function

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!