Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QOpenGLFunctions_4_5, GL_PRIMITIVE_RESTART
Forum Updated to NodeBB v4.3 + New Features

QOpenGLFunctions_4_5, GL_PRIMITIVE_RESTART

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 374 Views
  • 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
    Aitch
    wrote on last edited by
    #1

    I'm new to QT development and currently converting an old project into a QT application as a learning exercise.

    I know that you can still use GLEW with QT but my application has some deprecated OpenGL in and I am interested in some of the features that QT has to offer and would like to see them in practice, as a result I'm currently reworking my project using QOpenGLFunctions_4_5_Compatibility, but have come across a problem.

    I have got the majority of my render code working, but I'm having issues with the code below that comes from a function within a class that inherits from Qobject & QOpenGLFunctions_4_5_Compatibility.

    initializeOpenGLFunctions() is definitely being called beforehand and GL_PRIMITIVE_RESTART is defined in "QtGui/qopenglext.h" and has the correct value (0x8F9D) when passed to glEnableClientState().

    However, OpenGL is returning an error on the first line:

    Breaked-on: glEnableClientState(GL_PRIMITIVE_RESTART)
    Error-Code: GL_INVALID_ENUM
    Error-Description: An unacceptable value is specified for an enumerated argument. The offending command is ignored, and has no other side effect than to set the error flag.

    	glEnableClientState(GL_PRIMITIVE_RESTART);
    	GLErrorChecker::getInstance().checkGLStatus(__FILE__,__LINE__);
    	glPrimitiveRestartIndex( 0xFFFFFFFF >> ((4 - prims.getIndexSize()) * 8) );		
    
    	GLErrorChecker::getInstance().checkGLStatus(__FILE__,__LINE__);
    
    	bindIndexBuffer(indexBufferId);
    
    	GLErrorChecker::getInstance().checkGLStatus(__FILE__,__LINE__);
    
    	glDrawRangeElements(
    							prims.getGLPrimitiveType(),
    							prims.getMinIndex(),
    							prims.getMaxIndex(),
    							prims.getNumIndices(),
    							prims.getGLIndexType(),
    							BUFFER_OFFSET( prims.getIndexDataOffset() )
    	);
    
    	GLErrorChecker::getInstance().checkGLStatus(__FILE__,__LINE__);
    
    	glDisableClientState(GL_PRIMITIVE_RESTART);
    
    	GLErrorChecker::getInstance().checkGLStatus(__FILE__,__LINE__);
    
    	m_vertexCnt += prims.getNumIndices();
    

    Given that this code has worked on my machine before, all be it using GLEW; I'm not sure that it is a driver issue, I'm inclined to think that I haven't initialized something correctly or I'm not using the correct mechanism.

    I have also tried using QOpenGLFunctions_3_3_Compatibility and have the same issue.

    My long term goal is to get this legacy code working and then go on to update my OpenGL code to the latest standards and eventually change from QOpenGLFunctions_4_5_Compatibility to just QOpenGLFunctions_4_5.

    If anyone has got any insights that they can offer me, it would be much appreciated 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