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

Pages: 1 [2] 3 4 5
16
Support / Re: Compiled dynamic objects
« on: April 22, 2010, 07:29:33 pm »
Hi,

I have just come from work was going to write it now, but I see you have already reproduced it.

Thanks,
Wojtek

17
Support / Compiled dynamic objects
« on: April 21, 2010, 10:54:44 pm »
Hey,

I am curious how to make compiled dynamic objects with custom vertex controller. I haven't found any example on forum or wiki about it, but documentation says that compile(true) method must be used to be able to modify vertexes and touch() method needs to be called everytime when they are changed.

I have created object in following way:
Code: [Select]
public Ray()
    {
super(4);

for (int i = 0; i < VERTEXES.length; ++i)
    vertexes[i] = new SimpleVector(VERTEXES[i]);

addTriangle(VERTEXES[HF1], 1, 1, VERTEXES[HT1], 1, 0, VERTEXES[HT2], 0, 0);
addTriangle(VERTEXES[HT2], 0, 0, VERTEXES[HF2], 0, 1, VERTEXES[HF1], 1, 1);
addTriangle(VERTEXES[VF1], 1, 1, VERTEXES[VT1], 1, 0, VERTEXES[VT2], 0, 0);
addTriangle(VERTEXES[VT2], 0, 0, VERTEXES[VF2], 0, 1, VERTEXES[VF1], 1, 1);

setCulling(Object3D.CULLING_DISABLED);
setLighting(Object3D.LIGHTING_NO_LIGHTS);
setTransparency(0);
build();
getMesh().setVertexController(new RayVertexController(),
    IVertexController.PRESERVE_SOURCE_MESH);
compile(true);
    }

and run periodically following method to change its shape:

Code: [Select]
public void initialize(SimpleVector from, SimpleVector to, double scale, Color color,
    int transparencyMode)
    {
setVertexes(from, to, (float) scale);
setAdditionalColor(color);
setTransparencyMode(transparencyMode);
getMesh().applyVertexController();
touch();
setCenter(SimpleVector.ORIGIN);
setOrigin(SimpleVector.ORIGIN);
getRotationMatrix().setIdentity();
setRotationPivot(SimpleVector.ORIGIN);
    }

Unfortunatelly I do not see any change on screen, ie. object is always displayed at it initial place (ie. first position that was set).

Is there anything more that needs to be set?

Thanks,
Wojtek

18
Support / Re: Displaying Object3D with VertexController and billboards
« on: April 21, 2010, 10:09:41 pm »
Thank you. Now it works much better :)

Wojtek

19
Support / Re: Displaying Object3D with VertexController and billboards
« on: April 21, 2010, 08:30:16 pm »
But why it works for not billboarded objects? Ie. when I comment out a following line
Code: [Select]
box.setBillboarding(true); the screen is rendered properly even if I set much bigger scale?

20
Support / Displaying Object3D with VertexController and billboards
« on: April 21, 2010, 01:22:30 am »
Hello,

Recently I have found strange behavior.
I have a class that allows me to create simple Rays. It uses VertexController to change ray dimensions which gives me possibility to reuse objects. I use it for laser or ship fumes effects.

Now I have other objects displayed as billboards - planets, stars etc.

I have noticed recently, that scaled billboard is displayed sometimes over the ray despite fact that ray is much closer to camera.

There are screensots of simple app where ray is from [-20,0,-3] to [0,-20,-3] and box of size (2,2) is located at [-150,-150,-40]:

The billboard does not have scale applied.

A scale is applied ( box.setScale(6); ).


Here is an example application:
//Test.java
Code: [Select]
import java.awt.BorderLayout;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JFrame;
import com.threed.jpct.Camera;
import com.threed.jpct.FrameBuffer;
import com.threed.jpct.IRenderer;
import com.threed.jpct.Object3D;
import com.threed.jpct.Primitives;
import com.threed.jpct.SimpleVector;
import com.threed.jpct.World;

public class Test extends JFrame implements Runnable
{
    private static final long serialVersionUID = 811111147457394977L;
    private World world;
    private FrameBuffer buffer;
    private Canvas myCanvas;
    private boolean alive = true;
    private boolean initialized = false;
    private Ray ray;
    private Object3D box;

    public static void main(String[] args)
    {
new Test();
    }

    public Test()
    {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
init();
pack();
setVisible(true);
    }

    public void init()
    {
world = new World();
ray = new Ray();

ray.initialize(new SimpleVector(-20, 0, -3), new SimpleVector(0, -20,
-3), 0.5, Color.YELLOW, Object3D.TRANSPARENCY_MODE_DEFAULT);
box = Primitives.getBox(2, 2);

box.setBillboarding(true);
box.setAdditionalColor(Color.WHITE);
box.setLighting(Object3D.LIGHTING_NO_LIGHTS);
box.setTransparency(0);
box.setTransparencyMode(Object3D.TRANSPARENCY_MODE_ADD);
box.setTransparency(255);
box.setScale(6);
box.build();
box.compile();
box.translate(-150, -150, -40);

world.addObject(ray);
world.addObject(box);

Camera camera = world.getCamera();
camera.setPosition(0, 0, 0);
camera.lookAt(box.getTransformedCenter());
world.setAmbientLight(100, 100, 100);

buffer = new FrameBuffer(640, 480, FrameBuffer.SAMPLINGMODE_GL_AA_4X);
buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);

myCanvas = buffer.enableGLCanvasRenderer();
add(myCanvas, BorderLayout.CENTER);
initialized = true;
new Thread(this).start();
    }

    @Override
    public void run()
    {
while (alive)
{
    this.repaint();
    try
    {
Thread.sleep(1000);
    }
    catch (InterruptedException e)
    {
    }
}
alive = false;
    }

    @Override
    public void paint(Graphics g)
    {
if (!initialized)
    return;
buffer.clear();
world.renderScene(buffer);
world.draw(buffer);
buffer.update();
buffer.displayGLOnly();
myCanvas.repaint();

    }
}

//Ray.java
Code: [Select]
public class Ray extends Object3D
{
    private static final long serialVersionUID = -1684665440334869826L;
    private static final SimpleVector YVEC = new SimpleVector(0, 1, 0);
    private static final SimpleVector ZVEC = new SimpleVector(0, 0, 1);
    private static int HF1 = 0;
    private static int HF2 = 1;
    private static int HT1 = 2;
    private static int HT2 = 3;
    private static int VF1 = 4;
    private static int VF2 = 5;
    private static int VT1 = 6;
    private static int VT2 = 7;
    private static SimpleVector[] VERTEXES = new SimpleVector[] {
    new SimpleVector(-1.5, -1.5, -1), new SimpleVector(-0.5, -0.5, -1),
    new SimpleVector(1.5, 1.5, -1), new SimpleVector(0.5, 0.5, -1),
    new SimpleVector(-1, -1, -1.5), new SimpleVector(-0.5, -0.5, -0.5),
    new SimpleVector(1.5, 1.5, 1.5), new SimpleVector(0.5, 0.5, 0.5) };
    private SimpleVector[] vertexes = new SimpleVector[VERTEXES.length];

    public Ray()
    {
super(4);

for (int i = 0; i < VERTEXES.length; ++i)
    vertexes[i] = new SimpleVector(VERTEXES[i]);

addTriangle(VERTEXES[HF1], 1, 1, VERTEXES[HT1], 1, 0, VERTEXES[HT2], 0,
    0);
addTriangle(VERTEXES[HT2], 0, 0, VERTEXES[HF2], 0, 1, VERTEXES[HF1], 1,
    1);
addTriangle(VERTEXES[VF1], 1, 1, VERTEXES[VT1], 1, 0, VERTEXES[VT2], 0,
    0);
addTriangle(VERTEXES[VT2], 0, 0, VERTEXES[VF2], 0, 1, VERTEXES[VF1], 1,
    1);

setCulling(Object3D.CULLING_DISABLED);
setLighting(Object3D.LIGHTING_NO_LIGHTS);
setTransparency(0);
build();
getMesh().setVertexController(new RayVertexController(),
    IVertexController.PRESERVE_SOURCE_MESH);
    }

    public void initialize(SimpleVector from, SimpleVector to, double scale, Color color,
    int transparencyMode)
    {
setVertexes(from, to, (float) scale);
setAdditionalColor(color);
setTransparencyMode(transparencyMode);
getMesh().applyVertexController();
setCenter(SimpleVector.ORIGIN);
setOrigin(SimpleVector.ORIGIN);
getRotationMatrix().setIdentity();
setRotationPivot(SimpleVector.ORIGIN);
    }

    private void setVertexes(SimpleVector from, SimpleVector to, float scale)
    {
scale /= 2;

SimpleVector diff = to.calcSub(from);
SimpleVector ya = SimpleVectorUtil.mul(
    diff.calcCross(YVEC).normalize(), scale);
SimpleVector za = SimpleVectorUtil.mul(
    diff.calcCross(ZVEC).normalize(), scale);

vertexes[HF1].set(from.x - ya.x, from.y - ya.y, from.z - ya.z);
vertexes[HF2].set(from.x + ya.x, from.y + ya.y, from.z + ya.z);
vertexes[HT1].set(to.x - ya.x, to.y - ya.y, to.z - ya.z);
vertexes[HT2].set(to.x + ya.x, to.y + ya.y, to.z + ya.z);
vertexes[VF1].set(from.x - za.x, from.y - za.y, from.z - za.z);
vertexes[VF2].set(from.x + za.x, from.y + za.y, from.z + za.z);
vertexes[VT1].set(to.x - za.x, to.y - za.y, to.z - za.z);
vertexes[VT2].set(to.x + za.x, to.y + za.y, to.z + za.z);
    }

    public SimpleVector convertVertex(SimpleVector vertex)
    {
for (int i = 0; i < VERTEXES.length; ++i)
    if (VERTEXES[i].equals(vertex))
return vertexes[i];
return vertex;
    }

    class RayVertexController extends GenericVertexController
    {
private static final long serialVersionUID = -3596694596175935772L;

@Override
public void apply()
{
    SimpleVector[] src = getSourceMesh();
    SimpleVector[] dst = getDestinationMesh();
    for (int i = 0; i < src.length; ++i)
    {
dst[i].set(convertVertex(src[i]));
    }
}
    }
}

//SimpleVectorUtil.java
Code: [Select]
public class SimpleVectorUtil
{

    public static SimpleVector mul(SimpleVector vec, float mul)
    {
vec.x *= mul;
vec.y *= mul;
vec.z *= mul;
return vec;
    }

    public static SimpleVector calcMul(SimpleVector vec, float mul)
    {
return mul(new SimpleVector(vec), mul);
    }
}

Is it a bug, or perhaps I have to set some additional parameters to have that working correctly?

Thanks,
Wojtek

21
Support / Re: FrameBuffer initialization
« on: April 21, 2010, 01:04:27 am »
Hello,

I am sorry that I haven't written for so long - I have not had time to look at it and prepare example.
Well the problem with NullPointer seems to be that what you have said in some posts earlier ie. to not share objects between different FrameBuffers:

Code: [Select]
import java.awt.BorderLayout;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JFrame;
import com.threed.jpct.FrameBuffer;
import com.threed.jpct.IRenderer;
import com.threed.jpct.Object3D;
import com.threed.jpct.Primitives;
import com.threed.jpct.SimpleVector;
import com.threed.jpct.World;

public class Test2 extends JFrame implements Runnable
{
    private static final long serialVersionUID = -1203822572518219468L;
    private World world;
    private FrameBuffer buffer;
    private Canvas canvas;
    private boolean initialized = false;
    private FrameBuffer buffer2;
    private Canvas canvas2;
    private World world2;
    private boolean alive = true;

    public static void main(String[] args)
    {
new Test2();
    }

    public Test2()
    {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
init();
pack();
setVisible(true);
    }

    private static World createWorld()
    {
World w = new World();
w.setAmbientLight(100, 100, 100);
w.getCamera().setPosition(new SimpleVector(200, 0, 0));
w.getCamera().lookAt(SimpleVector.ORIGIN);
return w;
    }

    public void init()
    {
world = createWorld();
world2 = createWorld();

Object3D BLUEPRINT = Primitives.getPyramide(10);
Object3D o1 = BLUEPRINT.cloneObject();
o1.compileAndStrip();
world.addObject(o1);
Object3D o2 = BLUEPRINT.cloneObject();
o2.compileAndStrip();
world2.addObject(o2);

buffer = createBuffer();
buffer2 = createBuffer();

add(canvas = buffer.enableGLCanvasRenderer(), BorderLayout.LINE_START);
add(canvas2 = buffer2.enableGLCanvasRenderer(), BorderLayout.LINE_END);
initialized = true;
new Thread(this).start();
    }

    private static FrameBuffer createBuffer()
    {
FrameBuffer buffer = new FrameBuffer(300, 300,
FrameBuffer.SAMPLINGMODE_GL_AA_4X);
buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
return buffer;
    }

    @Override
    public void run()
    {

while (alive)
{
    this.repaint();
    try
    {
Thread.sleep(1000);
    }
    catch (InterruptedException e)
    {
    }
}
alive = false;

    }

    private static void paint(FrameBuffer buffer, World world, Canvas canvas)
    {
buffer.clear(Color.BLACK);
world.renderScene(buffer);
world.draw(buffer);
buffer.update();
buffer.displayGLOnly();
canvas.repaint();
    }

    @Override
    public void paint(Graphics g)
    {
if (!initialized)
    return;
paint(buffer, world, canvas);
paint(buffer2, world2, canvas2);
    }
}

Everything is fine if o2 is added to first world. If it is added to world2, the mentioned exception is thrown.

Thanks,
Wojtek

22
Support / Re: FrameBuffer initialization
« on: March 21, 2010, 03:52:24 pm »
Quote
This one: http://www.jpct.net/download/beta/jpct.jar.
Thanks :)

Quote
About the excpetion...might be a problem with multiple threads working on the objects.
Hmm, the thread that sets the new Object3D to the world is called AWT-EventQueue-0 (this is a handler method for click on grid's row). The thread where an exception is thrown is also called the same, but eclipse debugger shows that this is another thread. I do not know AWT/swing much so I cannot say why I have multiple threads for that (perhaps because eclipse stopped threads that thrown an exception so AWT created another one?)... But I will try to investigate it a little bit more...

Quote
I'm not sure what the problem with sharing and stripping might be in your case. Any exceptions or something? In case of sharing, make sure that you are sharing with objects that live in the same context, i.e. not with the blue print object from your factory, because that will cause this object to be compiled using the gl context of the first objects that shares data with it...and all others will try to reuse it and that will work only if you are in the same context.
Oh ok, so this must occur because I am using one blueprint as a clone source for objects that belongs to different contexts.
The exception that I am getting when I do the sharing and stripping is:
Code: [Select]
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
Additional visibility list (2) created with size: 10000
at com.threed.jpct.CompiledInstance.fill(Unknown Source)
at com.threed.jpct.Object3DCompiler.compile(Unknown Source)
at com.threed.jpct.VersionHelper5.compile(Unknown Source)
at com.threed.jpct.World.renderScene(Unknown Source)
at game.ui.swing.components.jpct.JPCTPanel.renderContent(JPCTPanel.java:128)
at game.ui.swing.components.jpct.ShipFlightPanel.processBackground(ShipFlightPanel.java:157)
at game.ui.swing.views.gameWindow.FlightView.updateView(FlightView.java:74)
at game.ui.swing.views.GameWindowView.updateViews(GameWindowView.java:396)
at game.ui.swing.views.GameWindowView.access$4(GameWindowView.java:387)
at game.ui.swing.views.GameWindowView$6$1.run(GameWindowView.java:378)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
I will have to do a little bit bigger change to solve that, but anyway now it is working because I do not use those methods...

Thanks for help!
Wojtek

23
Support / Re: FrameBuffer initialization
« on: March 21, 2010, 01:37:50 pm »
Quote
Additionally, initialization has to happen in the paintGL-method of the renderer, so there's no way to do this beforehand, even if you are already in the EDT. However, it may be sufficient to skip the wait if we are already in the EDT. I've updated the jar in link a few posts ealier with a version that does this (hopefully).
Ok, I understand. In the meantime I have reduced the amount of reinitialization of the FrameBuffers on resize event, so now each canvas is initialzied only once. Additionally I noticed that the problem with waiting was related to the fact, that I was adding a new object to world (and run compile() on it) and reinitializing a FB in the same time (both operations were a result of the same event). Now I ensured that the canvas size is not changed in that time and now it seems to work ok.

Regarding to the link, I am not sure which one I should used - one from main page, or perhaps http://www.jpct.net/download/beta/jpct.jar.

Quote
BTW: Are you actually using the same objects multiple times in different views? I don't think that this will work if you are using display lists (what you do, juding from the log), because they are bound to the gl context which should be different in multiple canvas'. Or does it work anyway? I 'm just asking because i never really tried this...and hoped that nobody never will, so that i would never have to care about this case...
Quote
Looking at the code again, it might work with multiple contexts, because it tries to revert to normal vertex arrays in that case (which are somewhat slower, but not bound to the context). However, the current version might spam the log in that case. I've modified the jar again to prevent this (if it actually is a problem in your case).

My code is working in that way, that I am loading first all models, run build() and compile() and put them to "factory".
Next I am creating 3 views (with different FB, worlds, canvases etc).
When I want do display some objects, I run following method:
Code: [Select]
public Object3D createObject()
{
    Object3D result = object.cloneObject(); //it is the model
    result.compile();
    return result;
}
and adding object to specific world.
Is that a wrong concept?

I am not sharing objects between worlds, however I have noticed that sometimes (not all times) I receive exceptions like:
Code: [Select]
Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: java.lang.NullPointerException
at com.threed.jpct.AWTJPCTCanvas.paintGL(Unknown Source)
at org.lwjgl.opengl.AWTGLCanvas.paint(AWTGLCanvas.java:288)
at org.lwjgl.opengl.AWTGLCanvas.update(AWTGLCanvas.java:317)
at sun.awt.RepaintArea.updateComponent(Unknown Source)
at sun.awt.RepaintArea.paint(Unknown Source)
at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at com.threed.jpct.CompiledInstance.render(Unknown Source)
at com.threed.jpct.AWTGLRenderer.drawVertexArray(Unknown Source)
... 15 more


I am wondering also how to use shareCompiledData() and compileAndStrip() for my models - I was not able to do that without problems so far so I am not using it yet.

Thanks,
Wojtek

24
Support / Re: FrameBuffer initialization
« on: March 21, 2010, 12:50:36 am »
There is a bigger log:
Code: [Select]
Java version is: 1.6.0_17
-> support for BufferedImage
Version helper for 1.5+ initialized!
-> using BufferedImage
Software renderer (OpenGL mode) initialized
Using LWJGL's AWTGLCanvas
Software renderer disposed
[6 times]

Driver is: vga/6.0.6001.18000 on NVIDIA Corporation / GeForce 9650M GT/PCI/SSE2
GL_ARB_texture_env_combine supported and used!
FBO supported and used!
OpenGL renderer initialized (using 4 texture stages)
[3 times]

Software renderer disposed
Software renderer disposed
Software renderer disposed
Adding Lightsource: 1
Adding Lightsource: 2
Visibility lists disposed!
Java version is: 1.6.0_17
-> support for BufferedImage
Version helper for 1.5+ initialized!
-> using BufferedImage
Software renderer (OpenGL mode) initialized
Using LWJGL's AWTGLCanvas
Software renderer disposed
Waiting for renderer to initialize...0
[...]
Waiting for renderer to initialize...49
Subobject of object 15153/object15155 compiled using 612 vertices in 6ms!
Subobject of object 15153/object15155 compiled using 2 vertices in 0ms!
Object 15153/object15155 compiled to 2 subobjects in 2518ms!
Waiting for renderer to initialize...0
[...]
Waiting for renderer to initialize...49
Subobject of object 15154/object15156 compiled using 512 vertices in 1ms!
Object 15154/object15156 compiled to 1 subobjects in 2511ms!
Waiting for renderer to initialize...0
[...]
Waiting for renderer to initialize...49
Subobject of object 15177/object15179 compiled using 512 vertices in 1ms!
Object 15177/object15179 compiled to 1 subobjects in 2508ms!
Waiting for renderer to initialize...0
[...]
Waiting for renderer to initialize...49
Subobject of object 15200/object15202 compiled using 24 vertices in 0ms!
Object 15200/object15202 compiled to 1 subobjects in 2502ms!
Waiting for renderer to initialize...0
[...]
Waiting for renderer to initialize...49
Subobject of object 15201/object15203 compiled using 24 vertices in 0ms!
Object 15201/object15203 compiled to 1 subobjects in 2500ms!
Driver is: vga/6.0.6001.18000 on NVIDIA Corporation / GeForce 9650M GT/PCI/SSE2
GL_ARB_texture_env_combine supported and used!
FBO supported and used!
OpenGL renderer initialized (using 4 texture stages)
Compiled 6 display lists!
Software renderer disposed

Currently I have 3 panels where I am displaying 3d views, however I see much more initializations. I think it is because of layout dimensions calculation/change (I am creating a new FrameBuffer with new dimensions when container is resized) - the main view is extended to fit the screen for example, however I think I can improve that.

Quote
No, you can't initialize it when creating the FrameBuffer, because it has to happen in the awt event dispatch thread.
How about running that initialization from a method invoked in a awt event dispatch thread before displaying window?

Quote
This is what the object compiler has to wait for. To make it happen, it calls repaint() on the canvas and waits 50ms for this to happen.

Hmm, it may happen then because I am calling
Code: [Select]
world.renderScene(buffer); from awt event dispatch thread (a timer callback), so the compiler may wait for the same thread it is working in.

Thanks,
Wojtek

25
Support / Re: FrameBuffer initialization
« on: March 20, 2010, 09:08:00 pm »
Hello,

I am wondering if it is possible to force full initialization of AWTGLCanvas during construction FrameBuffer in mentioned code.

What happens now is that the game main window is displayed and when I show a JPanel that contains AWTGLCanvas for a first time, game freezes for some time before it shows something. I am using JTabbedPane so the canvases that I am using are not visible from the begining.
Now, I am using compiled objects (at least main ones), and noticed also a bunch of following messages:
Code: [Select]
Using LWJGL's AWTGLCanvas
Software renderer disposed
Waiting for renderer to initialize...0
Waiting for renderer to initialize...1
Waiting for renderer to initialize...2
[...]
Waiting for renderer to initialize...48
Waiting for renderer to initialize...49
Subobject of object 15129/object15131 compiled using 670 vertices in 1ms!

My question is if it is possible to force full initialization of renderers/canvases and make that before the main window is displayed (lets say in constructor of window or in some method that will be called before setVisible())?
The other question is how to avoid such messages?

Thanks,
Wojtek

26
Support / Re: FrameBuffer initialization
« on: March 15, 2010, 09:43:23 pm »
Works much better now - there is no error messages and I see AA working.
Thanks a lot!

Wojtek

27
Support / FrameBuffer initialization
« on: March 15, 2010, 08:21:53 pm »
Hello,

I would like to ask some questions related to FrameBuffer hardware mode initialization process.

My code for that is
Code: [Select]
buffer = new FrameBuffer(currentWidth, currentHeight, FrameBuffer.SAMPLINGMODE_GL_AA_4X);
canvas = buffer.enableGLCanvasRenderer();
buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
where currentWidth and currentHeight are dimensions of panel where canvas is displayed.

Well, first of all I am getting following errors in logs:
Code: [Select]
Java version is: 1.6.0_17
-> support for BufferedImage
Version helper for 1.5+ initialized!
-> using BufferedImage
Software renderer (OpenGL mode) initialized
Using LWJGL's AWTGLCanvas
Can't find desired videomode (1232 x 555 x 32) - searching for alternatives
Can't find alternative videomode (1232 x 555 x 32) - trying something else
[ Mon Mar 15 19:58:05 CET 2010 ] - ERROR: Can't find any suitable videomode!
[ Mon Mar 15 19:58:05 CET 2010 ] - ERROR: Can't set videomode - try different settings!
Software renderer disposed
I have read in docs that width and height must match to the one of available VideoModes for hardware mode, however when I ignore it, the game is running fine and the canvas content is displayed correctly - it fills to the panel content.
My question is how it is working in that case and what is the consequence of ignoring those error messages?

The other thing is that I do not see any difference between SAMPLINGMODE_NORMAL, SAMPLINGMODE_GL_AA_2X and SAMPLINGMODE_GL_AA_4X mode. Is there anything else that I have to do to enable it?
The logs about graphics card are:
Code: [Select]
Driver is: vga/6.0.6001.18000 on NVIDIA Corporation / GeForce 9650M GT/PCI/SSE2
GL_ARB_texture_env_combine supported and used!
FBO supported and used!
OpenGL renderer initialized (using 4 texture stages)

There is an screenshot of my ship, and I am assuming the AA is not working because I see sharp shapes of ship and station:



Thanks,
Wojtek

28
Support / Re: compiled objects
« on: March 15, 2010, 07:11:09 pm »
Thanks!

29
Support / Re: compiled objects
« on: March 14, 2010, 12:07:01 am »
Yes, you can use the calcMinDistance that you are calling anyway for this. calcMinDistance triggers a CollisionEvent if a CollisionListener is assigned to the object...so just implement a CollisionListener (don't forget to let your requiresPolygonIDs() -impl return true), add it to all objects and you can get object and polygon id from the event.

Hello Egon,

Can you please put the example code how to use World.calcMinDistanceAndObject3D() method instead of Interact2D.pickPolygon() for mouse handler?

I have tried something like this, but it does not seem to work correctly (ie. returns wrong object)
Code: [Select]
SimpleVector ray = Interact2D.reproject2D3D(camera, buffer, mouseX, mouseY);
Object[] result = getWorld().calcMinDistanceAndObject3D(camera.getPosition(), ray, HORIZON_RADIUS);
return (Object3D) result[1];

Thanks,
Wojtek

30
Feedback / Re: Survey
« on: February 28, 2010, 09:59:40 pm »
Thanks :) Konrad will share the results with pleasure when he finishes his work, which will happen approximately after about 200 more questionaries filled in  ;)

Well I also filled it in some time ago and think that money part is quite a bit important thing related to my satisfaction of current job ;)

Thanks,
Wojtek

Pages: 1 [2] 3 4 5