jPCT-AE - a 3d engine for Android > Support
Vertex colouring from last jPCT-AE version
EgonOlsen:
No need to do anything for rescaling the texture. uv coordinates are normalized, so it doesn't matter which physical dimensions the actual texture has. BTW, this power of two limit is no engine limitation, it's an OpenGL/hardware limitation. jPCT does support other formats by using the NPOTTexture class, but you'll lose mip mapping and performance when doing this. It's intended for some special purpose stuff only.
mxar:
Ok
but I want to ask you if more types of Object3D models (like the supported .3ds,.obj ..) are planned to be supported in the near future by jPCT-ae.
Also non square texures with power of 2 sizes (like 512x256,128x64) are accepted and are safe ?
Thanks in advance
EgonOlsen:
--- Quote from: mxar on October 16, 2014, 10:41:44 am ---but I want to ask you if more types of Object3D models (like the supported .3ds,.obj ..) are planned to be supported in the near future by jPCT-ae.
--- End quote ---
There are no current plans to support than what's there. If there's a damn good reason, then i'll consider it. However, one can always write his/her own importers. Nothing in the API prevents you from doing so.
--- Quote from: mxar on October 16, 2014, 10:41:44 am ---Also non square texures with power of 2 sizes (like 512x256,128x64) are accepted and are safe ?
--- End quote ---
Accepted yes, safe...to a degree. Non-square texture are undefined for OpenGL ES 2.0. And so are the results. If you want to be safe, use square ones whenever possible.
mxar:
OK,
Thank you.
mxar:
Hi again,
I wrote a code to apply vertex colors to loaded 3D model.
The part of the code that assignes vertex color is:
int vertices = object3D.getMesh().getUniqueVertexCount();
float[] data = new float[4*vertices];
for(int i = 0; i < data.length; i++){
data = 0.0f;
if(i%4 == 0)
data = 0.0f; //red color
if(i%4 == 1)
data = 0.0f; //green color
if(i%4 == 2)
data = 1f; //blue color
if(i%4 == 3)
data = 0.5f; //transparency
}
VertexAttributes vattrs = new VertexAttributes("colorinfo",data,VertexAttributes.TYPE_FOUR_FLOATS);
object3D.getMesh().addVertexAttributes(vattrs);
GLSLShader shader = new GLSLShader( Loader.loadTextFile(mActivity.getResources().openRawResource(R.raw.vertexshader)),Loader.loadTextFile(mActivity.getResources().openRawResource(R.raw.fragmentshader)));
object3D.setShader(shader);
object3D.strip();
object3D.build();
world.addObject(object3D);
The vertex shader is:
attribute vec4 colorinfo;
uniform mat4 modelViewProjectionMatrix;
attribute vec4 position;
varying vec4 vertexColor;
void main(void)
{
vertexColor = colorinfo;
gl_Position = modelViewProjectionMatrix * position;
}
And the fragment shader is:
varying vec4 vertexColor;
void main(void)
{
gl_FragColor = vertexColor;
}
The problem is that i dont see any transparency. I see only a blue 3D model.
It looks like the code :
if(i%4 == 3)
data = 0.5f; //transparency
doesnt create any transparency.
How can i produce transparency with vertex colors?
Thanks in advance
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version