Note that there are some explanatory texts on larger screens.

plurals
  1. POglVertexAttrib4f not working in OS X, but works fine in iOS?
    primarykey
    data
    text
    <p>I'm trying to port a simple OpenGL ES 2.0 renderer I made for iOS to OS X desktop and I'm running into into a 'nothing rendering' problem, and I don't get any errors reported so I'm at a loss what to do. So far I've narrowed the problem down to a call I make to <code>glVertexAttrib4f</code>, which is only working in OS X. Can anyone take a look at the following code and see why the call to <code>glVertexAttrib4f</code> doesn't work on desktop?:</p> <pre><code>void Renderer::drawTest() { gl::clear( mBackgroundColor ); static Vec2f vertices[3] = { Vec2f( 0, 0 ), Vec2f( 0.5, 1 ), Vec2f( 1, 0 ) }; static int indices[3] = { 0, 1, 2 }; mShader.bind(); glEnableVertexAttribArray( mAttributes.position ); glVertexAttribPointer( mAttributes.position, 2, GL_FLOAT, GL_FALSE, 0, &amp;vertices[0] ); #ifdef USING_GENERIC_ARRAY_POINTER // works in iOS /w ES2 and OSX: static Color colors[3] = { Color( 0, 0, 1 ), Color( 0, 0, 1 ), Color( 0, 0, 1 ) }; glEnableVertexAttribArray( mAttributes.color ); glVertexAttribPointer( mAttributes.color, 3, GL_FLOAT, GL_FALSE, 0, &amp;colors[0] ); #else // using generic attribute // works in iOS, but doesn't work in OSX ?: glVertexAttrib4f( mAttributes.color, 0, 1, 1, 1 ); #endif glDrawElements( GL_TRIANGLES, 3, GL_UNSIGNED_INT, &amp;indices[0] ); errorCheck(); // calls glGetError, which always returns GL_NO_ERROR } </code></pre> <p>note: this is example code that I stripped out of something much more complex, please forgive me for not making it more complete.</p> <p>versions: desktop OS X is 2.1 ATI-7.18.18 iPhone simulator is OpenGL ES 2.0 APPLE</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload