PDA

View Full Version : Access violation in GeForceGLDriver (OS X 10.10.2, NVIDIA)



CainitePrince
04-16-2015, 04:24 AM
Hey all,

We are doing some internal testing and we have several machines where an EXC_BAD_ACCESS occurs inside the GeForceGLDriver.

What all those machines have in common is that they have NVidia cards and are running Yosemite. I tried an older machine with a NVidia card running 10.9.2 and that works fine. On Windows rendering works fine with NVidia cards.

Does anybody know more about this? Am I doing something wrong while rendering or is this a driver bug? I've been trying different ways of rendering, but haven't been able to find a workaround yet. Does anybody know a workaround?

NVIDIA Corporation
NVIDIA GeForce GT 750M OpenGL Engine
4.1 NVIDIA-10.2.1 310.41.15f01
4.10

Here is part of a crash rapport:

Process: Frontend [616]
Path: /Applications/IFCviewer KUBUS/*/Frontend.app/Contents/MacOS/Frontend
Identifier: Kubus.Frontend
Version: 1.0 (1)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Frontend [616]
User ID: 501

Date/Time: 2015-04-03 11:35:40.797 +0200
OS Version: Mac OS X 10.10.2 (14C1514)
Report Version: 11
Anonymous UUID: 00F4257A-5DD5-4939-85E6-08230642EC2A


Time Awake Since Boot: 930 seconds

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000008

VM Regions Near 0x8:
-->
__TEXT 000000010158e000-0000000101c61000 [ 6988K] r-x/rwx SM=COW /Applications/IFCviewer KUBUS/*/Frontend.app/Contents/MacOS/Frontend

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 com.apple.GeForceGLDriver 0x000012344025a36b gldReadTextureData + 202073
1 com.apple.GeForceGLDriver 0x000012344023c7d6 gldReadTextureData + 80324
2 com.apple.GeForceGLDriver 0x0000123440259db8 gldReadTextureData + 200614
3 com.apple.GeForceGLDriver 0x000012344001b0aa 0x123440000000 + 110762
4 com.apple.GeForceGLDriver 0x000012344001c160 0x123440000000 + 115040
5 com.apple.GeForceGLDriver 0x00001234400220eb 0x123440000000 + 139499
6 com.apple.GeForceGLDriver 0x00001234400227a2 0x123440000000 + 141218
7 com.apple.GeForceGLDriver 0x000012344032bb20 gldBlitFramebufferData + 66936
8 com.apple.GeForceGLDriver 0x000012344032c372 gldBlitFramebufferData + 69066
9 com.apple.GeForceGLDriver 0x000012344032c985 gldBlitFramebufferData + 70621
10 com.apple.GeForceGLDriver 0x00001234402286e5 gldUnbindPipelineProgram + 3567
11 com.apple.GeForceGLDriver 0x000012344032b719 gldBlitFramebufferData + 65905
12 com.apple.GeForceGLDriver 0x0000123440319dc6 gldUpdateDispatch + 864
13 GLEngine 0x00007fff905ae315 gleDoDrawDispatchCoreGL3 + 536
14 GLEngine 0x00007fff9055eabb gleDrawArraysOrElements_Entries_Body + 128
15 GLEngine 0x00007fff9055bd9e glDrawElementsBaseVertex_GL3Exec + 208
16 Kubus.Frontend 0x0000000101609ba1 Viewer::OpenGLRenderSystem::RenderIndexedGeometry( Viewer::RenderMode, Viewer::Mesh*) + 41
17 Kubus.Frontend 0x0000000101609e9f Viewer::OpenGLRenderSystem::Render(Viewer::CameraC ontroller const*, std::__1::vector<Viewer::Light*, std::__1::allocator<Viewer::Light*> > const&, Viewer::ClippingPlane const**, float, Viewer::Entity*, Viewer::Mesh*, Viewer::Material*) + 183
18 Kubus.Frontend 0x0000000101609d65 Viewer::OpenGLRenderSystem::Render(Viewer::CameraC ontroller const*, std::__1::vector<Viewer::Light*, std::__1::allocator<Viewer::Light*> > const&, Viewer::ClippingPlane const**, float, Viewer::RenderQueue*) + 271
19 Kubus.Frontend 0x00000001015ba83a Viewer::IfcViewer::Draw() + 214
20 Kubus.Frontend 0x00000001015b839f -[ModelView drawRect:] + 182
21 com.apple.AppKit 0x00007fff83c5db19 -[NSView _drawRect:clip:] + 4238
22 com.apple.AppKit 0x00007fff83c5c17a -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1875
23 com.apple.AppKit 0x00007fff83c5a016 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVis ibleRect:rectIsVisibleRectForView:topView:] + 913
24 com.apple.AppKit 0x00007fff83c5b420 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVis ibleRect:rectIsVisibleRectForView:topView:] + 6043
25 com.apple.AppKit 0x00007fff83c5b420 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVis ibleRect:rectIsVisibleRectForView:topView:] + 6043
26 com.apple.AppKit 0x00007fff83c5b420 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVis ibleRect:rectIsVisibleRectForView:topView:] + 6043
27 com.apple.AppKit 0x00007fff83c59773 -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVis ibleRect:rectIsVisibleRectForView:topView:] + 333
28 com.apple.AppKit 0x00007fff83c562cb -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVi sibleRectForView:] + 2761
29 com.apple.AppKit 0x00007fff83c34e2d -[NSView displayIfNeeded] + 1876
30 com.apple.AppKit 0x00007fff83c521c5 -[NSWindow displayIfNeeded] + 232
31 com.apple.AppKit 0x00007fff83c8f322 _handleWindowNeedsDisplayOrLayoutOrUpdateConstrain ts + 936
32 com.apple.AppKit 0x00007fff842580e1 __83-[NSWindow _postWindowNeedsDisplayOrLayoutOrUpdateConstraints UnlessPostingDisabled]_block_invoke1531 + 46
33 com.apple.CoreFoundation 0x00007fff85e4eda7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK _FUNCTION__ + 23
34 com.apple.CoreFoundation 0x00007fff85e4ed00 __CFRunLoopDoObservers + 368
35 com.apple.CoreFoundation 0x00007fff85e40e08 __CFRunLoopRun + 872
36 com.apple.CoreFoundation 0x00007fff85e40858 CFRunLoopRunSpecific + 296
37 com.apple.HIToolbox 0x00007fff87d87aef RunCurrentEventLoopInMode + 235
38 com.apple.HIToolbox 0x00007fff87d8786a ReceiveNextEventCommon + 431
39 com.apple.HIToolbox 0x00007fff87d876ab _BlockUntilNextEventMatchingListInModeWithFilter + 71
40 com.apple.AppKit 0x00007fff83b2ff81 _DPSNextEvent + 964
41 com.apple.AppKit 0x00007fff83b2f730 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 194
42 com.apple.AppKit 0x00007fff83b23593 -[NSApplication run] + 594
43 com.apple.AppKit 0x00007fff83b0ea14 NSApplicationMain + 1832
44 libdyld.dylib 0x00007fff8b9015c9 start + 1

Greets,

Floris

Dark Photon
04-16-2015, 06:45 AM
We are doing some internal testing and we have several machines where an EXC_BAD_ACCESS occurs inside the GeForce GL Driver. ...
Does anybody know more about this? Am I doing something wrong while rendering or is this a driver bug? ...

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000008
...

15 GLEngine 0x00007fff9055bd9e glDrawElementsBaseVertex_GL3Exec + 208
16 Kubus.Frontend 0x0000000101609ba1 Viewer::OpenGLRenderSystem::RenderIndexedGeometry( Viewer::RenderMode, Viewer::Mesh*) + 41
17 Kubus.Frontend 0x0000000101609e9f Viewer::OpenGLRenderSystem::Render(Viewer::CameraC ontroller const*, std::__1::vector<Viewer::Light*, std::__1::allocator<Viewer::Light*> > const&, Viewer::ClippingPlane const**, float, Viewer::Entity*, Viewer::Mesh*, Viewer::Material*) + 183
...


I would dump/inspect the GL batch state at your glDrawElementsBaseVertex() call. If it is your bug, I suspect you are passing a buffer offset (8) in for one of the vertex attribute arrays or index lists, but there was no buffer object bound to the appropriate buffer object bind point (e.g. ARRAY or ELEMENT_ARRAY).

Another possibility is that you have a rogue vertex attribute array you left enabled but which you thought was disabled, and the driver is reading from it potentially causing a crash.

CainitePrince
04-16-2015, 07:44 AM
Thanks for your response. I will see if I can inspect the OpenGL state when I have access to the hardware again.

It's certainly possible I'm using vertex attribute arrays in a wrong way. I thought that part was very confusing. This is currently how I'm using them. I'm calling SetVertexBuffer/SetIndexBuffer once to set up the VAO. After that I only bind and unbind the VAO. Do I need to call glDisableVertexAttribArray somewhere?

//! Holds geometry information.
struct Vertex
{
float position[3];
float normal[3];
};

OpenGLMesh::OpenGLMesh() : Mesh()
{
VERIFY(glGenVertexArrays(1, &_vao));
}

OpenGLMesh::~OpenGLMesh()
{
VERIFY(glDeleteVertexArrays(1, &_vao));
}

void OpenGLMesh::SetVertexBuffer(std::shared_ptr<VertexBuffer> vertexBuffer)
{
VERIFY(glBindVertexArray(_vao));

vertexBuffer->UseBuffer();
Mesh::SetVertexBuffer(vertexBuffer);

//specifies what the data in the buffer is.
VERIFY(glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*) 0));

VERIFY(glVertexAttribPointer(1,
3,
GL_FLOAT,
GL_FALSE,
sizeof(Vertex),
(void*) (3 * sizeof(float))));

//signal to OpenGL to feed the vertex data to the shader automatically.
VERIFY(glEnableVertexAttribArray(0));
VERIFY(glEnableVertexAttribArray(1));

VERIFY(glBindVertexArray(0));
}

std::shared_ptr<VertexBuffer> OpenGLMesh::GetVertexBuffer()
{
return Mesh::GetVertexBuffer();
}

void OpenGLMesh::SetIndexBuffer(std::shared_ptr<IndexBuffer> indexBuffer)
{
VERIFY(glBindVertexArray(_vao));

indexBuffer->UseBuffer();
Mesh::SetIndexBuffer(indexBuffer);

//specifies what the data in the buffer is.
//glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, nullptr);
VERIFY(glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*) 0));
VERIFY(glVertexAttribPointer(1,
3,
GL_FLOAT,
GL_FALSE,
sizeof(Vertex),
(void*) (3 * sizeof(float))));

//signal to OpenGL to feed the vertex data to the shader automatically.
VERIFY(glEnableVertexAttribArray(0));
VERIFY(glEnableVertexAttribArray(1));

VERIFY(glBindVertexArray(0));
}

std::shared_ptr<IndexBuffer> OpenGLMesh::GetIndexBuffer()
{
return Mesh::GetIndexBuffer();
}

void OpenGLMesh::BindMesh()
{
VERIFY(glBindVertexArray(_vao));
}

void OpenGLMesh::UnbindMesh()
{
VERIFY(glBindVertexArray(0));
}

arekkusu
04-16-2015, 08:38 AM
It's certainly possible I'm using vertex attribute arrays in a wrong way.

See previous posts (https://www.opengl.org/discussion_boards/showthread.php/182565-No-polygons-displayed-when-porting-code-from-Windows-to-OS-X?p=1254165&viewfull=1#post1254165) about setting up Apple's OpenGL Profiler (https://developer.apple.com/library/mac/documentation/GraphicsImaging/Conceptual/OpenGLProfilerUserGuide/Introduction/Introduction.html). Use the "break on VAO error" checkbox to detect if your draw calls read outside the bound buffers.

(You can also do this introspection yourself, wrapping draw calls with your own debug macros.)

CainitePrince
04-20-2015, 04:13 AM
I would dump/inspect the GL batch state at your glDrawElementsBaseVertex() call. If it is your bug, I suspect you are passing a buffer offset (8) in for one of the vertex attribute arrays or index lists, but there was no buffer object bound to the appropriate buffer object bind point (e.g. ARRAY or ELEMENT_ARRAY).

Another possibility is that you have a rogue vertex attribute array you left enabled but which you thought was disabled, and the driver is reading from it potentially causing a crash.

I have used OpenGL Profiler and can't find anything wrong with arrays, elements arrays or vertex attribute arrays. Here's the relevant state I saved from OpenGL Profiler. There are both an array and an element array bound and two vertex attributes are active.

Arrays <nil>
GL_VERTEX_ARRAY_BINDING 15
Generic Vertex Attributes <nil>
0 <nil>
GL_VERTEX_ATTRIB_ARRAY_ENABLED GL_TRUE
GL_VERTEX_ATTRIB_ARRAY_SIZE 3
GL_VERTEX_ATTRIB_ARRAY_STRIDE 24
GL_VERTEX_ATTRIB_ARRAY_TYPE GL_FLOAT
GL_VERTEX_ATTRIB_ARRAY_NORMALIZED GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_POINTER 0x00000000
GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 28
GL_VERTEX_ATTRIB_ARRAY_INTEGER GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0
1 <nil>
GL_VERTEX_ATTRIB_ARRAY_ENABLED GL_TRUE
GL_VERTEX_ATTRIB_ARRAY_SIZE 3
GL_VERTEX_ATTRIB_ARRAY_STRIDE 24
GL_VERTEX_ATTRIB_ARRAY_TYPE GL_FLOAT
GL_VERTEX_ATTRIB_ARRAY_NORMALIZED GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_POINTER 0x0000000c
GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 28
GL_VERTEX_ATTRIB_ARRAY_INTEGER GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0
2 <nil>
GL_VERTEX_ATTRIB_ARRAY_ENABLED GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_SIZE 4
GL_VERTEX_ATTRIB_ARRAY_STRIDE 0
GL_VERTEX_ATTRIB_ARRAY_TYPE GL_FLOAT
GL_VERTEX_ATTRIB_ARRAY_NORMALIZED GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_POINTER 0x00000000
GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0
GL_VERTEX_ATTRIB_ARRAY_INTEGER GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0
3 <nil>
GL_VERTEX_ATTRIB_ARRAY_ENABLED GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_SIZE 4
GL_VERTEX_ATTRIB_ARRAY_STRIDE 0
GL_VERTEX_ATTRIB_ARRAY_TYPE GL_FLOAT
GL_VERTEX_ATTRIB_ARRAY_NORMALIZED GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_POINTER 0x00000000
GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0
GL_VERTEX_ATTRIB_ARRAY_INTEGER GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0
4 <nil>
GL_VERTEX_ATTRIB_ARRAY_ENABLED GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_SIZE 4
GL_VERTEX_ATTRIB_ARRAY_STRIDE 0
GL_VERTEX_ATTRIB_ARRAY_TYPE GL_FLOAT
GL_VERTEX_ATTRIB_ARRAY_NORMALIZED GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_POINTER 0x00000000
GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0
GL_VERTEX_ATTRIB_ARRAY_INTEGER GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0
5 <nil>
GL_VERTEX_ATTRIB_ARRAY_ENABLED GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_SIZE 4
GL_VERTEX_ATTRIB_ARRAY_STRIDE 0
GL_VERTEX_ATTRIB_ARRAY_TYPE GL_FLOAT
GL_VERTEX_ATTRIB_ARRAY_NORMALIZED GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_POINTER 0x00000000
GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0
GL_VERTEX_ATTRIB_ARRAY_INTEGER GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0
6 <nil>
GL_VERTEX_ATTRIB_ARRAY_ENABLED GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_SIZE 4
GL_VERTEX_ATTRIB_ARRAY_STRIDE 0
GL_VERTEX_ATTRIB_ARRAY_TYPE GL_FLOAT
GL_VERTEX_ATTRIB_ARRAY_NORMALIZED GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_POINTER 0x00000000
GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0
GL_VERTEX_ATTRIB_ARRAY_INTEGER GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0
7 <nil>
GL_VERTEX_ATTRIB_ARRAY_ENABLED GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_SIZE 4
GL_VERTEX_ATTRIB_ARRAY_STRIDE 0
GL_VERTEX_ATTRIB_ARRAY_TYPE GL_FLOAT
GL_VERTEX_ATTRIB_ARRAY_NORMALIZED GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_POINTER 0x00000000
GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0
GL_VERTEX_ATTRIB_ARRAY_INTEGER GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0
8 <nil>
GL_VERTEX_ATTRIB_ARRAY_ENABLED GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_SIZE 4
GL_VERTEX_ATTRIB_ARRAY_STRIDE 0
GL_VERTEX_ATTRIB_ARRAY_TYPE GL_FLOAT
GL_VERTEX_ATTRIB_ARRAY_NORMALIZED GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_POINTER 0x00000000
GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0
GL_VERTEX_ATTRIB_ARRAY_INTEGER GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0
9 <nil>
GL_VERTEX_ATTRIB_ARRAY_ENABLED GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_SIZE 4
GL_VERTEX_ATTRIB_ARRAY_STRIDE 0
GL_VERTEX_ATTRIB_ARRAY_TYPE GL_FLOAT
GL_VERTEX_ATTRIB_ARRAY_NORMALIZED GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_POINTER 0x00000000
GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0
GL_VERTEX_ATTRIB_ARRAY_INTEGER GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0
10 <nil>
GL_VERTEX_ATTRIB_ARRAY_ENABLED GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_SIZE 4
GL_VERTEX_ATTRIB_ARRAY_STRIDE 0
GL_VERTEX_ATTRIB_ARRAY_TYPE GL_FLOAT
GL_VERTEX_ATTRIB_ARRAY_NORMALIZED GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_POINTER 0x00000000
GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0
GL_VERTEX_ATTRIB_ARRAY_INTEGER GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0
11 <nil>
GL_VERTEX_ATTRIB_ARRAY_ENABLED GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_SIZE 4
GL_VERTEX_ATTRIB_ARRAY_STRIDE 0
GL_VERTEX_ATTRIB_ARRAY_TYPE GL_FLOAT
GL_VERTEX_ATTRIB_ARRAY_NORMALIZED GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_POINTER 0x00000000
GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0
GL_VERTEX_ATTRIB_ARRAY_INTEGER GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0
12 <nil>
GL_VERTEX_ATTRIB_ARRAY_ENABLED GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_SIZE 4
GL_VERTEX_ATTRIB_ARRAY_STRIDE 0
GL_VERTEX_ATTRIB_ARRAY_TYPE GL_FLOAT
GL_VERTEX_ATTRIB_ARRAY_NORMALIZED GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_POINTER 0x00000000
GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0
GL_VERTEX_ATTRIB_ARRAY_INTEGER GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0
13 <nil>
GL_VERTEX_ATTRIB_ARRAY_ENABLED GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_SIZE 4
GL_VERTEX_ATTRIB_ARRAY_STRIDE 0
GL_VERTEX_ATTRIB_ARRAY_TYPE GL_FLOAT
GL_VERTEX_ATTRIB_ARRAY_NORMALIZED GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_POINTER 0x00000000
GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0
GL_VERTEX_ATTRIB_ARRAY_INTEGER GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0
14 <nil>
GL_VERTEX_ATTRIB_ARRAY_ENABLED GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_SIZE 4
GL_VERTEX_ATTRIB_ARRAY_STRIDE 0
GL_VERTEX_ATTRIB_ARRAY_TYPE GL_FLOAT
GL_VERTEX_ATTRIB_ARRAY_NORMALIZED GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_POINTER 0x00000000
GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0
GL_VERTEX_ATTRIB_ARRAY_INTEGER GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0
15 <nil>
GL_VERTEX_ATTRIB_ARRAY_ENABLED GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_SIZE 4
GL_VERTEX_ATTRIB_ARRAY_STRIDE 0
GL_VERTEX_ATTRIB_ARRAY_TYPE GL_FLOAT
GL_VERTEX_ATTRIB_ARRAY_NORMALIZED GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_POINTER 0x00000000
GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0
GL_VERTEX_ATTRIB_ARRAY_INTEGER GL_FALSE
GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0

Buffer Objects <nil>
GL_ARRAY_BUFFER_BINDING 23
GL_ELEMENT_ARRAY_BUFFER_BINDING 29
GL_PIXEL_PACK_BUFFER_BINDING 0
GL_PIXEL_UNPACK_BUFFER_BINDING 0
GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT 0
GL_COPY_READ_BUFFER 0
GL_COPY_WRITE_BUFFER 0

CainitePrince
04-20-2015, 04:20 AM
See previous posts (https://www.opengl.org/discussion_boards/showthread.php/182565-No-polygons-displayed-when-porting-code-from-Windows-to-OS-X?p=1254165&viewfull=1#post1254165) about setting up Apple's OpenGL Profiler (https://developer.apple.com/library/mac/documentation/GraphicsImaging/Conceptual/OpenGLProfilerUserGuide/Introduction/Introduction.html). Use the "break on VAO error" checkbox to detect if your draw calls read outside the bound buffers.

(You can also do this introspection yourself, wrapping draw calls with your own debug macros.)

I've used both OpenGL Profiler and gDebugger and checked all the break on OpenGL/VAO error boxes I could find. I tested this on Windows and OS X with an Intel chipset, and on OS X on a machine that has the problem. On the Intel machine it doesn't break at all. On the Nvidia machine it crashes but I hit no breakpoints.

CainitePrince
04-20-2015, 04:30 AM
Interestingly, with OpenGL Profiler attached it seems to crash in a different place.

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000008

VM Regions Near 0x8:
-->
__TEXT 00000001092d9000-0000000109b38000 [ 8572K] r-x/rwx SM=COW /Users/USER/Documents/*/Frontend.app/Contents/MacOS/Frontend

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 com.apple.GeForceGLDriver 0x000012344025a36b 0x123440000000 + 2466667
1 com.apple.GeForceGLDriver 0x000012344023c7d6 0x123440000000 + 2344918
2 com.apple.GeForceGLDriver 0x0000123440259db8 0x123440000000 + 2465208
3 com.apple.GeForceGLDriver 0x000012344001b0aa 0x123440000000 + 110762
4 com.apple.GeForceGLDriver 0x000012344001c160 0x123440000000 + 115040
5 com.apple.GeForceGLDriver 0x00001234400220eb 0x123440000000 + 139499
6 com.apple.GeForceGLDriver 0x00001234400227a2 0x123440000000 + 141218
7 com.apple.GeForceGLDriver 0x000012344032bb20 0x123440000000 + 3324704
8 com.apple.GeForceGLDriver 0x000012344032c372 0x123440000000 + 3326834
9 com.apple.GeForceGLDriver 0x000012344032c985 0x123440000000 + 3328389
10 com.apple.GeForceGLDriver 0x00001234402286e5 0x123440000000 + 2262757
11 com.apple.GeForceGLDriver 0x000012344032b719 0x123440000000 + 3323673
12 com.apple.GeForceGLDriver 0x0000123440319dc6 gldUpdateDispatch + 864
13 GLEngine 0x00007fff91241cba gleDoSelectiveDispatchNoErrorCoreGL3 + 456
14 GLEngine 0x00007fff912d6cad gliGetInteger + 2453
15 com.apple.opengl 0x00007fff895d5eac GLCGetParameter + 361
16 com.apple.GLEngineProfiler 0x00000001115e7129 0x1115e3000 + 16681
17 com.apple.GLEngineProfiler 0x00000001115e7d6f 0x1115e3000 + 19823
18 com.apple.GLEngineProfiler 0x00000001117055cb 0x1115e3000 + 1189323
19 Kubus.Frontend 0x000000010936bc4f Viewer::OpenGLShader::UseShader() + 31 (OpenGLShader.cpp:134)
20 Kubus.Frontend 0x00000001094a6c5d Viewer::OpenGLRenderSystem::Render(Viewer::CameraC ontroller const*, std::__1::vector<Viewer::Light*, std::__1::allocator<Viewer::Light*> > const&, Viewer::ClippingPlane const**, float, Viewer::Entity*, Viewer::Mesh*, Viewer::Material*) + 125 (OpenGLRenderSystem.cpp:291)
21 Kubus.Frontend 0x00000001094a6ad2 Viewer::OpenGLRenderSystem::Render(Viewer::CameraC ontroller const*, std::__1::vector<Viewer::Light*, std::__1::allocator<Viewer::Light*> > const&, Viewer::ClippingPlane const**, float, Viewer::RenderQueue*) + 418 (OpenGLRenderSystem.cpp:265)
22 Kubus.Frontend 0x0000000109371a0e Viewer::IfcViewer::Draw() + 414 (Viewer.cpp:447)
23 Kubus.Frontend 0x000000010936961a -[ModelView drawRect:] + 282 (ModelView.mm:203)
24 com.apple.AppKit 0x00007fff8d756b19 -[NSView _drawRect:clip:] + 4238
25 com.apple.AppKit 0x00007fff8d75517a -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1875
26 com.apple.AppKit 0x00007fff8d753016 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVis ibleRect:rectIsVisibleRectForView:topView:] + 913
27 com.apple.AppKit 0x00007fff8d754420 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVis ibleRect:rectIsVisibleRectForView:topView:] + 6043
28 com.apple.AppKit 0x00007fff8d754420 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVis ibleRect:rectIsVisibleRectForView:topView:] + 6043
29 com.apple.AppKit 0x00007fff8d754420 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVis ibleRect:rectIsVisibleRectForView:topView:] + 6043
30 com.apple.AppKit 0x00007fff8d752773 -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVis ibleRect:rectIsVisibleRectForView:topView:] + 333
31 com.apple.AppKit 0x00007fff8d74f2cb -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVi sibleRectForView:] + 2761
32 com.apple.AppKit 0x00007fff8d72de2d -[NSView displayIfNeeded] + 1876
33 com.apple.AppKit 0x00007fff8d74b1c5 -[NSWindow displayIfNeeded] + 232
34 com.apple.AppKit 0x00007fff8d788322 _handleWindowNeedsDisplayOrLayoutOrUpdateConstrain ts + 936
35 com.apple.AppKit 0x00007fff8dd510e1 __83-[NSWindow _postWindowNeedsDisplayOrLayoutOrUpdateConstraints UnlessPostingDisabled]_block_invoke1531 + 46
36 com.apple.CoreFoundation 0x00007fff849e6da7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK _FUNCTION__ + 23
37 com.apple.CoreFoundation 0x00007fff849e6d00 __CFRunLoopDoObservers + 368
38 com.apple.CoreFoundation 0x00007fff849d8e08 __CFRunLoopRun + 872
39 com.apple.CoreFoundation 0x00007fff849d8858 CFRunLoopRunSpecific + 296
40 com.apple.HIToolbox 0x00007fff87b6daef RunCurrentEventLoopInMode + 235
41 com.apple.HIToolbox 0x00007fff87b6d86a ReceiveNextEventCommon + 431
42 com.apple.HIToolbox 0x00007fff87b6d6ab _BlockUntilNextEventMatchingListInModeWithFilter + 71
43 com.apple.AppKit 0x00007fff8d628f81 _DPSNextEvent + 964
44 com.apple.AppKit 0x00007fff8d628730 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 194
45 com.apple.AppKit 0x00007fff8d61c593 -[NSApplication run] + 594
46 com.apple.AppKit 0x00007fff8d607a14 NSApplicationMain + 1832
47 Kubus.Frontend 0x00000001092fdd42 main + 34 (main.m:13)
48 libdyld.dylib 0x00007fff8b12b5c9 start + 1

arekkusu
04-20-2015, 10:08 AM
File a bug (http://bugreporter.apple.com) with clear steps to reproduce the problem (i.e. a copy of your application.)
Apple can symbolicate the com.apple.GeForceGLDriver backtrace and see exactly what's happening.

CainitePrince
05-13-2015, 04:31 AM
File a bug (http://bugreporter.apple.com) with clear steps to reproduce the problem (i.e. a copy of your application.)
Apple can symbolicate the com.apple.GeForceGLDriver backtrace and see exactly what's happening.



Thanks, I submitted a bug report with a small program that replicates the problem attached to it.

Here is the OpenGL code in it's entirety:


//
// TestProgram.m
// NVidiaDebugProgram
//
// Copyright (c) 2015 Kubus. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "TestProgram.h"

#include <string>

struct Vertex
{
float position[3];
float normal[3];
};

@implementation TestProgram

-(void) Initialize
{
VERIFY(glDisable(GL_CULL_FACE));
VERIFY(glFrontFace(GL_CW));

//turn on depth testing
VERIFY(glEnable(GL_DEPTH_TEST));
VERIFY(glDepthFunc(GL_LEQUAL));

//disable blending
VERIFY(glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA));
VERIFY(glDisable(GL_BLEND));

//write to depth buffer
VERIFY(glDepthMask(GL_TRUE));

GLint maxClippingPlanes;
VERIFY(glGetIntegerv(GL_MAX_CLIP_DISTANCES, &maxClippingPlanes));
if (maxClippingPlanes)
{
//return false;
}

// Enable 6 clipping planes
VERIFY(glEnable(GL_CLIP_DISTANCE0));
VERIFY(glEnable(GL_CLIP_DISTANCE1));
VERIFY(glEnable(GL_CLIP_DISTANCE2));
VERIFY(glEnable(GL_CLIP_DISTANCE3));
VERIFY(glEnable(GL_CLIP_DISTANCE4));
VERIFY(glEnable(GL_CLIP_DISTANCE5));

//create shader
std::string geometryVertexProgram =
"#version 150 core \n"
" \n"
"in vec4 position; \n"
"in vec3 normal; \n"
"uniform mat4 mvp; \n"
"uniform vec4 plane1; \n"
"uniform vec4 plane2; \n"
"uniform vec4 plane3; \n"
"uniform vec4 plane4; \n"
"uniform vec4 plane5; \n"
"uniform vec4 plane6; \n"
"out vec4 wsPosition; \n"
"out vec3 wsNormal; \n"
" \n"
"void main(void) \n"
"{ \n"
" wsPosition = position; \n"
" wsNormal = normal; \n"
" gl_ClipDistance[0] = dot(plane1, wsPosition); \n"
" gl_ClipDistance[1] = dot(plane2, wsPosition); \n"
" gl_ClipDistance[2] = dot(plane3, wsPosition); \n"
" gl_ClipDistance[3] = dot(plane4, wsPosition); \n"
" gl_ClipDistance[4] = dot(plane5, wsPosition); \n"
" gl_ClipDistance[5] = dot(plane6, wsPosition); \n"
" gl_Position = mvp * position; \n"
"} \n";

std::string geometryFragmentProgram =
"#version 150 core \n"
" \n"
"in vec4 wsPosition; \n"
"in vec3 wsNormal; \n"
"out vec4 color; \n"
"uniform vec3 lightdir1; \n"
"uniform vec3 lightdir2; \n"
"uniform vec3 lightdir3; \n"
"uniform vec3 camerapos; \n"
"uniform vec4 diffuse; \n"
"uniform vec4 ambient; \n"
"uniform vec4 specular; \n"
"uniform float shininess; \n"
"uniform float transparency; \n"
" \n"
"void main(void) \n"
"{ \n"
" vec3 n = normalize(wsNormal.xyz); \n"
" vec3 l1 = normalize(-lightdir1); \n"
" vec3 l2 = normalize(-lightdir2); \n"
" vec3 l3 = normalize(-lightdir3); \n"
" vec3 v = normalize(camerapos - wsPosition.xyz); \n"
" vec3 r1 = normalize(-reflect(l1, n)); \n"
" vec3 r2 = normalize(-reflect(l2, n)); \n"
" vec3 r3 = normalize(-reflect(l3, n)); \n"
" //mat3 m = mat3(l1, l2, l3); \n"
" float dotNL1 = dot(n, l1); \n"
" float dotNL2 = dot(n, l2); \n"
" float dotNL3 = dot(n, l3); \n"
" float lamb1 = 0.9 * clamp(dotNL1, 0.0, 1.0); \n"
" float lamb2 = 0.7 * clamp(dotNL2, 0.0, 1.0); \n"
" float lamb3 = 0.5 * clamp(dotNL3, 0.0, 1.0); \n"
" float phong1 = 0.9 * pow(max(dot(r1,v), 0.0), shininess); \n"
" float phong3 = 0.7 * pow(max(dot(r3,v), 0.0), shininess); \n"
" vec3 c; \n"
" vec3 exp = vec3(2.0, 2.0, 2.0); \n"
" c = (lamb1 + lamb2 + lamb3) * pow(diffuse.rgb, exp); \n"
" c += 0.2 * pow(ambient.rgb, exp); \n"
" c += (phong1 + phong3) * pow(specular.rgb, exp); \n"
" color = vec4(pow(c, vec3(1.0, 1.0, 1.0) / exp), transparency); \n"
"} \n";

//create shader
_program = glCreateProgram();
assert(glGetError() == 0);

//set vertex program
const GLchar *vertexSource = (const GLchar *) geometryVertexProgram.c_str();

_vertexProgram = glCreateShader(GL_VERTEX_SHADER);
assert(glGetError() == 0);

VERIFY(glShaderSource(_vertexProgram, 1, &vertexSource, nullptr));
VERIFY(glCompileShader(_vertexProgram));
GLint isCompiled = 0;
VERIFY(glGetShaderiv(_vertexProgram, GL_COMPILE_STATUS, &isCompiled));
if (isCompiled == GL_FALSE)
{
VERIFY(glDeleteShader(_vertexProgram));
//return false;
}

//set fragment program
const GLchar *fragmentSource = (const GLchar *)geometryFragmentProgram.c_str();

_fragmentProgram = glCreateShader(GL_FRAGMENT_SHADER);
assert(glGetError() == 0);

VERIFY(glShaderSource(_fragmentProgram, 1, &fragmentSource, nullptr));
VERIFY(glCompileShader(_fragmentProgram));
//GLint isCompiled = 0;
VERIFY(glGetShaderiv(_fragmentProgram, GL_COMPILE_STATUS, &isCompiled));
if (isCompiled == GL_FALSE)
{
VERIFY(glDeleteShader(_fragmentProgram));
//return false;
}

//compile shader
VERIFY(glAttachShader(_program, _vertexProgram));
VERIFY(glAttachShader(_program, _fragmentProgram));

VERIFY(glBindAttribLocation(_program, 0, "position"));
VERIFY(glBindAttribLocation(_program, 1, "normal"));

VERIFY(glLinkProgram(_program));

GLint isLinked = 0;
VERIFY(glGetProgramiv(_program, GL_LINK_STATUS, &isLinked));
if (isLinked == GL_FALSE)
{
//return false;
}

VERIFY(glDetachShader(_program, _vertexProgram));
VERIFY(glDeleteShader(_vertexProgram));

VERIFY(glDetachShader(_program, _fragmentProgram));
VERIFY(glDeleteShader(_fragmentProgram));

//initialize parameters
_mvp = glGetUniformLocation(_program, "mvp");
_lightdir1 = glGetUniformLocation(_program, "lightdir1");
_lightdir2 = glGetUniformLocation(_program, "lightdir2");
_lightdir3 = glGetUniformLocation(_program, "lightdir3");
_camerapos = glGetUniformLocation(_program, "camerapos");
_diffuse = glGetUniformLocation(_program, "diffuse");
_ambient = glGetUniformLocation(_program, "ambient");
_specular = glGetUniformLocation(_program, "specular");
_shininess = glGetUniformLocation(_program, "shininess");
_transparency = glGetUniformLocation(_program, "transparency");
_plane1 = glGetUniformLocation(_program, "plane1");
_plane2 = glGetUniformLocation(_program, "plane2");
_plane3 = glGetUniformLocation(_program, "plane3");
_plane4 = glGetUniformLocation(_program, "plane4");
_plane5 = glGetUniformLocation(_program, "plane5");
_plane6 = glGetUniformLocation(_program, "plane6");

//create mesh
VERIFY(glGenVertexArrays(1, &_vao));

//create vertex buffer
VERIFY(glGenBuffers(1, &_vertexBuffer));

VERIFY(glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer));

unsigned int _verticesSizeInBytes = sizeof(float) * 18;

VERIFY(glBufferData(GL_ARRAY_BUFFER,
static_cast<GLsizeiptr>(_verticesSizeInBytes),
nullptr,
GL_STATIC_DRAW));

//set _vertices
_vertices = new float[18];
_vertices[0] = 0.0f;
_vertices[1] = 10.0f;
_vertices[2] = 0.0f;
_vertices[3] = 0.0f;
_vertices[4] = 0.0f;
_vertices[5] = 1.0f;

_vertices[6] = 10.0f;
_vertices[7] = -10.0f;
_vertices[8] = 0.0f;
_vertices[9] = 0.0f;
_vertices[10] = 0.0f;
_vertices[11] = 1.0f;

_vertices[12] = -10.0f;
_vertices[13] = -10.0f;
_vertices[14] = 0.0f;
_vertices[15] = 0.0f;
_vertices[16] = 0.0f;
_vertices[17] = 1.0f;

VERIFY(glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer));
VERIFY(glBufferSubData(GL_ARRAY_BUFFER,
static_cast<GLintptr>(0),
static_cast<GLsizeiptr>(_verticesSizeInBytes),
(void*)_vertices));

//create index buffer
unsigned int indicesSizeInBytes = sizeof(uint32_t) * 3;

VERIFY(glGenBuffers(1, &_indexBuffer));
VERIFY(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer));
VERIFY(glBufferData(GL_ELEMENT_ARRAY_BUFFER,
static_cast<GLsizeiptr>(indicesSizeInBytes),
nullptr,
GL_STATIC_DRAW));

//set indices
_indices = new uint32_t[3];
_indices[0] = 0;
_indices[1] = 1;
_indices[2] = 2;

VERIFY(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer));
VERIFY(glBufferSubData(GL_ELEMENT_ARRAY_BUFFER,
static_cast<GLintptr>(0),
static_cast<GLsizeiptr>(indicesSizeInBytes),
(void*)_indices));


//set vertex buffer
VERIFY(glBindVertexArray(_vao));

VERIFY(glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer));

VERIFY(glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*) 0));

VERIFY(glVertexAttribPointer(1,
3,
GL_FLOAT,
GL_FALSE,
sizeof(Vertex),
(void*) (3 * sizeof(float))));

VERIFY(glEnableVertexAttribArray(0));
VERIFY(glEnableVertexAttribArray(1));

VERIFY(glBindVertexArray(0));


//set index buffer
VERIFY(glBindVertexArray(_vao));

VERIFY(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer));

VERIFY(glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*) 0));
VERIFY(glVertexAttribPointer(1,
3,
GL_FLOAT,
GL_FALSE,
sizeof(Vertex),
(void*) (3 * sizeof(float))));

VERIFY(glEnableVertexAttribArray(0));
VERIFY(glEnableVertexAttribArray(1));

VERIFY(glBindVertexArray(0));

_matrix = new GLfloat[16];
_matrix[0] = 1.112385f;
_matrix[1] = 0.000000f;
_matrix[2] = 0.000000f;
_matrix[3] = 0.000000f;
_matrix[4] = 0.000000f;
_matrix[5] = 1.732051f;
_matrix[6] = 0.000000f;
_matrix[7] = 0.000000f;
_matrix[8] = 0.000000f;
_matrix[9] = 0.000000f;
_matrix[10] = -1.000100f;
_matrix[11] = -1.000000f;
_matrix[12] = -2.780963f;
_matrix[13] = -1.991858f;
_matrix[14] = 13.950269f;
_matrix[15] = 14.148864f;
}

-(void) Deinitialize
{
VERIFY(glBindVertexArray(0));

VERIFY(glDeleteVertexArrays(1, &_vao));

VERIFY(glDeleteBuffers(1, &_indexBuffer));
VERIFY(glDeleteBuffers(1, &_vertexBuffer));

VERIFY(glDeleteProgram(_program));

delete [] _vertices;
delete [] _indices;

delete [] _matrix;
}

-(void) Draw
{
//clear buffers
static const GLfloat white[] = { 1.0f, 1.0f, 1.0f, 1.0f };
static const GLfloat one = 1.0f;

VERIFY(glClearBufferfv(GL_COLOR, 0, white));
VERIFY(glClearBufferfv(GL_DEPTH, 0, &one));

//opaque objects
VERIFY(glDisable(GL_BLEND));
VERIFY(glDepthMask(GL_TRUE));

//bind mesh
VERIFY(glBindVertexArray(_vao));

//use shader
VERIFY(glUseProgram(_program));

//feed parameters to shader
VERIFY(glUniform4f(_plane1, 0.0f, 0.0f, 0.0f, 0.0f));
VERIFY(glUniform4f(_plane2, 0.0f, 0.0f, 0.0f, 0.0f));
VERIFY(glUniform4f(_plane3, 0.0f, 0.0f, 0.0f, 0.0f));
VERIFY(glUniform4f(_plane4, 0.0f, 0.0f, 0.0f, 0.0f));
VERIFY(glUniform4f(_plane5, 0.0f, 0.0f, 0.0f, 0.0f));
VERIFY(glUniform4f(_plane6, 0.0f, 0.0f, 0.0f, 0.0f));

VERIFY(glUniformMatrix4fv(_mvp, 1, GL_FALSE, _matrix));

VERIFY(glUniform3f(_lightdir1, -0.52654082f, -0.57357651f, -0.62750691f));
VERIFY(glUniform3f(_lightdir2, 0.71984643f, 0.34202009f, 0.60402268f));
VERIFY(glUniform3f(_lightdir3, 0.45451951f, -0.76604438f, 0.45451951f));
VERIFY(glUniform3f(_camerapos, 0, 0, -200));

VERIFY(glUniform4f(_diffuse, 1.0f, 0.0f, 0.0f, 0.0f));
VERIFY(glUniform4f(_ambient, 1.0f, 0.0f, 0.0f, 0.0f));
VERIFY(glUniform4f(_specular, 1.0f, 1.0f, 1.0f, 1.0f));

VERIFY(glUniform1f(_shininess, 10.0f));

VERIFY(glUniform1f(_transparency, 0.5f));

//render indexed geometry
VERIFY(glDrawElementsBaseVertex(GL_TRIANGLES,
3,
GL_UNSIGNED_INT,
(GLvoid*)0,
0));


//unbind mesh
VERIFY(glBindVertexArray(0));


//transparent objects
VERIFY(glEnable(GL_BLEND));
VERIFY(glDepthMask(GL_FALSE));


VERIFY(glDisable(GL_BLEND));
VERIFY(glDepthMask(GL_TRUE));

//swap buffers
glFlush();
}

-(void) Resize:(float)width :(float)height
{
glViewport(0, 0, width, height);
}

@end

Dark Photon
05-13-2015, 12:01 PM
Please do use ... or
... blocks around your source code. It makes your code much more readable.