Differences between opengl es 2.0 and desktop opengl

Started by
10 comments, last by Ed Welch 11 years, 7 months ago
Is there any list of differences between opengl es 2.0 and desktop opengl?
I'm trying to convert a opengl es 2.0 program to run on regular opengl, but found out that framebuffer objects work in a different way.
I'm just wondering what other differences are there (I mean going from opengl es to opengl, not the other way around).
Thanks for any info.
Advertisement
I don't know of a list...
But apart from a few flags with other names, I use the same code for fbo:s on GLES 2.0 and regular GL.
In fact, everything is identical except some trivial things like that in our gles2 and gl-integrations for our graphics engine.
We'll probably merge them soon when the project planning allows it.

I don't know of a list...
But apart from a few flags with other names, I use the same code for fbo:s on GLES 2.0 and regular GL.
In fact, everything is identical except some trivial things like that in our gles2 and gl-integrations for our graphics engine.
We'll probably merge them soon when the project planning allows it.

When I tried to use opengl es code that creates a framebuffer I get a GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER error.
If I call glDrawBuffer(GL_NONE); the error goes away, but then nothing gets drawn to the frame buffer.
Are you creating or attaching a color buffer?
I have a comment in my code written by a colleague that says "GL requires a color buffer", which I assume means GLES doesn't :)

I just double checked our code with diff, the only difference in framebuffer initialization is in the call to glRenderbufferStorage, where we select GL_RGB565 mode instead of GL_RGB, and have to use GL_RGBA8_OES instead of GL_RGBA...
Well, this is the code I have so far:
[source lang="cpp"]
// Create a frame buffer with only the depth buffer attached
glGenFramebuffers(1, &m_shadowFrameBuffer);
glBindFramebuffer(GL_FRAMEBUFFER, m_shadowFrameBuffer);

//Create the shadow map texture
glGenTextures(1, &m_shadowTexture);
glBindTexture(GL_TEXTURE_2D, m_shadowTexture);

// Create the depth texture.
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT,
SHADOWMAP_SIZE, SHADOWMAP_SIZE, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL);

// Set the textures parameters
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D,
m_shadowTexture, 0);
#ifdef GL_VERSION_2_0
glDrawBuffer(GL_NONE);
#endif
int status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
[/source]
Would you think that I have to change glFramebufferTexture2D to use GL_COLOR_ATTACHMENT instead of GL_DEPTH_ATTACHMENT?
Use GL_DEPTH_COMPONENT32 (or GL_DEPTH_COMPONENT16) instead of GL_DEPTH_COMPONENT for the third parameter of glTexImage2D(). I assume you'll also want GL_FLOAT instead of GL_UNSIGNED_INT as the type.
Looks like you are missing a color buffer.

I don't think you should _change_ it, since your code most likely depends on getting the depth values in the texture.

But try attach a color buffer also. You don't have to do it as a texture attachement, but something like this:

glGenRenderbuffers(1, (GLuint*)&colorRenderBuffer);
glBindRenderbuffer(GL_RENDERBUFFER, colorRenderBuffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGB, width, height);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorRenderBuffer);
Have a look at this page http://www.khronos.org/registry/gles/

Here is the opengl es 2.0 difference specification: http://www.khronos.o...spec_2.0.25.pdf
Thanks for your answers. I got the framebuffer working now.
There are quite a few BIG differences. The GLSL part a slightly different. Desktop GL has support for geometry shaders, tesselation shaders. On Windows and Linux, you can create a compatible profile (all the old functions down to GL 1.0 work) or you can create a core profile.

EGL doesn't exist on the desktop. Each platform has its own binding API.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

This topic is closed to new replies.

Advertisement