Android Question how do I initialize a surface with JPCT-AE library for GL v2?

RichyK68

Active Member
Licensed User
Longtime User
Hi,

I've been using the JPCT-AE (alhowiriny) (version 1.00) library in my project for a number of months. It's working well but Ive been initializing the JPCTSurface with Open GL version 1.0. I now want to implement my own pixel shader (just a simple normal mapping shader) and I believe I have to use Open GL version 2.0 now. I've wrote three 3D engines in DirectX so I'm familiar with vertex and pixel shaders. My problem is how to do it with the JPCT-AE library. I know I have to:

B4X:
        Jpct.Initialize("Jpct", 2, Jpct.RENDER_CONTINUOUSLY)

However, my project now errors with "java.lang.ArrayIndexOutOfBoundsException: length=0; index=0" on both the rendering of the skybox object and the RenderScene method for everything else.

I've read it's because the constructor is only for version 1, but I've tried the other constructors too with version 2 and I get the same result either way. One post stated "Make sure that you are using the FrameBuffer-constructor without the gl context, i.e. the one that takes the resolution only" but I can't see which of the constructors that would be referring to.

How do I successfully initialize the surface for GL 2?

Richard
 

RichyK68

Active Member
Licensed User
Longtime User
The answer is instead of

B4X:
        FrameBuffer.Initialize1(Jpct.glContext, Width, Height)

do this

B4X:
        FrameBuffer.Initialize2(Width, Height)
 
Upvote 0
Top