Results 1 to 20 of 31

Thread: 3 Dimensions using opengl

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    Join Date
    Sep 2006
    Posts
    339
    Thanks
    15
    Thanked 21 Times in 16 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: 3 Dimensions using opengl

    Hi aamer4yu,
    Thanks for your reply

    also saw the image u gave... well as far as i got it, u work in 2D and want to show them in 3D....
    Yes you are in right path. I already have some 2D objects and want to show them in 3D.

    well if u have fixes number of items, and know what items will be drawn, u can create a different view and add 3D objects to it
    Is different view a QGlwidget???. If yes I tried it. But get only 2D view.
    Now here is the main issue. How do I create a different view and add 3D objects to it. My sense says something like this

    //GraphicsView
    Qt Code:
    1. void graphicsView::paintEvent( QPaintEvent * event ){
    2. QPainter painter(this);
    3. paint( &painter );
    4. }
    5.  
    6. void graphicsView::paint( QPainter* painter ){
    7. //Draw the object you want
    8. }
    9.  
    10. void graphicsView::on3DViewerButtonClick(){
    11. m_glWid = new myGLWidget( this ); //here this is QGraphicsView
    12. m_glWid->show();
    13. }
    To copy to clipboard, switch view to plain text mode 

    Now I got graphicsView object in QGLWidget. How do I proceed further. I know I need to override
    Qt Code:
    1. paintGL()
    2. resizeGL()
    3. initializeGL()
    To copy to clipboard, switch view to plain text mode 
    I can even use paintEvent in GLWidget and the call paint member of GraphicsView like this

    Qt Code:
    1. void GLWidget::paintEvent( QPaintEvent * event ){
    2. QPainter painter;
    3. painter.begin(this);
    4. m_graphicsView->paint(&painter);
    5. painter.end();
    6. }
    To copy to clipboard, switch view to plain text mode 
    But now I get 2D on QGLWidget.
    Did you mean something like this. Or Is there something else.


    and yeah, is ur 3D view editable ??? i mean do u want items to be manipulated in 3D view, or just show a 3D view of the items ??
    [/QUOTE]
    Yes in some scenario. First I would be interested in representing a 2D object to 3D. If I succeed then move ahead for editing.

    Hope I made some sense now. PLease let me know if still there is any confusion.

    I'll go through the link you have given and see if I can get it.
    Thanks

    //I want through the link and could not find QTransform in qt4.2.2.
    Last edited by vermarajeev; 16th April 2007 at 05:42.

Similar Threads

  1. opengl help!!
    By rachana in forum Qt Programming
    Replies: 1
    Last Post: 19th February 2007, 08:52
  2. Qt and OpenGL
    By ToddAtWSU in forum Qt Programming
    Replies: 8
    Last Post: 15th June 2006, 21:37
  3. Does OpenGL be supported in opensource of Qt-4.1.2?
    By showhand in forum Qt Programming
    Replies: 1
    Last Post: 15th May 2006, 10:46
  4. Qt's optimized OpenGL context switching
    By sverhoff in forum Qt Programming
    Replies: 0
    Last Post: 28th March 2006, 16:40
  5. Example OpenGL project?
    By brcain in forum Qt Tools
    Replies: 9
    Last Post: 23rd February 2006, 21:17

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.