Search code examples
javaopengltexture2d

glEnable(GL_TEXTURE_2D); Does not feel like working.... :(


So, I'm trying to apply a texture to my quad. So i wrote this line of code : (line 35 in Artist.java)

glEnable(GL_TEXTURE_2D);

Which gave me this error :

GL_TEXTURE_2D cannot be resolved to a variable

I have these imports : (Hitting CTRL+SHIFT+O did not do anything)

import static org.lwjgl.opengl.GL11.GL_MODELVIEW;
import static org.lwjgl.opengl.GL11.GL_PROJECTION;
import static org.lwjgl.opengl.GL11.GL_QUADS;
import static org.lwjgl.opengl.GL11.glBegin;
import static org.lwjgl.opengl.GL11.glEnd;
import static org.lwjgl.opengl.GL11.glLoadIdentity;
import static org.lwjgl.opengl.GL11.glMatrixMode;
import static org.lwjgl.opengl.GL11.glOrtho;
import static org.lwjgl.opengl.GL11.glVertex2f;

import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;

I'm using Java, Eclipse, Mars. Anyone know why it won't work? :)


Solution

  • glEnable( GL_TEXTURE_2D) is a directive to the fixed-function pipeline's shader generator that you want to include code to support that texture unit

    So if you use a modern opengl which has custom shaders, its option won't work ,and you won't need it.