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.

Topics - chocoman

Pages: [1]
Support / rendered image is mirrored
« on: December 08, 2017, 08:21:03 pm »

it seems that when a scene is rendered, the resulting image is flipped left to right. I need to render the scene without this flipping.

see the modified code of the HelloWorld example below, which demonstrates this. The rendered screen is attached The expected rendered image would have a small box to the right from the big box, but in the rendered image the small box is to the left.

I tried to achieve this by modifying the camera matrix: I multiplied the first row by -1. This flipped the scene correctly, but the textures were "inside-out", The textures facing the camera were not visible, but the textures on the other side of the object were visible.

Is there any solution to this problem?

Thank you,

import com.threed.jpct.*;
import javax.swing.*;
import java.awt.*;

 * A simple HelloWorld using the AWTGL-Renderer and rendering into a frame.
 * @author EgonOlsen
public class HelloWorldAWTGL {

   private World world;
   private FrameBuffer buffer;
   private Object3D box;
   private JFrame frame;

   public static void main(String[] args) throws Exception {
      new HelloWorldAWTGL().loop();

   public HelloWorldAWTGL() throws Exception {
      frame=new JFrame("Hello world");
      frame.setSize(800, 600);
      world = new World();
      world.setAmbientLight(0, 255, 0);

      TextureManager.getInstance().addTexture("box", new Texture("box.jpg"));

      box = Primitives.getBox(13f, 2f);
      Object3D smallbox = Primitives.getBox(5f, 2f);
      smallbox.translate(new SimpleVector(30,0,0));  // moving the small box to the right

      world.getCamera().setPosition(0, 0, 200); // camera in front of both boxes

   private void loop() throws Exception {
      buffer = new FrameBuffer(800, 600, FrameBuffer.SAMPLINGMODE_NORMAL);
      Canvas canvas=buffer.enableGLCanvasRenderer();

      while (frame.isShowing()) {

Pages: [1]