Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. Cannot use gl primitives in my mobile application
Forum Updated to NodeBB v4.3 + New Features

Cannot use gl primitives in my mobile application

Scheduled Pinned Locked Moved Game Development
5 Posts 3 Posters 3.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    akhil
    wrote on last edited by
    #1

    i tried running the following code on a mobile device but i'm getting few errors. the code works fine for desktop or a simulator but shows error for a device..

    errors:
    'glBegin' was not declared in this scope
    'glVertex3f' was not declared in this scope
    'glEnd' was not declared in this scope

    and so on....

    File name:
    glwidget.cpp

    @
    #include "glwidget.h"
    #include <QtOpenGL>

    Glwidget::Glwidget(QWidget *parent) :
    QGLWidget(parent)
    {
    }
    void Glwidget::initializeGL ()
    {
    glClearColor (1,1,0,1);
    }

    void Glwidget::resizeGL (int w, int h){

    }
    void Glwidget::paintGL (){
    glClear (GL_COLOR_BUFFER_BIT);
    qglColor (QColor(255, 0, 0, 127));
    glBegin(GL_TRIANGLES);
    glVertex3f(1,1,0);
    glVertex3f(-1,-1,0);
    glVertex3f(0,5,0);

    glEnd();

    }
    @

    pro file:

    @

    Add files and directories to ship with the application

    by adapting the examples below.

    file1.source = myfile

    dir1.source = mydir

    DEPLOYMENTFOLDERS = # file1 dir1

    symbian:TARGET.UID3 = 0xE0DB25C3

    Allow network access on Symbian

    symbian:TARGET.CAPABILITY += NetworkServices

    If your application uses the Qt Mobility libraries, uncomment

    the following lines and add the respective components to the

    MOBILITY variable.

    CONFIG += mobility

    MOBILITY +=

    QT+=opengl
    SOURCES += main.cpp mainwindow.cpp
    glwidget.cpp \

    HEADERS += mainwindow.h
    glwidget.h
    gl.h
    FORMS += mainwindow.ui

    Please do not modify the following two lines. Required for deployment.

    include(deployment.pri)
    qtcAddDeployment()
    @

    if anyone finds a solution to the problem kindly help me out..

    thanks :)

    [Edit: Please wrap code in @ blocks. -mlong]

    1 Reply Last reply
    0
    • S Offline
      S Offline
      shoyeb
      wrote on last edited by
      #2

      in ur .pro file, have u added the following line..

      @QT += opengl@

      There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        akhil
        wrote on last edited by
        #3

        yes i've done this in my pro file

        1 Reply Last reply
        0
        • J Offline
          J Offline
          jmacey
          wrote on last edited by
          #4

          Most mobile devices do not have immediate mode OpenGL as they use OpenGL ES. This means all things such as glBegin glVertex are not part of the library and you will have to use either vertex arrays or vertex buffer objects.

          You will also need to use some form of shader as the normal fixed function GL shading is also not present. This is a good place to start. http://www.khronos.org/opengles/2_X/

          1 Reply Last reply
          0
          • A Offline
            A Offline
            akhil
            wrote on last edited by
            #5

            okay.. got it.. thanks...

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved