Stuck with rendering

Post Reply
Posts: 1
Joined: Fri May 19, 2017 10:00 am

Stuck with rendering

Post by barisdoga » Fri May 19, 2017 10:29 am

I am trying to render my game objects with shaders using lwjgl and jbullet. But i am stuck with transforming vertices.

My Bullet Configs:

Code: Select all

collisionShapes = new ObjectArrayList<CollisionShape>();
collisionConfiguration = new DefaultCollisionConfiguration();
dispatcher = new CollisionDispatcher(collisionConfiguration);
overlappingPairCache = new AxisSweep3(worldAabbMin, worldAabbMax, maxProxies);
solver = new SequentialImpulseConstraintSolver();
dynamicsWorld = new DiscreteDynamicsWorld(dispatcher, overlappingPairCache, solver, collisionConfiguration);
Create a Box Code:

Code: Select all

// Game Object
this.position = postion;
this.rotation = rotation;
this.scale = scale;
this.mass = mass;

// Physics Object
CollisionShape shape = new BoxShape(new Vector3f(entity.getScale().x, entity.getScale().y, entity.getScale().z));

Transform transform = new Transform();

boolean isDynamic = (entity.getMass() != 0f);
Vector3f localInertia = new Vector3f(0, 0, 0);
if (isDynamic)
	shape.calculateLocalInertia(entity.getMass(), localInertia);

transform.origin.set(new Vector3f(entity.getPosition().x, entity.getPosition().y, entity.getPosition().z));

DefaultMotionState myMotionState = new DefaultMotionState(transform);
RigidBodyConstructionInfo rbInfo = new RigidBodyConstructionInfo(entity.getMass(), myMotionState, shape, localInertia);
RigidBody body = new RigidBody(rbInfo);

Updating Physics With:

Code: Select all

dynamicsWorld.stepSimulation(1.f / 60.f, 10);
Im stuck here. What should i load to shaders ? I have a cube vertice map. Im trying with it and it isnt work.

Code: Select all

// This ?
Transform trans = new Transform();
float[] openGLMatrix = new float[16];

Vertex Shader:

Code: Select all

in vec3 position;

uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;
uniform mat4 transformationMatrix;

void main(void){
	vec4 worldPosition = transformationMatrix * vec4(position, 1.0);
	gl_Position = projectionMatrix * viewMatrix * worldPosition;
Situation Summary:
Im very confused what to do with this transform data. Tryed everything but nothing worked. A picture of current system
Currently doing

Code: Select all

Transform trans = new Transform();
			float[] arr = new float[16];
Ground = pos(0,-56,0) scale(50,50,50)
Boxes = pos(cam) scale(1,1,1)
Most Right Box ground but not scaling in shaders. Dont know why.
High res :

Posts: 1
Joined: Tue Jan 23, 2018 6:40 am

Re: Stuck with rendering

Post by billscott09 » Tue Jan 23, 2018 6:47 am

This is the same issue I did not sort it out I'm still looking for the help if anyone here can help me please do as I want this matter to be sort out in jiffy.I m doing Essay Writing Help regarding this.

Post Reply