Drawing sprites with alpha

Hello, I’m new to openGL and I’m having some trouble following the " opengl Rendering Sprites" tutorial, it won’t let me link the page, sorry.
Currently I’m looking into rendering sprites which I have working without the alpha channel (drawing a background on my sprite, unlike the tutorial). I have found that inputting GL_RGBA into the format of glTexImage2D crashes my program saying “nvoglv32.pdb not loaded”. I’m just a little confused because the tutorial can use either GL_RGBA or GL_RGB. I know I’m new and all but I don’t think anyone has asked something this specific, I’m not sure where I’m going wrong. GL_RGB works fine, just seems to be the alpha channel. Also I don’t think it’s the image because I’m using the same one they provided from the tutorial and have tried a few others.

If you just change the format parameter without changing the data, it’s probably going to result in OpenGL reading past the end of the array and causing an address exception, because the array only contains 3widthheight bytes but GL_RGBA needs 4widthheight bytes.

If you’re loading the image from a file, you usually need to tell the image-loading library whether you want RGB or RGBA data.

1 Like

Ah, I didn’t think of that. I have it loading properly now thanks very much for that. Sorry for the noob question. :slightly_smiling_face:

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.