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.

Messages - 3DLover

Pages: [1]
Support / Re: side-by-side 3D model Viewer and Comparator
« on: November 30, 2015, 10:06:48 pm »
Thanks for introducing NPOT-Textures. I am glad to have that option in Android. it is useful for my work.

Ok, about my main question, thanks to "Hello World" program Now I am able to load my own .obj and its texture. I can rotate my Model too. I use these codes for that purpose:


Now I want to go to next step: RenderTarget
but I have a question before coding; when you say "In the end, you have two scenes of two different models rendered into two different textures", what Should I do in order to join those two scenes so they create a side-by-side look?
I assume that the key action for joining two scenes is inside the blit function parameters, right?

Support / Re: side-by-side 3D model Viewer and Comparator
« on: November 30, 2015, 09:03:40 pm »
I exactly want it for Android, but i assumed that maybe it's easier for me as a "new user of  JPCT" to firstly do the whole process on Desktop and then going to Android

I hope there would be a slight amount of required changes when converting the "desktop code" to "Android code"

Support / side-by-side 3D model Viewer and Comparator
« on: November 30, 2015, 07:23:42 pm »
Hey friends,

I am a new user of JPCT. I had a topic some month later:,4379.msg30466.html#msg30466

in that topic, I was going to develop a "side-by-side 3D model viewer". (please see the attached image); two models should be placed side-by-side and I want those similar models rotate simultaneously around their axis As I drag the mouse to left or right.

Now I need to know how to start. I have developed a simple 3d model viewer thanks to JPCT and helps of Dear EgonOlsen.

But I do not have enough knowledge to continue the project. for example based on the recommendation of EgonOlsen I tried to understand blitting (topic mentioned above), but I couldn"t understand what does that function really do and what's the relation to side by side viewing the models!!:(

Please help me.

Support / Re: new JPCT user - receiving error in the first steps
« on: May 16, 2015, 04:03:49 pm »
Thank you.
another question, color of world  and background is black. how can I change it?

Support / Re: new JPCT user - receiving error in the first steps
« on: May 15, 2015, 01:27:53 pm »
Thanks for code snippet explaining rotation of objects using mouse events.
my specific questions are:
#1 - when creating a world and then a camera, what is the default position of camera in the world?
#2 - when loading an .obj mesh, does jPCT place the model in its default position which was used while creating the model? (whilst designing the model, it could have a desired distance from 0,0,0)
#3 - why do we have to use third line in the below code?

        Camera cam=world.getCamera();
        cam.moveCamera(Camera.CAMERA_MOVEUP, distance);
 -->  cam.rotateCameraX((float)Math.PI/2f);

================code for roatting object using mouse========
import com.threed.jpct.*;
import com.threed.jpct.util.*;
import org.lwjgl.opengl.*;
import org.lwjgl.input.*;

 * A Simple demo for mouse-powered object viewing.
 * It offers two modes: Camera around object (default) and object "around" camera.
public class GoogleCube {

    private static float distance=50;

    // If true, the object transforms related to the camera. If false, the camera to the object.
    private static boolean affectObject=false;

    public static void main(String[] args) throws Exception {
        World world=new World();
        FrameBuffer buffer=new FrameBuffer(640, 480, FrameBuffer.SAMPLINGMODE_HARDWARE_ONLY);
        Object3D cube=Primitives.getSphere(15);
        Camera cam=world.getCamera();
        cam.moveCamera(Camera.CAMERA_MOVEUP, distance);
        world.setAmbientLight(100, 100, 100);
        Light light=new Light(world);
        light.setIntensity(0, 0, 255);
        light.setPosition(new SimpleVector(-100, 0, 0));


        while (!Display.isCloseRequested() && !Mouse.isButtonDown(1)) {

            int x=Mouse.getDX();
            int y=Mouse.getDY();
            int w=Mouse.getDWheel();

            if (Mouse.isButtonDown(0)) {
                SimpleVector line=new SimpleVector(x, 0, y);
                Matrix m=line.normalize().getRotationMatrix();
                if (affectObject) {
                    // Object "around" camera
                    cube.rotateAxis(m.getXAxis(), line.length() / 200f);
                } else {
                    // Camera around object
                    m.rotateAxis(m.getXAxis(), (float) -Math.PI/2f);
                    cam.moveCamera(Camera.CAMERA_MOVEIN, distance);
                    cam.rotateAxis(m.invert3x3().getXAxis(), line.length() / 200f);
                    cam.moveCamera(Camera.CAMERA_MOVEOUT, distance);
            if (w!=0) {
               float d=w/200f;
                if (affectObject) {
                    cube.translate(0, -d, 0);
                } else {
                    cam.moveCamera(Camera.CAMERA_MOVEIN, d);



Support / Re: new JPCT user - receiving error in the first steps
« on: May 14, 2015, 11:32:17 pm »
Thanks a lot for your help!!

I could just finish a program which loads my .OBJ mesh and its texture using jPCT.

Now I want to be able to rotate the model using mouse drag event. I want the model to be only rotated around y axis as mouse is dragged on the screen by user.
Could you please give me a clue to start it?

Many thanks,

yes, both models are different meshes. very similar to each other but with some differences.
I think I understand your third and best solution for dual view. (blit method)
maybe there is another method that I am not sure about that. when we rotate an object in 3D space, I think we are usually rotating the camera rather than the object itself. what about rotating the object in this case?
I don't know if JPCT supports conditions described below:
- using one world.
- loading two meshes and their textures and placing them with a predefined distance between them.
- creating two cameras each one looking at one of the meshes.
- rotating the meshes around their own central axis as user drags the mouse or touches his finger.
- having output of two view-ports each one coming from each camera.
- placing the outputs side by side in realtime

what is your idea about this flowchart? does JPCT have such abilities or I am far away from available methods?


Support / Re: new JPCT user - receiving error in the first steps
« on: May 14, 2015, 03:16:34 pm »
Dear EgonOlsen,

you were right. my graphic Chipset was not updated by official Intel driver. I updated it and problem solved!
I just created my first hello world program. a cube started dancing in a 800*600 window. many thanks for your help.
My next project is loading a specific .obj mesh and its texture in this window.
do you have any clue how to start it. I got familiar with JAVA and now I want to know available techniques and methods in JPCT. I think I have to read wiki first?


Support / new JPCT user - receiving error in the first steps
« on: May 14, 2015, 11:43:06 am »
Hi guys,

in the first steps of coding a Java program which uses JPCT, I encounter this error, could you help me please?
machine: Laptop Sony VAIO VGN-FW 190
Display Adapter: Mobile Intel(R) 45 Express Chipset family (Microsoft Corporation WDDM 1.1)
my graphics drivers are up to date.
I am waiting for help of one of JPCT forum users and maybe changing the current IDE from Netbeans to Eclipse. but I do not think this error depends on the current IDE I am using.
[ Thu May 14 13:59:44 IRDT 2015 ] - ERROR: File 'box.jpg' not found - replacement texture used instead!
Java version is: 1.8.0_25
-> support for BufferedImage
Version helper for 1.5+ initialized!
-> using BufferedImage
Software renderer (OpenGL mode) initialized
Software renderer disposed
Current mode:800 x 600 x 32 @59Hz
[ Thu May 14 13:59:44 IRDT 2015 ] - WARNING: ZBuffer depth of 24 not supported - trying something else now...!
[ Thu May 14 13:59:44 IRDT 2015 ] - WARNING: Does this machine actually support OpenGL? Trying everything at lowest settings now!
Driver is unknown!
[ Thu May 14 13:59:44 IRDT 2015 ] - ERROR: Unable to set any valid videomode on this machine!
[ Thu May 14 13:59:44 IRDT 2015 ] - ERROR: Can't set videomode - try different settings!
org.lwjgl.LWJGLException: Pixel format not accelerated
   at org.lwjgl.opengl.WindowsPeerInfo.nChoosePixelFormat(Native Method)
   at org.lwjgl.opengl.WindowsPeerInfo.choosePixelFormat(
   at org.lwjgl.opengl.WindowsDisplay.createWindow(
   at org.lwjgl.opengl.Display.createWindow(
   at org.lwjgl.opengl.Display.create(
   at org.lwjgl.opengl.Display.create(
   at com.threed.jpct.GLHelper.init(
   at com.threed.jpct.GLRenderer.init(
   at com.threed.jpct.FrameBuffer.enableRenderer(
   at com.threed.jpct.FrameBuffer.enableRenderer(
   at com.threed.jpct.FrameBuffer.enableRenderer(
   at Reza.main(
BUILD SUCCESSFUL (total time: 5 seconds)

Dear EgonOlsen,
Thanks for your helps me a lot.

First, in the answer to your question, I want both Android and Windows-based applications. Since I am new to Java and JPCT and am a little afraid of Android, I decided first complete the Windows-based application then starting the more important application in Android. (Android app is the main program I want and I plan to rotate both models using only one touch of finger rather than mouse movement).
I don't know maybe I could complete the Android application first and then run that Android application in Windows using some emulator or players, I don't know, do you have any opinion?

Second, I have an IDE called "Netbeans" with my JDK and now I have both "Netbeans" and "Eclipse". What IDE should I use?

Third, You mentioned a very important point about camera perspective. before you said about this, I was thinking to load both models side-by-side and in ONE environment. But as you said, using one environment for both models, causes a little difference in view angle of each model and I don't want that. I want both models to look the same as far as it is possible. therefore, Now I have to change the plan and use two separated 3d spaces (two separated border-less windows) each one loading one of the models. what's your idea, is this possible?

Fourth, Here rises another question. is it possible to have two separated 3d worlds and rotate them simultaneously using only one finger touch (or one mouse drag)?

Many thanks for your help.

Dear EgonOlsen,

You are right, what I asked was JAVA basics and I started learning JAVA right now. I will learn the JAVA basics and then I will come back here for question about JPCT. now my specific questions are:

- Please see attached picture. I want to have a program like the attached picture at the end. it is a side by side model viewer. when I rotate the space I want two models rotate simultaneously and harmonically. in other meaning, I want to have two models loaded side-by-side with the same zoom and rotational reactions to the mouse events. Can I develop and create this type of viewer at the end using JPCT? am I in the right place at all?
- I understand that I should use eclipse IDE for JAVA development. Is eclipse IDE a proper tool for my goal described above? Am I going the right way at all?

Many thanks for your help.
Best regards,

Support / new to JAVA and JPCT - how to create a 3d model viewer?
« on: May 13, 2015, 11:54:37 am »
Hi guys,
I am new to JAVA but have done programming and coding in VB and c#.
I want to create a simple windows-based application for loading, viewing and rotating 3d models with textures.
How should I do that using JPCT?
I have downloaded and installed JDK and Netbeans. how should I start? the Netbeans environment is very different from VB environment. moreover the JPCT wiki has some explanations that I don't understand. for example:

"The 3D engine itself is one jar only (jpct.jar). It can be found in the distribution's lib-directory. Just include that jar into your classpath and you are ready to compile and/or run jPCT applications."
what is classpath?

please give me a clue to start.
Many thanks

Pages: [1]