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
Developer
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.2174, Z10 (STL100-3)-10.3.0.700 Dev OS, Z30 (STA100-5)-10.3.0.700 Dev OS, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: 5.0 Simulator supporting OpenGL ES?

I tried out the 9550 simulator running 5.0.0.334 and luckily it didn't crash when I started up the OpenGL potion of my app. The problem is once it started nothing 3D showed up.

 

The app opens a Screen, which sets up the rendering environment. It does a game loop to allow it to constantly update the graphics, I followed the tutorial exactly with the exception of 2 components, the input handling and the app type. My app is a CLDC app and the tutorial is written for a MIDLet. I created a Image (javax.microedition.lcdui) and used it to create a Graphics item because the documentation states that it is the only supported type for drawing to without getting a native (from MIDLet app screen) graphics item. I read rows of pixels from the javax Image and write them to the native net.rim Graphics item and then write some strings to the native net.rim Graphics item.

 

The text shows up on the screen but the 3D does not. The only part that I am unsure that I did write was getting the net.rim Graphics item from the screen.

 

At initialization I syncronize the event thread and call getGraphics(). Write to it and at the end of drawing I call getUiEngine().updateDisplay() to flush the Graphics to the screen.

 

I don't now if it is the simulator and I should post the problem on the Issue Tracker or if I did something wrong in my code.

---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.
Administrator
MSohm
Posts: 14,379
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: 5.0 Simulator supporting OpenGL ES?

You can find a BlackBerry CLDC application that makes use of the OpenGL APIs here:  http://docs.blackberry.com/en/developers/deliverables/11942/CS_OpenGLTest_952941_11.jsp

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.2174, Z10 (STL100-3)-10.3.0.700 Dev OS, Z30 (STA100-5)-10.3.0.700 Dev OS, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: 5.0 Simulator supporting OpenGL ES?

PERFECT! I am currently modifing my test app so it matches the "control" of the app but not what is drawn. Will post if it works or not.

---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
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.2174, Z10 (STL100-3)-10.3.0.700 Dev OS, Z30 (STA100-5)-10.3.0.700 Dev OS, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: 5.0 Simulator supporting OpenGL ES?

Sweet, the good news is it now works (on the old simulator, the one that I mentioned in previous posts) and displays 3D.

 

The bad news is it runs slow (currently optimizing my code), most of the scene is missing (think this has to do with opposite face rendering), and my 2D is not getting drawed (I need to rewrite that section of code anyway).

 

So the only problems I am having are the ones that I could fix myself (I hope). I will mark this thread solved as soon as I make sure everything is working the way it should.

---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
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.2174, Z10 (STL100-3)-10.3.0.700 Dev OS, Z30 (STA100-5)-10.3.0.700 Dev OS, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: 5.0 Simulator supporting OpenGL ES?

Ok, one last issue that I just want to see if anyone else has encountered. I am drawing a cube, each face is 2 triangles that are "connected" so it only requires 4 vertexes per face. That gives me a total of 24 vertexes.

 

This works just fine:

gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 24);

 

This is a per-face breakdown of it:

gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 4, 4); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 8, 4); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 12, 4); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 16, 4); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 20, 4);

 

I needed to do an operation per-face so I decided to go with the second code example. I created an array that specified how many vertexes per face (not really needed but just for flexibility) and moved everything to a loop:

//face length array is called "strips" int pos = 0; for (int i = 0; i < strips.length; i++) //Draw each face { //Per-face operation(s) gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, pos, strips[i]); pos += strips[i]; }

 

Unfortunately calling glDrawArrays more then once so I can draw each face is not working. I don't get an exception or error, it stops drawing after the first call (so I only get one face). I looked around at OpenGL ES examples and most do something similar to the above 2 examples. So I don't know if this is a "oops" in the implementation for BlackBerry or if it's just me.

 

If you have had a similar issue please post, I will post on Issue Tracker if this is a API issue and not a "because you are using Vista, not the newest simulator, etc." issue.

---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
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.2174, Z10 (STL100-3)-10.3.0.700 Dev OS, Z30 (STA100-5)-10.3.0.700 Dev OS, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: 5.0 Simulator supporting OpenGL ES?

I posted a Bug on Issue Tracker for not being able to call glDrawArrays more then once.

 

Link:

https://www.blackberry.com/jira/browse/JAVAAPI-697

---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
titakalpesh
Posts: 203
Registered: ‎07-30-2009
My Device: Bold(9780),Curve(8520)
My Carrier: Vodafone

Re: 5.0 Simulator supporting OpenGL ES?

HI MSohm,

 

I'm trying to run the opengl sample application given in jde6.0 but it throws the exception so can you please help me for that i'm using the jde's default simulator with windows XP service pack2

 

Thanks

Tita

Please use plain text.
Developer
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.2174, Z10 (STL100-3)-10.3.0.700 Dev OS, Z30 (STA100-5)-10.3.0.700 Dev OS, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: 5.0 Simulator supporting OpenGL ES?

The only Simulator that runs 6.0 is the Torch 9800 simulator. The 9800 is a GSM device and does not support OpenGL.

---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
titakalpesh
Posts: 203
Registered: ‎07-30-2009
My Device: Bold(9780),Curve(8520)
My Carrier: Vodafone

Re: 5.0 Simulator supporting OpenGL ES?

Hi

 

Then in which simulator i can run this opengl example?

 

Thanks

Tita

Please use plain text.
Developer
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.2174, Z10 (STL100-3)-10.3.0.700 Dev OS, Z30 (STA100-5)-10.3.0.700 Dev OS, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: 5.0 Simulator supporting OpenGL ES?

Take a look at this:

http://supportforums.blackberry.com/t5/Java-Development/OpenGL-ES/m-p/566081/highlight/true#M116124

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