PDA

View Full Version : How can i run this OPENGL ES program



sohrab
05-08-2004, 10:11 AM
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:

hmwill
05-08-2004, 12:04 PM
What platform and OpenGL ES implementation are you using?

sohrab
05-08-2004, 12:16 PM
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

hmwill
05-09-2004, 06:49 PM
I see. To many questions to be answered here.

Try this. (http://ogl-es.sourceforge.net/getting_started.htm)

- HM

flame
05-15-2004, 03:55 AM
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 ]

sohrab
05-22-2004, 10:26 PM
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