Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
added 1 characters in body
Source Link
ChocoMan
  • 743
  • 8
  • 30

I currently have one texture on a gluSphere that represents the Earth being displayed perfectly, but having trouble figuring out how to implement a bumpmap as well. The bumpmap resides in "res/planet/earth/earthmap1kearthbump1k.jpg".Here is the code I have for the regular texture:

    gl.glTranslatef(xPath, 0, yPath + zPos);
    gl.glColor3f(1.0f, 1.0f, 1.0f); // base color for earth
    
    earthGluSphere = glu.gluNewQuadric();
    
    colorTexture.enable(); // enable texture
    colorTexture.bind(); // bind texture
    
    // draw sphere...
    glu.gluDeleteQuadric(earthGluSphere);
    colorTexture.disable();

// texturing 
public void loadPlanetTexture(GL2 gl)
{
    InputStream colorMap = null;
    
    try
    {
        colorMap = new FileInputStream("res/planet/earth/earthmap1k.jpg");
        TextureData data = TextureIO.newTextureData(colorMap, false, null);
        colorTexture = TextureIO.newTexture(data);
        colorTexture.getImageTexCoords();
        colorTexture.setTexParameteri(GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
        colorTexture.setTexParameteri(GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_NEAREST);
        colorMap.close();
    }
    catch(IOException e)
    {
        e.printStackTrace();
        System.exit(1);
    }
    // Set material properties 
    gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
    gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_NEAREST);
    
    colorTexture.setTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_S);
    colorTexture.setTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_T); 
}

How would I add the bumpmap as well to the same gluSphere?

I currently have one texture on a gluSphere that represents the Earth being displayed perfectly, but having trouble figuring out how to implement a bumpmap as well. The bumpmap resides in "res/planet/earth/earthmap1k.jpg".Here is the code I have for the regular texture:

    gl.glTranslatef(xPath, 0, yPath + zPos);
    gl.glColor3f(1.0f, 1.0f, 1.0f); // base color for earth
    
    earthGluSphere = glu.gluNewQuadric();
    
    colorTexture.enable(); // enable texture
    colorTexture.bind(); // bind texture
    
    // draw sphere...
    glu.gluDeleteQuadric(earthGluSphere);
    colorTexture.disable();

// texturing 
public void loadPlanetTexture(GL2 gl)
{
    InputStream colorMap = null;
    
    try
    {
        colorMap = new FileInputStream("res/planet/earth/earthmap1k.jpg");
        TextureData data = TextureIO.newTextureData(colorMap, false, null);
        colorTexture = TextureIO.newTexture(data);
        colorTexture.getImageTexCoords();
        colorTexture.setTexParameteri(GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
        colorTexture.setTexParameteri(GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_NEAREST);
        colorMap.close();
    }
    catch(IOException e)
    {
        e.printStackTrace();
        System.exit(1);
    }
    // Set material properties 
    gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
    gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_NEAREST);
    
    colorTexture.setTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_S);
    colorTexture.setTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_T); 
}

How would I add the bumpmap as well to the same gluSphere?

I currently have one texture on a gluSphere that represents the Earth being displayed perfectly, but having trouble figuring out how to implement a bumpmap as well. The bumpmap resides in "res/planet/earth/earthbump1k.jpg".Here is the code I have for the regular texture:

    gl.glTranslatef(xPath, 0, yPath + zPos);
    gl.glColor3f(1.0f, 1.0f, 1.0f); // base color for earth
    
    earthGluSphere = glu.gluNewQuadric();
    
    colorTexture.enable(); // enable texture
    colorTexture.bind(); // bind texture
    
    // draw sphere...
    glu.gluDeleteQuadric(earthGluSphere);
    colorTexture.disable();

// texturing 
public void loadPlanetTexture(GL2 gl)
{
    InputStream colorMap = null;
    
    try
    {
        colorMap = new FileInputStream("res/planet/earth/earthmap1k.jpg");
        TextureData data = TextureIO.newTextureData(colorMap, false, null);
        colorTexture = TextureIO.newTexture(data);
        colorTexture.getImageTexCoords();
        colorTexture.setTexParameteri(GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
        colorTexture.setTexParameteri(GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_NEAREST);
        colorMap.close();
    }
    catch(IOException e)
    {
        e.printStackTrace();
        System.exit(1);
    }
    // Set material properties 
    gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
    gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_NEAREST);
    
    colorTexture.setTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_S);
    colorTexture.setTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_T); 
}

How would I add the bumpmap as well to the same gluSphere?

Source Link
ChocoMan
  • 743
  • 8
  • 30

problem adding bumpmap to textured gluSphere in JOGL

I currently have one texture on a gluSphere that represents the Earth being displayed perfectly, but having trouble figuring out how to implement a bumpmap as well. The bumpmap resides in "res/planet/earth/earthmap1k.jpg".Here is the code I have for the regular texture:

    gl.glTranslatef(xPath, 0, yPath + zPos);
    gl.glColor3f(1.0f, 1.0f, 1.0f); // base color for earth
    
    earthGluSphere = glu.gluNewQuadric();
    
    colorTexture.enable(); // enable texture
    colorTexture.bind(); // bind texture
    
    // draw sphere...
    glu.gluDeleteQuadric(earthGluSphere);
    colorTexture.disable();

// texturing 
public void loadPlanetTexture(GL2 gl)
{
    InputStream colorMap = null;
    
    try
    {
        colorMap = new FileInputStream("res/planet/earth/earthmap1k.jpg");
        TextureData data = TextureIO.newTextureData(colorMap, false, null);
        colorTexture = TextureIO.newTexture(data);
        colorTexture.getImageTexCoords();
        colorTexture.setTexParameteri(GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
        colorTexture.setTexParameteri(GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_NEAREST);
        colorMap.close();
    }
    catch(IOException e)
    {
        e.printStackTrace();
        System.exit(1);
    }
    // Set material properties 
    gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
    gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_NEAREST);
    
    colorTexture.setTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_S);
    colorTexture.setTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_T); 
}

How would I add the bumpmap as well to the same gluSphere?