Results 1 to 9 of 9

Thread: how to write QT openGL code in two classes

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2010
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default how to write QT openGL code in two classes

    I want to create large openGL models, so I want to divide it in multiple classes. For that, I wrote two classes,

    Qt Code:
    1. /////////////////// glhandle.cpp ////////////////////////////////////////
    2.  
    3. #include "glhandle.h" //Contains defn of GLHandle class
    4. #include "buildingpainter.h"
    5.  
    6. void GLHandle::paintGL() {
    7. //SOME DRAWING CODE HERE
    8. BuildingPainter p=BuildingPainter p=BuildingPainter(this->context());
    9. p.draw();
    10. }
    11.  
    12. //ResizeGL(), initializeGL() and other functions
    To copy to clipboard, switch view to plain text mode 

    and

    Qt Code:
    1. ////////////////// BuildingPainter.cpp ///////////////////////////////
    2.  
    3. #include "buildingpainter.h" //Defn of BuildingPainter class
    4.  
    5. BuildingPainter::BuildingPainter(QWidget *parent) :
    6. QGLWidget(parent) {
    7. }
    8.  
    9. // This constructor is called: So that openGL states should be copied
    10. BuildingPainter::BuildingPainter(const QGLContext *refs): QGLWidget(refs) {
    11. }
    12.  
    13. void BuildingPainter::draw() {
    14. //More drawing Code here
    15. }
    To copy to clipboard, switch view to plain text mode 

    However, I am getting compile error:
    error: ‘QGLWidget::QGLWidget(const QGLWidget&)’ is private
    in definition of BuildingPainter.

    What is right way to do it so that I can render different parts of my model from different classes?
    Last edited by qtUse; 30th August 2010 at 19:24.

Similar Threads

  1. linking the files with openGL code
    By Abeer in forum Newbie
    Replies: 1
    Last Post: 25th May 2010, 01:10
  2. Replies: 0
    Last Post: 6th December 2009, 00:41
  3. Qt with OpenGL ES for ARM9 - All OpenGL ES tests have failed!
    By vinpa in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 3rd December 2009, 10:10
  4. Code Completion in UI classes
    By ChrisW67 in forum Qt Tools
    Replies: 5
    Last Post: 19th June 2009, 00:26

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.