Skip to content
This repository was archived by the owner on May 7, 2024. It is now read-only.

Textures

Samuel Rasquinha edited this page Jun 17, 2020 · 3 revisions

What are Textures ?

Textures are raw image data that can be taken from a .png or .jpg file. It creates a GL_TEXTURE_2D from that raw image data and has a Texture ID that can be used to render images on the screen.

Textures are taken in by Sprites.

An important note

Since Textures call OpenGL functions, OpenGL and the window need to be initialized before calling those functions. Hence you cannot create Textures before the construction of the derived Game class.

Alternatives

  • To have textures in the derived Game class, use Texture* (Texture Pointers)
  • You can do it after construction of the derived class.

DemoGame game_1; And then create it like this : Texture my_texture("MyTexture.png")

Clone this wiki locally