Skip to main content
gamedev.net
🔒 Locked

Two problems with 2D texturing

Started by redattack34 1 reply 700+ views
Original Post
redattack34
redattack34
I've been working on a 2D shoot-em-up game in C++ and SDL. I recently tried porting the graphics to OpenGL to take advantage of the hardware support and rotation/scaling/alpha capabilities that SDL doesn't have (or in the case of alpha, is really slow at). It worked fairly well, except for the following problems: -My particles (4x4 images with pretty standard particle code, I think) were displayed as 4x4 boxes of solid color; the images are in png format with transparency which works correctly in SDL. I read somewhere that graphics cards don't like power-of-two textures that are lower than 64x64; might that be related? -I'm still using a lot of placeholder artwork (I can't draw to save my life, even on the computer) which is basically different-colored squares that were done with SDL_FillRect in SDL and quads in OpenGL. I noticed that, rather than the RGB values I had set for them, they were actually using a combination of the values I had set and the values of the first pixel of the last image that was loaded or displayed (I think). It's very strange; does anybody have any idea what's going on? I don't think it's related to the above issue; it occurred even with an image that is 64x64. I'd post my code, but I've been updating the SDL version (since it actually works right) and it wouldn't be accurate to the current version of my game.
snoutmate
snoutmate
It's hard to tell without code, but if you are working with raw bitmaps like this you should check that you have texture filtering disabled (GL_TEXTURE_MIN_FILTER and GL_TEXTURE_MAG_FILTER set to GL_NEAREST).
redattack34
redattack34
You know what, that could be it. I'll try that, thanks.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.