SDL/OpenGL Game Development Tutorials: Part 2 - Loading Textures

preview_player
Показать описание
In this tutorial, I show you how to load images into SDL and convert them into textures for OpenGL for C++ in Code::Blocks.

Рекомендации по теме
Комментарии
Автор

After 6 months of on and off searching for a way to get Allegro, SDL, or SFML for code::blocks to work, your videos have finally made it work.

stormbot
Автор

two decades ago i played with opengl. this tutorial really helps me to get back to it.

andreaseversberg
Автор

Thank you so much man! I'm not new to programming, but I am new to graphics programming(GUI, OpenGL, etc.)  your tutorials really help.

patrickscott
Автор

Thanks for the tutorials, it will help me in the college.

AndersonOliveira-ysqr
Автор

SDL2 has stopped working? Any ideas. Photo height? bmp color space? 24bit? Idea?

CyanAquaTheHedgehog
Автор

What is the reason it is only working with 128x128 images.
How can we load any size and any type images?

AfnanAbdul
Автор

Once you generate the texture with glTexImage2D() you can free the SDL surface as it is no longer needed (openGL copies the image to a texture format in video memory, the original image can be cleared after that). Otherwise the original image is sitting around wasting memory until the program exits.

Also, you're going to want to initialize your textures in a separate function, outside of the main loop.

NeilRoy
Автор

am i the only one that isn't able to find the image.bmp file on his website? If so, could someone provide me with a link? Thanks

reijerboodt
Автор

Hi, and thanks for your shared knowledge.
I don't know why, but when I execute the .exe file generated after compilation, the window appears, and so does the square surface inside it, but instead of containing the ''image.bmp'' picture, it's plan white. Could it be some rendering issue?

andreacappuccio
Автор

When i build and run this code, it is just a white screen and then crashes and says 'SDL2Game.exe has stopped working'
any help please guys? :/

RubixiamGaming
Автор

in linker settings you write -lmingw32 -lSDL2main -lSDL2 -lOpenGL32 -lglu32, don't you?

PhucTran-hxdk
Автор

lol, when I display the bitmap the background color of it is actually inverted...
So my image is blue bg with black text on it.
In the window it is orange bg with black text on it... WTF!?

DasCapschen
Автор

Because the SDL needs a console application to program with
the .exe from the release/debug build always closes right after I clicked it.
How can.I avoid that?(:

Termimaxor
Автор

'SDL2Game.exe has stopped working' how is this fixed? thanks

anng
Автор

I may or may not sound like an dick now, but. Why can't you explain what all that code you pasted in the first episode? If I want to learn how to make a SDL program, I think it's PRETTY IMPORTANT to learn how to make a screen. I think I shuould learn all of that before I learn about loading images. Is there any reason why you didn't teach us that?

kallebanan
welcome to shbcf.ru