SilverTiger / lwjgl3-tutorial

Tutorial for the Lightweight Java Game Library (LWJGL) 3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can you resize a texture?

tgodoib opened this issue · comments

I am having some issues trying to resize and image, i tryed to use the glScalef but it gives this error: A function that is not available in the current context was called.
Should I use this function? And so how and where do I use it?

glScale can only be used with deprecated OpenGL. In the modern way you have to multiply a scale matrix, when creating the MVP matrix, e.g. by using a scale matrix instead of the identity matrix as model matrix. But this would scale the whole screen.

For scaling a single object you just have to change the width and height of that object to your desired size. The texture coordinates remain unchanged.