Textured cube. OpenGL code sample.

Tutorials concerning the OpenGL® ES cross-platform API for full-function 2D and 3D graphics on the Google-Android platform.

Textured cube. OpenGL code sample.

Postby eugenk » Fri Feb 08, 2008 12:30 pm

This is a simple OpenGL texturing example. It based on Colored 3D cube example (http://www.anddev.org/colored_3d_cube-t4.html), and I assume that you are familiar with it, before to try my code. Textured cube example shows two cubes. One - colored 3D cube. And other - textured. This code help you to understand how works texturing feature in Android OpenGL. Enjoy !

P.S plusminus, sorry. but can you increase attachment limit ? 256Kb is too small, to upload projects with some artworks. Regards, Eugene.

P.P.S. The second question. How to upload picture to this forum ? I've try it, but all inserting buttons requires URL. I have not my own website, so cannot apply weblink. So I need to upload my picture here directly. How can I do it ?
Attachments
texcube.png
screen
texcube.png (23.73 KiB) Viewed 34345 times
TexOut.zip
texturing cube Eclipse project
(217.98 KiB) Downloaded 6896 times
Last edited by eugenk on Sun Feb 10, 2008 12:27 am, edited 1 time in total.
eugenk
Developer
Developer
 
Posts: 29
Joined: Wed Jan 30, 2008 8:07 pm
Location: Russian Federation, Moscow

Top

Postby tsipoura » Sat Feb 09, 2008 8:19 pm

Thanks for this good and detailed sample :)
tsipoura
Freshman
Freshman
 
Posts: 2
Joined: Sat Feb 09, 2008 8:14 pm

Re: Textured cube. OpenGL code sample.

Postby WauloK » Sat Feb 09, 2008 11:31 pm

eugenk wrote:
P.P.S. The second question. How to upload picture to this forum ? I've try it, but all inserting buttons requires URL. I have not my own website, so cannot apply weblink. So I need to upload my picture here directly. How can I do it ?


Just use the usual Attachment button. If it detects an image it will display it inline automatically.
AndroidChi - Applications for the Google Android platform.
User avatar
WauloK
Developer
Developer
 
Posts: 32
Joined: Wed Dec 19, 2007 4:32 am
Location: Sydney, Australia

Re: Textured cube. OpenGL code sample.

Postby eugenk » Sun Feb 10, 2008 12:29 am

WauloK, thank ! It really works ! :)
eugenk
Developer
Developer
 
Posts: 29
Joined: Wed Jan 30, 2008 8:07 pm
Location: Russian Federation, Moscow

It doesn't work with the m5-rc15 released

Postby peterpan » Fri Mar 07, 2008 10:05 pm

The sample doesn't work with the m5-rc15 released.

I fixed the "GLContext.waitNative(canvas, this);" to "GLContext.waitNative();" in line 124.
And Ifixed the AndroidManifest.xml

But even when I start the application , it stops without any GL-Output ;(
peterpan
Freshman
Freshman
 
Posts: 5
Joined: Fri Mar 07, 2008 9:59 pm

Re: It doesn't work with the m5-rc15 released

Postby eugenk » Sat Mar 08, 2008 12:10 am

peterpan wrote:The sample doesn't work with the m5-rc15 released.

I fixed the "GLContext.waitNative(canvas, this);" to "GLContext.waitNative();" in line 124.
And Ifixed the AndroidManifest.xml

But even when I start the application , it stops without any GL-Output ;(


Yes. Unfortunately API was changed since m5-14 (12 of Feb. 2008). And all m3-XX OpenGL samples will not work with newer SDK. Now I'm very busy with application for Android Developer Challenge. It only one month is rest. But when I finish my project I'll rewrite this for m5-XX and finish other projects which I start on this forum. Now you can use m3-rc37a.
Last edited by eugenk on Sat Mar 08, 2008 12:17 am, edited 1 time in total.
eugenk
Developer
Developer
 
Posts: 29
Joined: Wed Jan 30, 2008 8:07 pm
Location: Russian Federation, Moscow

Top

Re: It doesn't work with the m5-rc15 released

Postby peterpan » Sat Mar 08, 2008 12:14 am

eugenk wrote:
peterpan wrote:The sample doesn't work with the m5-rc15 released.

I fixed the "GLContext.waitNative(canvas, this);" to "GLContext.waitNative();" in line 124.
And Ifixed the AndroidManifest.xml

But even when I start the application , it stops without any GL-Output ;(


Yes. Unfortunately API was changed since m5-14 (12 of Feb. 2008). And all m3-XX OpenGL samples will not work with newer SDK. I'm very busy now. But when I finish my project I'll rewrite this for m5-XX and finish other projects which I start on this forum. Now you can use m3-rc37a.

I've deleted m3-rc37a :(
peterpan
Freshman
Freshman
 
Posts: 5
Joined: Fri Mar 07, 2008 9:59 pm

Re: It doesn't work with the m5-rc15 released

Postby eugenk » Sat Mar 08, 2008 12:18 am

peterpan wrote:
eugenk wrote:
peterpan wrote:The sample doesn't work with the m5-rc15 released.

I've deleted m3-rc37a :(


No problem ! You can download it once again http://code.google.com/android/download_previous.html
eugenk
Developer
Developer
 
Posts: 29
Joined: Wed Jan 30, 2008 8:07 pm
Location: Russian Federation, Moscow

Re: It doesn't work with the m5-rc15 released

Postby peterpan » Sat Mar 08, 2008 1:07 am

eugenk wrote:
peterpan wrote:
eugenk wrote:
peterpan wrote:The sample doesn't work with the m5-rc15 released.

I've deleted m3-rc37a :(


No problem ! You can download it once again http://code.google.com/android/download_previous.html


And the ADT plugin ?
peterpan
Freshman
Freshman
 
Posts: 5
Joined: Fri Mar 07, 2008 9:59 pm

Re: It doesn't work with the m5-rc15 released

Postby eugenk » Sat Mar 08, 2008 10:30 am

ADT you can get from http://code.google.com/p/android/downloads/list There is sources only
eugenk
Developer
Developer
 
Posts: 29
Joined: Wed Jan 30, 2008 8:07 pm
Location: Russian Federation, Moscow

Re: It doesn't work with the m5-rc15 released

Postby peterpan » Sat Mar 08, 2008 4:25 pm

eugenk wrote:ADT you can get from http://code.google.com/p/android/downloads/list There is sources only

Thank you very much.

But this lines can't be resolved:

import com.android.ide.eclipse.ddms.DdmsPlugin;
import com.android.ide.eclipse.ddms.ImageLoader;
import com.android.ide.eclipse.ddms.MainThread;

So I can't complie it :(
peterpan
Freshman
Freshman
 
Posts: 5
Joined: Fri Mar 07, 2008 9:59 pm

Postby eugenk » Sat Mar 08, 2008 4:37 pm

Hm... I not tried to compile ADT from sources... Give me your e-mail and I send you precompiled ADT for m3-rc37
eugenk
Developer
Developer
 
Posts: 29
Joined: Wed Jan 30, 2008 8:07 pm
Location: Russian Federation, Moscow

Postby peterpan » Sat Mar 08, 2008 4:41 pm

eugenk wrote:Hm... I not tried to compile ADT from sources... Give me your e-mail and I send you precompiled ADT for m3-rc37


I found this link:
http://code.google.com/android/adt_download.html

Now it works.

Thank you very much.
peterpan
Freshman
Freshman
 
Posts: 5
Joined: Fri Mar 07, 2008 9:59 pm

Postby soniya » Sat Apr 05, 2008 3:36 pm

when application run in sdk m5.
I'm seeing an APP DEATH after about 10 sec.how to solved it??
soniya
Senior Developer
Senior Developer
 
Posts: 111
Joined: Mon Jan 14, 2008 1:52 pm
Location: india

Postby Girgante » Fri Apr 11, 2008 4:57 pm

Can someone please update this to m5?

Or show how you can use multiple textures? I can't seem to be able to use more than 1.
Girgante
Freshman
Freshman
 
Posts: 3
Joined: Mon Apr 07, 2008 2:15 pm

Top
Next

Return to Android 2D/3D Graphics - OpenGL Tutorials

Who is online

Users browsing this forum: No registered users and 5 guests