Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - sokobozz

#1
Support / Re: noob question: texture mapping
January 08, 2010, 07:55:10 PM
That's it......

Thx!
#2
Support / noob question: texture mapping
January 08, 2010, 07:09:19 PM
Hi!

All best in new 2010.


I am trying to play with adding triangle and applying texture on Object3D, but currenty I can't see that my texture is apllied.

Here is result:


Here is texture:



import java.awt.Color;

import com.threed.jpct.FrameBuffer;
import com.threed.jpct.IRenderer;
import com.threed.jpct.Object3D;
import com.threed.jpct.SimpleVector;
import com.threed.jpct.Texture;
import com.threed.jpct.TextureManager;
import com.threed.jpct.World;

public class Template {

  /**
   * @param args
   * @throws InterruptedException
   */
  public static void main(String[] args) throws InterruptedException {
    Template.setupAndRun();
  }

  private static void setupAndRun() throws InterruptedException {

    TextureManager tm = TextureManager.getInstance();
    String texName = "tex3.jpg";
    Texture tex = new Texture(texName);
    tm.addTexture(texName, tex);
    int texID = tm.getTextureID(texName);

    Object3D obj1 = new Object3D(2);

    obj1.addTriangle(V(100, -100, 0), 0f, 0f, V(100, 0, 0), 0f, 1f, V(-100, 0, 0), 1f, 1f, texID);

    obj1.build();
    obj1.setEnvmapped(Object3D.ENVMAP_ENABLED);

    World world = new World();
    world.addLight(new SimpleVector(0, -50, 130), Color.WHITE);
    world.setAmbientLight(255, 255, 255);
    world.getCamera().setPosition(0, 0, 250);
    world.getCamera().lookAt(V(0, 0, 0));

    world.addObject(obj1);

    FrameBuffer buffer = new FrameBuffer(800, 600, FrameBuffer.SAMPLINGMODE_NORMAL);
    buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
    buffer.enableRenderer(IRenderer.RENDERER_OPENGL);

    while (!org.lwjgl.opengl.Display.isCloseRequested()) {

      buffer.clear(java.awt.Color.BLACK);
      world.renderScene(buffer);
      world.draw(buffer);
      buffer.update();
      buffer.displayGLOnly();
      Thread.sleep(10);
    }
    buffer.disableRenderer(IRenderer.RENDERER_OPENGL);
    buffer.dispose();
    System.exit(0);

  }

  public static SimpleVector V(float x, float y, float z) {
    return new SimpleVector(x, y, z);
  }

}




No idea what is problem...
#3
I added more light and it's ok now.
Thanks.
#4
Well I already tried this, but no success on this. I get only black box(without my texture)!

so the part of code  is here:


      Texture red = new Texture(8,8, Color.RED);
      TextureManager.getInstance().addTexture("red", red);
      box = Primitives.getBox(10f, 1f);
      box.setTexture("red");
      box.setEnvmapped(Object3D.ENVMAP_ENABLED);
      box.build();

#5
Support / how to apply solid color on primitives
June 28, 2009, 10:38:51 AM
Hi!

Well I am new in java 3d. I look jpct demos and they look fantastic. I want to quick play with jpct but I have problem with applying simple solid color on primitives. I want to avoid creating textures in Gimp or Blender. Is this possible with jpct?