How can i run this OPENGL ES program

Hi

I am trying to compile a program available on this link
http://www.khronos.org/opengles/documentation/html/eglIntro.html

but i m missing #include <unistd.h>
and there is one more compilation error at
typedef … NativeWindowType;

and if i ignore these two lines i get so many linking error

please help me… x()

here is the code

#include <stdlib.h>
#include <unistd.h>
#include <GLES/egl.h>
#include <GLES/gl.h>

typedef … NativeWindowType;
extern NativeWindowType createNativeWindow(void);

static EGLint const attribute_list[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_NONE
};

int main(int argc, char ** argv)
{
EGLDisplay display;
EGLConfig config;
EGLContext context;
EGLSurface surface;
NativeWindowType native_window;
EGLint num_config;

/* get an EGL display connection */
display = eglGetDisplay(EGL_DEFAULT_DISPLAY);

/* initialize the EGL display connection */
eglInitialize(display, NULL, NULL);

/* get an appropriate EGL frame buffer configuration */
eglChooseConfig(display, attribute_list, &config, 1, &num_config);

/* create an EGL rendering context */
context = eglCreateContext(display, config, EGL_NO_CONTEXT, NULL);

/* create a native window */
native_window = createNativeWindow();

/* create an EGL window surface */
surface = eglCreateWindowSurface(display, config, native_window, NULL);

/* connect the context to the surface */
eglMakeCurrent(display, surface, surface, context);

/* clear the color buffer */
glClearColor(1.0, 1.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
glFlush();

eglSwapBuffers(display, surface);

sleep(10);

return EXIT_SUCCESS;

}

:confused: :confused: :confused: :confused:

What platform and OpenGL ES implementation are you using?

I am using Windows 2000 and Visual C++ 6.0
and i have downloaded EGL.h and gl.h from http://www.khronos.org
what does mean by OpenGL ES Implementation sorry i am very new in OPENGL ES programming.

Thanks

I see. To many questions to be answered here.

Try this.

  • HM

Hi sohrab.

Those typedefs for Native EGL types (such as EGLNativeWindow) should be defined in the platform-dependent header file and should not be defined in your own program code.

Have you tried downloading the OpenGL ES sample implementation from the Khronos site ?
http://www.khronos.org/opengles/tutorials_code/.

It should compile with Visual C also and you should be able to experiment OpenGL ES programming with it. You can start writing (& testing) your code with it and then move to using the real SDK for the embedded device that you are targeting (when these are available).

–jani;

[ August 05, 2005, 04:24 PM: Message edited by: Boardmaster ]

Hi

Thanks to all of you , yes i am able to compile and run the program that Jani refer to me , and now i am start getting the things
once again thanks for giving me start

Regards

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.