Can anybody tell me where to get a sample code for a 3d rubik's cube written in opengl?

Its amazing what google can do. Here is one I found, Link

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.