Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
ChrisJordan
Posts: 5
Registered: ‎12-06-2009
My Device: Blackberry Z10
Accepted Solution

OpenGL Help?? EGL Error?

I am getting the following error when trying to run the OpenGL Code sample: Rendering a multi color 2-D triangle from the OS 5.0 beta sample code.  I copied the code right from the PDF without changes but get the following error:

 

JVM Error 104

Uncaught:

IllegalArgumentException

 

Has anyone run this code?  When I traced it in the debugger the error seems to be on this line in the code:

 

// Create an EGL window surface

_eglSurface = _egl.eglCreateWindowSurface

(_eglDisplay, _eglConfig, this, null);

 

Thanks,

 

Chris

Life Is Full Of Pictures
Please use plain text.
Developer
rcmaniac25
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.634 Dev OS, Z30 (STA100-5)-10.3.1.634 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917

Re: OpenGL Help?? EGL Error?

Since you said that you were using the OpenGL beta sample code can you post the initialize function? It works for me but I don't know what you are passing into the eglCreateWindowSurface, the error says IllegalArgumentException that tells me it was something that was passed to that function.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
New Developer
ChrisJordan
Posts: 5
Registered: ‎12-06-2009
My Device: Blackberry Z10

Re: OpenGL Help?? EGL Error?

Yes here is the initialize function:

 

private void initialize()

{

// Get EGL interface

_egl = (EGL11)EGLContext.getEGL();

// Get the EGL display

_eglDisplay = _egl.eglGetDisplay(EGL11.EGL_DEFAULT_DISPLAY);

// Initialize the display for EGL, null since we dont really need the version

_egl.eglInitialize(_eglDisplay, null);

// Choose an EGL config

EGLConfig[] configs = new EGLConfig[1];

int[] numConfigs = new int[1];

int[] attrs =

{

EGL11.EGL_RED_SIZE, 5,

EGL11.EGL_GREEN_SIZE, 6,

EGL11.EGL_BLUE_SIZE, 5,

EGL11.EGL_NONE

};

_egl.eglChooseConfig(_eglDisplay, attrs, configs, 1, numConfigs);

_eglConfig = configs[0];

// Create an EGL window surface

_eglSurface = _egl.eglCreateWindowSurface

(_eglDisplay, _eglConfig, this, null);

// Create an EGL context

createEGLContext();

// Specify vertices and colors for a triangle

float[] vertices =

{

-0.5f, -0.5f, 0.0f,

0.0f, 0.5f, 0.0f,

0.5f, -0.5f, 0.0f

};

float[] colors =

{

0.0f, 1.0f, 0.0f, 1.0f,

1.0f, 0.0f, 0.0f, 1.0f,

0.0f, 0.0f, 1.0f, 1.0f

};

_vertexArray = ByteBuffer.allocateDirect(3 * 3 * 4).asFloatBuffer();

_vertexArray.put(vertices);

_vertexArray.rewind();

_colorArray = ByteBuffer.allocateDirect(4 * 3 * 4).asFloatBuffer();

_colorArray.put(colors);

_colorArray.rewind();

}

Life Is Full Of Pictures
Please use plain text.
Developer
rcmaniac25
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.634 Dev OS, Z30 (STA100-5)-10.3.1.634 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917

Re: OpenGL Help?? EGL Error?

Hmm, that is the same code I have. What simulator are you using?

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
New Developer
ChrisJordan
Posts: 5
Registered: ‎12-06-2009
My Device: Blackberry Z10

Re: OpenGL Help?? EGL Error?

[ Edited ]

I was using Blackberry 9000 Simulator and in the About box it says: Blackberry Smartphone Simulator 2.13.0.44

 

Your question got me to thinking and that was the problem!  I had not installed the BlackBerry Java Plug-in for Eclipse v1.1 Beta 2.

 

Once I did that, everything worked fine.

 

Thanks for your help!!!  I appreciate it!

Life Is Full Of Pictures
Please use plain text.
Developer
rcmaniac25
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.634 Dev OS, Z30 (STA100-5)-10.3.1.634 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917

Re: OpenGL Help?? EGL Error?

No problem

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
New Contributor
swuth
Posts: 2
Registered: ‎08-13-2010
My Device: Not Specified

Re: OpenGL Help?? EGL Error?

Well... I'm new to the blackberry and I am having the same problem this guy was. I have the latest blackberry stuff (all installed from scratch) and when I too am crashing in the exact same spot as this guy was. Any ideas Blackberry dudes (and dudettes :smileyhappy:

 

 

Please use plain text.
Developer
rcmaniac25
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.634 Dev OS, Z30 (STA100-5)-10.3.1.634 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917

Re: OpenGL Help?? EGL Error?

What Eclipse version are you using and what Simulator are you using?

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
Developer
kylefowler
Posts: 526
Registered: ‎05-17-2009
My Device: 9900

Re: OpenGL Help?? EGL Error?

Well the 9000 does not support OpenGL so I dont think its gonna work at all. You need to use the storm or 9650 simulators

Like all of my posts
Please use plain text.