I am relatively new to JUCE and very new to OpenGL. First, let me explain what I am trying to do.
I am simply trying to create a 3-D shape, nothing fancy. I am using haydxn's starting point JUCE GUI application code: http://www.juce.com/forum/topic/basic-starting-point-tutorial-code
which is just 4 files and when built, creates an empty top-level window. An instance of the MainComponent class is placed on the window. I am trying to develop this MainComponent class to render a 3-D shape on the window. The code that I currently have for the MainComponent class is below (it does not work!). It seems whatever way I try I get a different error. I am just looking for the simplest way to accomplish my goal. I could probably figure it out if I played with it long enough, however time is not a commodity!
I would like to use either OpenGLHelpers::drawQuad3D() or OpenGLFrameBuffer::draw3D() as those seem particularly useful, but any way to get the job done works. If anyone has any suggestions I would GREATLY appreciate it!
class MainComponent : public Component,
openGLContext.attachTo(*this); //attach an openGL context to this MainComponent
openGLContext.detach(); //detach the OpenGL conext from this MainComponent
deleteAllChildren(); // This will remove all the contained components, and delete
// the objects for you.
void newOpenGLContextCreated() override
int w = getWidth();
int h = getHeight();
myImage = Image(Image::ARGB, w, h, true, OpenGLImageType());
void renderOpenGL() override
float x1 = 0.5; float y1 = 0.5; float z1 = 0;
float x2 = 0.5; float y2 = -0.5; float z2 = 0;
float x3 = -0.5; float y3 = 0.5; float z3 = 0;
float x4 = -0.5; float y4 = -0.5; float z4 = 0;
frameBuffer.draw3D (x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4, Colours::red);
void openGLContextClosing() override
void resized ()
void paint (Graphics& g)