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 - shmex

#1
Support / Re: Only texture color is 3D object.
September 12, 2014, 11:11:21 PM
Сuriously...

Blender settings mapping:
coordinates: Generated
Projection   : Cube
#2
Support / Only texture color is 3D object.
September 11, 2014, 08:22:13 PM
Hello.
Why does picture of a texture is not displayed and all that displayed is a color of texture? 3Ds file is exported from Blender.

public class OneGraphics {

    private World world;
    private FrameBuffer buffer;
    private Object3D model;
    private String[] textures = {"OrnamentBorder0196_9_S"};
    //InputStream inputstream = new FileInputStream("/home/shmex/dddd.png");
   
    public static void main(String[] args) throws Exception{
    new OneGraphics().loop();
    }
   
    public OneGraphics() throws Exception {
       
        world = new World();
        world.setAmbientLight(200, 200, 200);
        //загрузка текстуры
       // Image image = ImageIO.read(new File("/home/***/ff.png"));
        //Texture tex = new Texture(image);
       
        TextureManager.getInstance().addTexture("trd.jpg", new Texture("/home/***/trd.jpg"));
        //TextureManager.getInstance().addTexture("Wood_Che.jpg", new Texture("/home/***/Wood_Che.jpg"));
        //загрузка модели
        model = loadModelfrom3DS("/home/shmex/rr.3ds", 2.5f);
       
        world.addObject(model);
        world.getCamera().setPosition(-10, 10, -10);
        world.getCamera().lookAt(model.getTransformedCenter());
       
    }
   
    private void loop() throws Exception {
       
        buffer = new FrameBuffer(800, 600, FrameBuffer.SAMPLINGMODE_NORMAL);
        buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
        buffer.enableRenderer(IRenderer.RENDERER_OPENGL); 

        while (!org.lwjgl.opengl.Display.isCloseRequested()) {
           
            model.rotateX(0.01f);
            buffer.clear(java.awt.Color.BLUE);
            world.renderScene(buffer);
            world.draw(buffer);
            buffer.update();
            buffer.displayGLOnly();
            Thread.sleep(10);
        }
       
        buffer.disableRenderer(IRenderer.RENDERER_OPENGL);
        buffer.dispose();
        System.exit(0);
    }
   
    private Object3D loadModelfrom3DS(String filename, float scale) {
        Object3D temp = null;
        Object3D[] file = Loader.load3DS(filename, scale);
       
        if (file.length==1) {
            temp=file[0];
            temp.setTexture("trd.jpg");
            temp.setTransparency(2);
            temp.setCulling(Object3D.CULLING_DISABLED);
            temp.rotateX(-(float)Math.PI/2f);
            temp.rotateMesh();
            temp.setRotationMatrix(new Matrix());
            temp.setAdditionalColor(new Color(100,100,100));
            temp.build();
        }
        return temp;
    }

output:

Loading Texture.../trd.jpg
Loading file /home/shmex/rr.3ds
File /home/shmex/rr.3ds loaded...476 bytes
Processing new material Material!
Processing object from 3DS-file: Cube
Object 'Cube_jPCT0' created using 12 polygons and 8 vertices.
Java version is: 1.7.0_65
-> support for BufferedImage
Version helper for 1.5+ initialized!
-> using BufferedImage
Software renderer (OpenGL mode) initialized
Software renderer disposed
Running on Linux with a 32bit color setting...adjusting to 24bit instead!
Current mode:800 x 600 x 24 @63Hz
Driver is: unknown OpenGL driver on NVIDIA Corporation / GeForce 7300 GT/PCIe/SSE2
GL_ARB_texture_env_combine supported and used!
FBO supported and used!
VBO supported and used!
OpenGL renderer initialized (using 4 texture stages)
New WorldProcessor created using 1 thread(s) and granularity of 1!
Creating new world processor buffer for thread main
OpenGL renderer disposed
Visibility lists disposed!