Jump to content
  • Advertisement
Sign in to follow this  

OpenGL OpenGL (lwjgl) wont disable texturing

This topic is 2091 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts



I come from a background of XNA and some DX9 programming and I'm trying to learn some more about OpenGL. Im currently making a JavaXNA port to make my life easier.


The problem I'm having is that OpenGL wont disable texturing with GL11.glDisable(GL11.GL_TEXTURE_2D);

I'm recreating spritebatch and this is how I draw a texture:


	public void DrawTexture2D(Texture2D Texture,int x, int y, int width,int height)
		y = Game.graphics.PreferredBackBufferHeight - height;
		GL11.glBindTexture(GL11.GL_TEXTURE_2D, Texture.ID);
                GL11.glColor3f(1.0F, 1.0F, 1.0F);
                GL11.glTexCoord2f(0.0F, 1.0F); GL11.glVertex2f(x, y);
                GL11.glTexCoord2f(0.0F, 0.0F); GL11.glVertex2f(x, y + height);
                GL11.glTexCoord2f(1.0F, 0.0F); GL11.glVertex2f(x + width, y + height);
                GL11.glTexCoord2f(1.0F, 1.0F); GL11.glVertex2f(x + width, y);


And then after it, I simply want to draw a colored rectangle like so:


	public void DrawRect(int x, int y,int width,int height,Color Color)
		y = Game.graphics.PreferredBackBufferHeight - height;
                GL11.glColor3f(Color.r,Color.g,Color.b);  GL11.glVertex2f( x, y);
                GL11.glColor3f(Color.r,Color.g,Color.b);  GL11.glVertex2f( x, y + height);
                GL11.glColor3f(Color.r,Color.g,Color.b);  GL11.glVertex2f(x + width, y + height);
                GL11.glColor3f(Color.r,Color.g,Color.b);  GL11.glVertex2f(x + width, y);


But even though I told OpenGL to disable texturing twice, the plain rectangle still has the texture that was used before. (just doesn't have texture coords)


This is what its supposed to look like:


But when a texture is drawn, it looks like this:



Any ideas?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!