Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!


Differences between opengl es 2.0 and desktop opengl


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
11 replies to this topic

#1 Ed Welch   Members   -  Reputation: 489

Like
0Likes
Like

Posted 29 August 2012 - 05:55 AM

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.

Sponsor:

#2 Olof Hedman   Crossbones+   -  Reputation: 2958

Like
0Likes
Like

Posted 29 August 2012 - 06:28 AM

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.

#3 Ed Welch   Members   -  Reputation: 489

Like
0Likes
Like

Posted 29 August 2012 - 06:47 AM

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.

#4 Olof Hedman   Crossbones+   -  Reputation: 2958

Like
0Likes
Like

Posted 29 August 2012 - 07:06 AM

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

#5 Ed Welch   Members   -  Reputation: 489

Like
0Likes
Like

Posted 29 August 2012 - 07:21 AM

Well, this is the code I have so far:
[source lang="cpp"]// Create a frame buffer with only the depth buffer attachedglGenFramebuffers(1, &m_shadowFrameBuffer);glBindFramebuffer(GL_FRAMEBUFFER, m_shadowFrameBuffer);//Create the shadow map textureglGenTextures(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 parametersglTexParameteri(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_0glDrawBuffer(GL_NONE);#endifint status = glCheckFramebufferStatus(GL_FRAMEBUFFER);[/source]
Would you think that I have to change glFramebufferTexture2D to use GL_COLOR_ATTACHMENT instead of GL_DEPTH_ATTACHMENT?

#6 powly k   Members   -  Reputation: 653

Like
0Likes
Like

Posted 29 August 2012 - 07:27 AM

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.

Edited by powly k, 29 August 2012 - 07:29 AM.


#7 Olof Hedman   Crossbones+   -  Reputation: 2958

Like
1Likes
Like

Posted 29 August 2012 - 07:42 AM

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

#8 web383   Members   -  Reputation: 796

Like
0Likes
Like

Posted 29 August 2012 - 10:08 AM

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

#9 Ed Welch   Members   -  Reputation: 489

Like
0Likes
Like

Posted 29 August 2012 - 10:32 AM

Thanks for your answers. I got the framebuffer working now.

#10 V-man   Members   -  Reputation: 805

Like
0Likes
Like

Posted 30 August 2012 - 04:33 AM

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

#11 larspensjo   Members   -  Reputation: 1561

Like
0Likes
Like

Posted 30 August 2012 - 12:43 PM

If I call glDrawBuffer(GL_NONE); the error goes away, but then nothing gets drawn to the frame buffer.

It seems some graphic cards require that you call glDrawBuffer(GL_NONE) if you have a FBO and only want to update the depth buffer. You say nothing gets drawn, by which I suppose your depth buffer wasn't updated?

Did you have to add a color buffer to get it working?
Current project: Ephenation.
Sharing OpenGL experiences: http://ephenationopengl.blogspot.com/

#12 Ed Welch   Members   -  Reputation: 489

Like
0Likes
Like

Posted 31 August 2012 - 06:57 AM


If I call glDrawBuffer(GL_NONE); the error goes away, but then nothing gets drawn to the frame buffer.

It seems some graphic cards require that you call glDrawBuffer(GL_NONE) if you have a FBO and only want to update the depth buffer. You say nothing gets drawn, by which I suppose your depth buffer wasn't updated?

Did you have to add a color buffer to get it working?

Actually, now that I check, the color buffer wasn't needed. The real problem was caused by the near / far values in the perspective matrix (at least I think that what it was)




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS