VBOs

Nov 10, 2011 at 2:24 PM

Do you have any working examples you could post of using your framework implementing buffers using the glGenBuffers, glBindBuffer, glBufferData, glVertexPointer, glColorPointer, and glDrawElements in conjunction with one another?  I've tried different frameworks and methods to do it unsuccessfully, but before I try this one I was curious if it even worked.  I noticed another post about an issue with the parameters of glVertexPointer so I'd like to see it working with your latest 2.0 build before I go any further.

Thanks

Nov 25, 2011 at 12:23 PM

This interests me as well. I'm trying to render via VBOs and FBO, and keep getting undefined extension delegates, even though I know I can use glGenBuffers with OpenTK for instance. Anybody who can help out with this ?

 

Kjetil

Nov 29, 2011 at 7:46 AM

you can use them  in sharpgl as well

SharpGL.OpenGL gl = this.openGLControl1.OpenGL;

gl.GenBuffers(int,buffers);

gl.GenBuffers(int,buffers);

gl.GenBuffersARB(int,buffers);

part of this is out lined in the fundamentals

SharpGL Fundamentals

This page details the most fundamental concepts of SharpGL that you must be aware of to begin developing applications.

Render Contexts

A Render Context is an object that manages the underlying Render Context Handle. Until a Render Context is created no OpenGL functions will work - and no extensions will be loaded. Calling OpenGL.Create will create the Render Context - once this is done extensions can be used but before this point they will not work.

Naming Conventions

OpenGL constants are named in exactly the same way as they are in OpenGL and are constant members of the OpenGL class:

GL_TRIANGLES becomes OpenGL.GL_TRIANGLES
GLU_TESS_COMBINE becomes OpenGL.GLU_TESS_COMBINE

OpenGL functions are named in exactly the same way as they are in OpenGL with two exceptions - the gl or glu prefixes are always removed and parameter type postfixes are removed. OpenGL functions and extension functions are members of the OpenGL class:

glVertex3fv becomes gl.Vertex3
gluTessBeginPolygon becomes gl.TessBeginPolygon 

as fare as FBO i wasent abel to find anything besides

public void FramebufferRenderbufferEXT(uint target, uint attachment, uint renderbuffertarget, uint renderbuffer) Member of SharpGL.OpenGL

public void FramebufferTexture(uint target, uint attachment, uint texture, int level) Member of SharpGL.OpenGL

public void FramebufferTexture1DEXT(uint target, uint attachment, uint textarget, uint texture, int level) Member of SharpGL.OpenGL

public void FramebufferTexture2DEXT(uint target, uint attachment, uint textarget, uint texture, int level) Member of SharpGL.OpenGL

public void FramebufferTexture3DEXT(uint target, uint attachment, uint textarget, uint texture, int level, int zoffset) Member of SharpGL.OpenGL

 

alot of the information yoyu are asking about is in the object browser

you said you didnt want to waste the time in downloading the project to look @ the souce it would not be a waste of time if you looked @ it for 5 min

 i my self dont know  GL of any kind and im abel to use it

 

Coordinator
Nov 29, 2011 at 8:37 AM

Hi Guys,

As a heads up, there is a class in SharpGL that generates Render Buffers, which is a process very similar to using Framebuffers, the code is here:

http://sharpgl.codeplex.com/SourceControl/changeset/view/7099#124414

Now as you can see, it uses 

gl.GenRenderbuffersEXT, gl.BindRenderbufferEXT, gl.FramebufferRenderbufferEXT

and many more of the sort of functions you'll be using - this might be a good starting point to look at if you are using FBOs, VBOs and so on.

Nov 29, 2011 at 11:50 AM

Thanks for the info, but I did specifically mention vertex buffers and not frame buffers, and I had already been tinkering around with the code before I posted, I just didn't want to spend days troubleshooting why it wasn't working.  But in the end I ended up doing just that and after a few tweaks to the SharpGL code, I got the methods I mentioned worked together as they should.  So you know what I needed to do, here it is:

glColorPointer/ColorPointer - changed the last parameter from int[] to IntPtr since that is what OpenGL expects
glDrawElements/DrawElements - same as above
glVertexPointer/VertexPointer - changed the last parameter from float[] to IntPtr since that is what OpenGL expects

Once I made those changes, I was able to get everything working for a prototype.  I still have yet to do the details of clearing buffers and using the different properties of the buffers to allow modification of them over time, so there may be other methods I need to update similar to the ones above to get that to work.  The GenBuffers, BindBuffers, and BufferData all seemed to work fine as is.  I'd post my example but it's not something I'm able to do here, but at least for others looking to see if this can handle the buffer data for vertices and colors and all, it does with a few minor tweaks.

I too don't know the inner workings of OpenGL and was not trying to cop out of doing any research into the topic and how SharpGL works, so please don't lump me in with that lazy group.  I've spent weeks working on implementing these and was just curious if anyone had got these kind of buffers working before I spent even more time on it.

Great framework though, very easy to follow and very easy to modify as needed as I've come to find.  I was also able to recompile it into .NET 2.0 for better compatibilty with the host of software already written in 2.0 without having to do COM interaction between this and all of it, so I'm pretty happy at this point.  Keep up the good work.

Coordinator
Nov 29, 2011 at 12:09 PM

Hi Glycerine,

 

Glad you've got it to work and its great that you can run it in .NET 2.0. I'll incorporate your changes into the source code ready for the formal 2.0 release - thanks for letting me know about this it'll only make the library better!