Log in or register to post comments

location of gl.h in cygwin

October 10, 2011 - 9:33pm #1

Hi all,

does anyone know where are these files gl.h, gl2.h are being included in cygwin(or somewhere else) ?
i would like to include my glut.h file, but couldnt find the location to include it..

Please help..

Quote:

#ifdef USE_OPENGL_ES_1_1
#include
#include
#else
#include
#include
#endif

Re: location of gl.h in cygwin

October 12, 2011 - 2:24am #4

allright ...got your point..

Now im able to run a sample android application which displays a 3dcube with a text on it using open GL ES 10.
I tried to do the same to the ImageTarget application.
1) I created a function called myText inside ImageTargetsRenderer.java.

But it stucks here (find out from the printed log lines- printed until mytext 2):
How do i modify the Drawable part? Should i call it somewhere in C file? From my understanding, i shouldnt have a canvas there(maybe somewhere else in C file). What should i do?the application forced to stop.

Quote:

public void myText(GL10 gl) {
DebugLog.LOGD("mytext 1");
int[] textures = new int[64];
// Create an empty, mutable bitmap
Bitmap bitmap = Bitmap.createBitmap(256, 256, Bitmap.Config.ARGB_4444);
// get a canvas to paint over the bitmap
Canvas canvas = new Canvas(bitmap);
bitmap.eraseColor(0);
DebugLog.LOGD("mytext 2");
// get a background image from resources
// note the image format must match the bitmap format
Drawable background = context.getResources().getDrawable(R.drawable.icon_qcar);
DebugLog.LOGD("mytext 3");
background.setBounds(0, 0, 256, 256);
background.draw(canvas); // draw the background to our bitmap
DebugLog.LOGD("mytext 4");
// Draw the text
Paint textPaint = new Paint();
textPaint.setTextSize(32);
textPaint.setAntiAlias(true);
textPaint.setARGB(0xff, 0x00, 0x00, 0x00);
DebugLog.LOGD("mytext 5");
// draw the text centered
canvas.drawText("Hello World", 16,112, textPaint);
DebugLog.LOGD("mytext 6");

//Generate one texture pointer...
gl.glGenTextures(1, textures , 0);
//...and bind it to our array
gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]);
DebugLog.LOGD("mytext 7");

//Create Nearest Filtered Texture
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);

//Different possible texture parameters, e.g. GL10.GL_CLAMP_TO_EDGE
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_REPEAT);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_REPEAT);

DebugLog.LOGD("mytext 8");

//Use the Android GLUtils to specify a two-dimensional texture image from our bitmap
GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
DebugLog.LOGD("mytext 9");

//Clean up
bitmap.recycle();
DebugLog.LOGD("mytext 10");
}

2) Created :

Quote:

private final Context context;

ImageTargetsRenderer(Context context) {
this.context = context;
}

3) also added the calling of myText inside onSurfaceCreated method:

Quote:

public void onSurfaceCreated(GL10 gl, EGLConfig config)
{
DebugLog.LOGD("GLRenderer::onSurfaceCreated");

// Call native function to initialize rendering:
initRendering();

// Call QCAR function to (re)initialize rendering after first use
// or after OpenGL ES context was lost (e.g. after onPause/onResume):
QCAR.onSurfaceCreated();

DebugLog.LOGD("enter onSurfaceCreated 1");

myText(gl);

DebugLog.LOGD("enter onSurfaceCreated 2");
}

4) Inside initApplicationAR function ImageTargets.java, added:

Quote:

mRenderer = new ImageTargetsRenderer(context);

and also added this inside the class:

Quote:

private Context context;

Re: location of gl.h in cygwin

October 11, 2011 - 7:37pm #3

OpenGL and OpenGL ES are different APIs. You won't be able to copy desktop OpenGL glu/glut headers and use them for Android. It's possible someone out there has ported the standard glut methods to OpenGL ES, take a look around.

- Kim

Re: location of gl.h in cygwin

October 11, 2011 - 6:02pm #2

Hi all,

I tried to put in the sample code to display text to the ImageTargets project, and it requires me to include the glu.h and glut.h.

I found few locations inside cygwin which are a bit confusing.
I copied glut.h from
C:\cygwin\ftp%3a%2f%2fcygwin.mirrors.pair.com%2f\release\opengl\opengl-1.1.0-10\usr\include\opengl\GL\

and glu.h from
C:\cygwin\usr\include\w32api\GL\
(not sure if these are correct locations)

and pasted them into
C:\Android\android-ndk-r6b\platforms\android-5\arch-arm\usr\include\GLES

since my gdb.setup file in libs\armeabi\ pointing into that path.

But at the end of compilation(the compilation was successful with the generated .so file)..installation..my Imagetargets teapot object didnt came out. Somehow my glu.h & glut.h file replacement didnt work out.:confused:

Are the locations correct?
Do i need a specific glu & glut.h files instead of just uisng the existing 1 from cygwin?(I've attached my files)

Log in or register to post comments