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


#ifdef USE_OPENGL_ES_1_1

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.


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

//Different possible texture parameters, e.g. GL10.GL_CLAMP_TO_EDGE

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
DebugLog.LOGD("mytext 10");

2) Created :


private final Context context;

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

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


public void onSurfaceCreated(GL10 gl, EGLConfig config)

// Call native function to initialize rendering:

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

DebugLog.LOGD("enter onSurfaceCreated 1");


DebugLog.LOGD("enter onSurfaceCreated 2");

4) Inside initApplicationAR function ImageTargets.java, added:


mRenderer = new ImageTargetsRenderer(context);

and also added this inside the class:


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

and glu.h from
(not sure if these are correct locations)

and pasted them into

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