Jump to content
  • Advertisement
Sign in to follow this  
Ed Welch

OpenGL Differences between opengl es 2.0 and desktop opengl

This topic is 2295 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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);

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!