PDA

View Full Version : Help with creating sponge out of cube



learner_OpenGL3.1
10-02-2011, 07:02 PM
Hi Everyone,

I'm required to generate menger sponge in OpenGL 3.1 since it not longer supports GL_QUADS how can I subdivide triangle to get the look of menger sponge.

http://en.wikipedia.org/wiki/Menger_sponge

Any help would be appreciated

Alfonse Reinheart
10-02-2011, 07:05 PM
Just draw two triangles where you would have drawn a QUAD. Or just use a compatibility profile.

learner_OpenGL3.1
10-02-2011, 07:07 PM
Hi Alfonso,

Thanks for the quick response. I have already generated the cube but don't know how to make it look like menger sponge

learner_OpenGL3.1
10-02-2011, 07:30 PM
Could you also explain what compatibility profile is and how can we include it

V-man
10-03-2011, 11:57 AM
If you are on Windows, and you will be using Win32 code or MFC code or something of the sort, you check if WGL_ARB_create_context is present like this guy is doing.
http://www.opengl.org/wiki/Tutorial:_OpenGL_3.1_The_First_Triangle_%28C%2B%2B/Win%29

and instead of WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, you use WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB.

Then everything from GL 1.0 up to GL 3.1 will be available to you.