VBOs on OpenGL, like on ES 2.0

Hi,

I have developed an application on iPhone and Android using OpenGL ES 2.0. It’s about many 2D sprites in 3D environment where user can interact with objects, as they are actually transformed by the physics middleware.

I know it won’t be easy, but I wanted to run this application out-of-the-box on OpenGL 3.2 (Mac OS X 10.6).

I would like to ask whether it’s possible to draw with shaders and attributes on OpenGL 3.2 implementation for desktop computers. That is, I do not want to setup camera with glFrustum or anything like that, I do not want to call glEnableClientState, glVertexPointer, etc. What I want is basically passing all information to the shader(s) as attributes or uniforms. It turned out I can’t draw anything only with shaders! All I see is black screen.

Do you know any examples that does what I wish? All I see is mostly fixed pipeline stuff or VBO examples without shader.

Thanks!

I guessed that, but I avoided touching it, but… it turned out view-projection matrix is not setup. I thought drawing directly into the context without setting up model-view-projection matrix should suffice, and I basically assigned gl_Position to gl_Vertex in the shader - this didn’t work. I then setup projection matrix and saw my square (made of triangle strips). I still used glVertexPointer and glEnableClientState, however. Can I get rid of those as well?

I know it won’t be easy, but I wanted to run this application out-of-the-box on OpenGL 3.2 (Mac OS X 10.6).

Well too bad; MacOS X 10.6 does not support OpenGL 3.2. Or OpenGL 3.1. Or OpenGL 3.0.

No, the best you can get with MacOS X these days is 2.1 with extensions. And not even all DX10-class extensions (ARB_geometry_shader isn’t supported). They don’t even support ARB_vertex_array_object, which is virtually identical to APPLE_vertex_array_object.

I would like to ask whether it’s possible to draw with shaders and attributes on OpenGL 3.2 implementation for desktop computers.

With a core implementation, fixed functionality isn’t even an option. You have to ask for the compatibility profile to get that.

So yes, you can.

It turned out I can’t draw anything only with shaders! All I see is black screen.

Then you’re doing something wrong.

Do you know any examples that does what I wish?

What you wish (GL 3.2 on MacOSX) is not possible due to apathy on Apple’s part. I know of some code for doing what you’re talking about on Windows.

According to OpenGL caps viewer (I’ve got it sometime ago and I don’t even remember where it is now), my device/context does support OpenGL 3.2. You still may be right, though, as I have no evidence or numbers right now. Nevertheless, this whole “porting” wasn’t as trivial as I expected and that was huge disappointment at the beginning. At the end of the day, however, the problem, turned out, caused by something I was expected but ignored lucidly :slight_smile: I intentionally avoided involving projection matrix and things like that, and I expected at least orthographic projection to be present.

But I still want to avoid glVertexPointer - not because it’s bad, but because source compatibility! I now #ifdef’ed parts of the code and also avoided virtual function calls (save as many cycles as possible).

As you said, it may be related to Apple, because nearly 90% of code I saw was not on Mac OS X and was claimed to work somehow.

Off-topic question; is Apple not member of Khronos group? Do they not care about such things? I understand they have no vision, support or expect “proper” gaming on Mac OS X, but entire window manager and API is built upon OpenGL - why not be a member, have a couple of words to say, and most importantly, keep up-to-date? I’ve got an old Mac Pro and I know it’s impossible to upgrade graphics cards after some point (I am running NVIDIA 8800GT). This may change in the future but we (old Mac owners) are kind of … stuck now, if I may…

I have got trouble with mapping window coordinates to OpenGL, for performing hit-testing. I hope I can figure that out as well. All examples are for fixed pipeline and I already have forgotten those :frowning: It’s time to dig more into linear algebra, I guess!