Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8886843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:39:26+00:00 2026-06-14T21:39:26+00:00

For some reason enabling alpha blending results in me not being able to draw

  • 0

For some reason enabling alpha blending results in me not being able to draw run-of-the-mill coloured shapes. The order in which everything is drawn makes no difference. Even if the only thing being drawn is the coloured shape, it still won’t show.

Disabling alpha blending fixes this, but disables alpha blending (obviously). This leads me to believe the problem is in how I’m initializing openGL.

The textured objects are contained in the world, which is commented out. Commenting “world.run();” out makes no difference, only disabling alpha blending does.

public class Core {

int width=800, height=600;

//World world;

public void Start(){

    try {
        Display.setDisplayMode(new DisplayMode(width,height));
        Display.create();
    } catch (LWJGLException e) {
        e.printStackTrace();
        System.exit(0);
    }

    initGL();
    System.out.println("OpenGL version: " + GL11.glGetString(GL11.GL_VERSION));

    boolean Close = Display.isCloseRequested();

    //world = new World(width, height);

    while(!Close){
        GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

        if(Keyboard.isKeyDown(Keyboard.KEY_ESCAPE) || Display.isCloseRequested())
            Close = true;


        //world.run();
        GL11.glColor4d(1, 0, 0, 1);
        GL11.glBegin(GL11.GL_QUADS);
        GL11.glVertex2d(0, 0);
        GL11.glVertex2d(0, 50);
        GL11.glVertex2d(50, 50);
        GL11.glVertex2d(50, 0);
        GL11.glEnd();

        Display.update();
        //Display.sync(60);
    }

}

public void initGL(){
    GL11.glEnable(GL11.GL_TEXTURE_2D);               

    GL11.glClearColor(1.0f, 1.0f, 1.0f, 0.0f);          

        // enable alpha blending
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

        GL11.glViewport(0,0,width,height);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(0, width, height, 0, 1, -1);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
}

public static void main(String args[]){
    Core m = new Core();
    m.Start();
}

}

This is for a 2D app where I’m trying to draw metaballs behind the texture of a black-and-white world map.

Run-of-the-mill coloured shapes refers to the following,

GL11.glColor4d(1, 0, 0, 1);
GL11.glBegin(GL11.GL_QUADS);
    GL11.glVertex2d(0, 0);
    GL11.glVertex2d(0, 50);
    GL11.glVertex2d(50, 50);
    GL11.glVertex2d(50, 0);
GL11.glEnd();

Even if drawn on its own, as long as alpha blending is enabled, it won’t show up.

UPDATE:
The constructor for world was loading (but not drawing) a texture. Removing that part of the code lets the coloured square show up. I have deduced that the problem will occur as long as a texture is loaded, regardless of whether it is displayed or not.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T21:39:27+00:00Added an answer on June 14, 2026 at 9:39 pm

    You’ve got glEnable(GL_TEXTURE_2D) in initGL, but I don’t see it disabled anywhere.

    You know you have to disable texturing if you want to draw an untextured object, right?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason the duration works, but not the animation. Also wasn't able to
For some reason beyond me my html page is not finding my stylesheet. I'm
For some reason today my Android project is not loading up correctly in Eclipse.
For some reason the following code is not importing the image correctly and displaying
For some reason, the values from the gridView aren't being saved from the Bundle.
For some reason the LoadContent method does not get called in my Components. For
For some reason with Safari, but not other browsers, a jPlayer playlist doesn't advance
For some reason the Joomla docs are not very friendly to people that don't
For some reason, this works in all major browsers, but not IE (surprise, surprise).
For some reason the text (Log In) inside the HeadLoginView in ASP.NET is being

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.