I installed macOS Catalina Beta 6 and Xcode 11 Beta 6, and our SceneKit-based Catalyst app has completely stopped displaying nodes. It logs errors for most/all geometries. Does anyone know if there is a solution or workaround? Did I install Xcode wrong somehow?
2019-08-20 11:26:46.052986-0700 App[16236:879002] [SceneKit] Error: Compiler error while building render pipeline state for node <C3DNode:0x1021219a0 "Cube"
geometry: <C3DParametricGeometry<Box>:0x102121ad0 "box"
mesh: <C3DMesh 0x600003b27800 "(null)"
element0: <C3DMeshElement 0x600003b271e0 type:triangles primCount:12 channels:1 indexBytes:2 offset:0 acmr:2.000000 inst:1 dataSize:72 shared:0x0>
source position (channel:0) : <C3DMeshSource 0x6000029597a0(position) data:(0x600000d3d830) mut:0 count:24 type:float3 divisor:0 mtl:0 offset:0 stride:32>
source normal (channel:0) : <C3DMeshSource 0x600002959960(normal) data:(0x600000d3d830) mut:0 count:24 type:float3 divisor:0 mtl:0 offset:12 stride:32>
source texcoord (channel:0) : <C3DMeshSource 0x6000029598f0(texcoord) data:(0x600000d3d830) mut:0 count:24 type:float2 divisor:0 mtl:0 offset:24 stride:32>
renderable element0: <C3DMeshElement 0x600003b271e0 type:triangles primCount:12 channels:1 indexBytes:2 offset:0 acmr:2.000000 inst:1 dataSize:72 shared:0x0>
renderable source position: <C3DMeshSource 0x6000029597a0(position) data:(0x600000d3d830) mut:0 count:24 type:float3 divisor:0 mtl:0 offset:0 stride:32>
renderable source normal: <C3DMeshSource 0x600002959960(normal) data:(0x600000d3d830) mut:0 count:24 type:float3 divisor:0 mtl:0 offset:12 stride:32>
renderable source texcoord: <C3DMeshSource 0x6000029598f0(texcoord) data:(0x600000d3d830) mut:0 count:24 type:float2 divisor:0 mtl:0 offset:24 stride:32>
>
mat0: >
>
This is due to a Metal compiler issue in macOS Catalina 10.15 Beta 6.
It should be fixed in a future beta version.
Related
I'm trying to build Qt5.6 project in MSVS2013 express (i wrote all code under QtCreator in Linux). First of all in Visual studio it i could build it only in Release mode, and it works fine. Then i used windeployqt.exe utility for creating deployment pack. I also put assimp32.dll (i use it for model loading).
And everything works fine, except PIXEL_BUFFER functionality (I draw some stuff to texture in additional Framebuffer, make some analysis of drawing result, prepare another one texture and push it for drawing).
I've got some errors in Dependency Walker (msvcr90.dll, Dcomp.dll, API-MS-WIN-CORE-*.dll) even though i've installed every MS Redistributable crap that exist in this world.
Here the code that i try to use:
void AUVGBO::PrepareGBO(QOpenGLShaderProgram *shader) {
if (mEnabled) {
this->PrepareRender(shader, AUVCamera::PR_PROJECTION | AUVCamera::PR_VIEW | AUVCamera::PR_VIEW_POS | AUVCamera::PR_LIGHT | AUVCamera::PR_LIGHT_POS );
// Attach framebuffer for intermediate rendering
m_GL->glBindFramebuffer(GL_FRAMEBUFFER, mFBO);
m_GL->glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
m_GL->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
m_GL->glViewport(0, 0, mGBO_Width, mGBO_Height);
}
}
void AUVGBO::FinishGBO(QOpenGLShaderProgram *shader) {
// Read pixels from FBO texture
GLuint indexAsync = mPBO_inIndex;
GLuint indexSync = (mPBO_inIndex + 1) % PBO_NUM;
// Bind pixel buffer for asynchronous reading from framebuffer
m_GL->glReadBuffer(GL_COLOR_ATTACHMENT0);
m_GL->glBindBuffer(GL_PIXEL_PACK_BUFFER, mPBO_in[indexAsync]);
m_GL->glReadPixels(0, 0, mGBO_Width, mGBO_Height, GL_RGB, GL_FLOAT, 0); // This call will be async
if (firstAsyncCalls && ( indexSync != 0 )) {
mPBO_inIndex = indexSync;
return;
} else {
firstAsyncCalls = false;
}
// Bind pixel buffer which already has data fetched one step ago
m_GL->glBindBuffer(GL_PIXEL_PACK_BUFFER, mPBO_in[indexSync]);
memcpy(mGBO_Pixels,
m_GL->glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_WRITE),
mGBO_Size * 3 * sizeof(GLfloat));
m_GL->glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
m_GL->glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
// Swap buffer for sync/async readback
mPBO_inIndex = indexSync;
m_GL->glBindFramebuffer(GL_FRAMEBUFFER, 0);
so now every pixel in memory area [mGBO_Pixels : mGBO_Size * 3 * sizeof(GLfloat)] is black, but they should'not be black. I put (for test) 0.12345f value in third byte of every pixel
color = vec4(cos, length(r), 0.12345f, 1.0f);
but (mGBO_Pixels + 2) is 0.0 if i run exe file. But in VS everything is ok as i've already said ((mGBO_Pixels + 2) = 0.12345f).
I found some SO answers, where people said that it could be Qt openGL bugs (their application crashes on initializeGLContext() stuff), but in my situation pushing created texture to openGL is ok. So guess that i've made a mistake somewhere. It drives me crazy. huh. Wish Sara and John Conor with T800 go to Microsoft instead of Cyberdyne.
P.S. I create release build using Cmake in my Arch Linux, and everything work as Avtomat Kalashnikova, so at least in Linux Qt OpenGL stuff works. If i find enough time i will try to use Cmake with MinGW in Windows.
I'm learning OpenGL programming with the book OpenGL Programming Guide. But I cannot run the examples in the book with my Macbook. There are always dozens of errors when running even dealing with the first example Triangles. I wonder what should I do to run the examples in Red Book with Xcode.
[Platform Information]
Macbook Air, OS X 10.10, Xcode 6.1
[What did I try]
1. I deleted AppDelegate.* and main.m, and then create a cpp file triangles.cpp and copy the source code into it.(The source code will be attached at the end)
2. I added OpenGL.framework.
3. I manually installed glew, and added corresponding paths to Header Search Paths and Library Search Paths. And added -lGLEW to Other Linker Flags.
4. I manually installed freeglut, added corresponding paths to Header Search Paths and Library Search Paths, and added -lGLUT to Other Linker Flags, just under the instruction of Lazy Foo's OpenGL tutorial.
5. I added the directory of the source code attached to the Red Book into Header Search Paths and Library Search Paths so Xcode can find "vgl.h" and "LoadShaders.h". And LoadShaders.cpp was added to the project.
The reason I did step 3 and 4 is to make compiling succeed, otherwise, I would receive lots of errors such as :
Undefined symbols for architecture x86_64:
"_glutInitContextProfile", referenced from:
_main in main.o
In this way, however, the compiling was OK, but there's an error when I run it:
X Error of failed request: BadRequest (invalid request code or no such operation)
Major opcode of failed request: 34 (X_UngrabKey)
Serial number of failed request: 29
Current serial number in output stream: 29
Program ended with exit code: 1
I really wonder what is the right way to run the examples in Red Book on Mac OS X!
triangles.cpp:
#include <iostream>
using namespace std;
#include "vgl.h"
#include "LoadShaders.h"
enum VAO_IDs { Triangles, NumVAOs };
enum Buffer_IDs { ArrayBuffer, NumBuffers};
enum Attrib_IDs { vPosition = 0};
GLuint VAOs[NumVAOs];
GLuint Buffers[NumBuffers];
const GLuint NumVertices = 6;
void init(void)
{
glGenVertexArrays(NumVAOs, VAOs);
glBindVertexArray(VAOs[Triangles]);
GLfloat vertices[NumVertices][2] = {
{-0.90, -0.90},
{0.85, -0.90},
{-0.90, 0.85},
{0.90, -0.85},
{0.90, 0.90},
{-0.85, 0.90}
};
glGenBuffers(NumBuffers, Buffers);
glBindBuffer(GL_ARRAY_BUFFER, Buffers[ArrayBuffer]);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
ShaderInfo shaders[] = {
{GL_VERTEX_SHADER, "triangles.vert"},
{GL_FRAGMENT_SHADER, "triangles.frag"},
{GL_NONE, NULL}
};
GLuint program = LoadShaders(shaders);
glUseProgram(program);
glVertexAttribPointer(vPosition, 2, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0));
glEnableVertexAttribArray(vPosition);
}
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBindVertexArray(VAOs[Triangles]);
glDrawArrays(GL_TRIANGLES, 0, NumVertices);
glFlush();
}
int main(int argc, char ** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGBA);
glutInitWindowSize(512, 512);
glutInitContextVersion(4, 3);
glutInitContextProfile(GLUT_CORE_PROFILE);
glutCreateWindow(argv[0]);
if(glewInit())
{
cerr << "Unable to initialize GLEW ... exiting" << endl;
exit(EXIT_FAILURE);
}
init();
glutDisplayFunc(display);
glutMainLoop();
}
If you don't mind working in C# then look into OpenTK, it's an OpenGL wrapper for Mono and .Net. I haven't tried it with Xcode, but it works beautifully in Xamarin Studio.
If you go the Xamarin route, there are two options:
1) Download the latest OpenTK release and reference OpenTK.dll
2) Use the OpenTK included with Xamarin, instructions here.
I'd recommend downloading the external version, there are loads of helpful examples included.
Something to watch out for however is that on MacOS, the GameWindow constructor defaults to OpenGL 2.1 (doesn't on Windows), so if you want to use modern features you must explicitly specify the OpenGL version number in the constructor.
public Game() : base(800, 600, new GraphicsMode(new ColorFormat(8), 3, 3, 4), "Welcome To Hell", GameWindowFlags.Default, DisplayDevice.Default, 3, 0, GraphicsContextFlags.Default)
{
}
The Red Book examples won't run directly in OpenTK, but the GL calls are the same, the syntax just needs modifying. I found Neo Kabuto's blog the best for OpenTK tutorials, and after no time at all, you'll be able to re-write the Red Book code in TK.
This probably wasn't the answer you were looking for, but it's how I solved the problem.
I have a program which used to work fine on MAC OS X Lion.It uses OpenGL 3.2 Core profile.Now after I upgraded to Maverick it fails on glGenVertexArrays() right after context setup.The context is being created all right.What has changed in Maverick regarding OpenGL 3.2 setup?
I initialise the context like this:
static CGLPixelFormatAttribute attributes[4]={
kCGLPFAAccelerated,
kCGLPFAOpenGLProfile,
(CGLPixelFormatAttribute)kCGLOGLPVersion_3_2_Core,
(CGLPixelFormatAttribute)0
};
_errorCode = CGLChoosePixelFormat(attributes,&_pix,&_num);
if(_errorCode > 0){
throw ;
}
_errorCode = CGLCreateContext(_pix, NULL, &_context);
if(_errorCode > 0){
throw;
}
CGLDestroyPixelFormat(_pix);
_errorCode = CGLSetCurrentContext(_context);
if(_errorCode > 0){
throw ;
}
None of these throws an error till I am getting to VAO handle generation.Also glGetError returns some junk.
UPDATE:
I caught the error which is GL_INVALID_FRAMEBUFFER_OPERATION​, 0x0506 .And now it happens when I perform
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
when no custom framebuffer is bound.If I call the draw command with custom FBO it does work.My context creation has no display.It is offscreen.Can it be that with the newer implementation Apple enforces display to exist in order to access default FBO? On Lion I did the same and it worked.Btw,the GL version is 4.1.
I created a class derived from QGLWidget:
class OpenGLWidget : public QGLWidget
I want to write some text on top of the OpenGL widget. Therefore I used the renderText() method inside the paintGL() of my class:
QString s = QString("AaBbCcDd");
renderText(10, 20, s); // picture line 1
In the created text on top of my widget some letters are shifted downwards / upwards.
Have a look at this picture.
For example in the first line of the picture 'C', 'G', 'O' are shifted upwards and '4', '5' are shifted downwards.
I tried to change the font and the font size, but this only changed the letters, which are shifted, not the problem itself:
QFont font = QFont("Arial");
font.setPointSize(18);
renderText(10, 50, s, font); // picture line 2
font = QFont("Times");
font.setPointSize(18);
renderText(10, 80, s, font); // picture line 3
font = QFont("Courier");
font.setPointSize(18);
renderText(10, 110, s, font); // picture line 4
font = QFont("Courier");
font.setPointSize(16);
renderText(10, 140, s, font); // picture line 5
Does anybody know how to bring the letters on a straight line?
I also tried the QPainter::drawText() method instead of the renderText() inside the paintGL() of my class:
QPainter painter(this);
QString s = QString("AaBbCcDd");
painter.drawText(10, 20, s);
This method causes the same problem.
I am using Qt 4.7.4 with Qt Creator 2.4.1 on Mac OS 10.7.
This is a known bug in Qt 4.8.x. It affects Mac Qt-based applications that are run under OS X 10.7 and 10.8 (Lion and Mountain Lion). If you run your application under OS X 10.6 (Snow Leopard) you will not see the problem.
Qt 5.0.x fixes the renderText() problem for OS X 10.7 and 10.8 but is still too flaky to be used as a substitute for the more-solid 4.8.x builds.
Sadly, the Qt gods have not (yet) taken it upon themselves to retrofit the 4.8.x build with the fix from the 5.0.x build.
Does there exist a Haskell graphics library or binding to an external library that fulfills the following requirements:
Can be used from ghci, i.e. I don't have to link and restart the program.
Works on MacOS X. (Tricky in conjunction with 1!)
Can do simple vector graphics (lines, polygons, simple fills and strokes).
Can put bitmap images on screen. Example: blit a 17x12 .bmp image.
?
Please include a minimal source code example or a reference to it (just a window on screen, maybe with a green line drawn inside it) so that I can check the points 1. and 2. in particular. Also, if one of these feature requests is more elaborate (for example OpenGL + 4), please include a good reference.
PS: Concerning 1 and 2, I know about the enableGUI trick and I am willing to use it. However, most libraries have the problem that you can't run the main function multiple times and hence don't qualify.
Edit: To avoid wasting your time, here a list of packages that I've tried:
wx - ghci chokes on libstdc++
sdl - redefines main to be a macro. Compile-time only.
GLFW (OpenGL) - Can't run main twice, something about "failing because it can't install mouse event handler".
EDIT: Actually, I'm no longer sure. Several versions later, it seems that GLFW no longer works in GHCi on OS X.
It turns out that GLFW+OpenGL fulfills all four requirements!
You need to invoke ghci with ghci -framework Carbon.
You need the EnableGUI.hs file, which you can get here. Note that you can't load it right into GHCi, you have to comiple it, first.
OpenGL has a 2D projection mode where you can draw lines and polygons.
Bitmaps can be loaded as textures and put on polygons.
Here is a small example that puts a bitmap onto the screen. There are some restrictions on the bitmap: its dimensions must be a power of two (here 256) and it must be a .tga file (here "Bitmap.tga"). But since transparency is supported, this is not much of a problem.
You should be able to call main multiple times without problem. The key point is that you should not call GLFW.terminate.
import Graphics.Rendering.OpenGL as GL
import qualified Graphics.UI.GLFW as GLFW
import Graphics.Rendering.OpenGL (($=))
import Control.Monad
import EnableGUI
main = do
enableGUI
GLFW.initialize
-- open window
GLFW.openWindow (GL.Size 400 400) [GLFW.DisplayAlphaBits 8] GLFW.Window
GLFW.windowTitle $= "Bitmap Test"
-- enable alpha channel
GL.blend $= GL.Enabled
GL.blendFunc $= (GL.SrcAlpha, GL.OneMinusSrcAlpha)
-- set the color to clear background
GL.clearColor $= GL.Color4 0.8 0.8 0.8 0
-- set 2D orthogonal view inside windowSizeCallback because
-- any change to the Window size should result in different
-- OpenGL Viewport.
GLFW.windowSizeCallback $= \ size#(GL.Size w h) ->
do
GL.viewport $= (GL.Position 0 0, size)
GL.matrixMode $= GL.Projection
GL.loadIdentity
GL.ortho2D 0 (realToFrac w) (realToFrac h) 0
render <- initialize
loop render
GLFW.closeWindow
loop render = do
-- draw the entire screen
render
-- swap buffer
GLFW.swapBuffers
-- check whether ESC is pressed for termination
p <- GLFW.getKey GLFW.ESC
unless (p == GLFW.Press) $ do
-- sleep for 1ms to yield CPU to other applications
GLFW.sleep 0.001
-- only continue when the window is not closed
windowOpenStatus <- GLFW.getParam GLFW.Opened
unless (windowOpenStatus == False) $
loop render
-- rendering
initialize = do
-- load texture from file
GL.texture GL.Texture2D $= Enabled
[textureName] <- GL.genObjectNames 1
GL.textureBinding GL.Texture2D $= Just textureName
GL.textureFilter GL.Texture2D $= ((GL.Nearest, Nothing), GL.Nearest)
GLFW.loadTexture2D "Bitmap.tga" []
return $ do
GL.clear [GL.ColorBuffer]
GL.renderPrimitive GL.Quads $ do
GL.texCoord $ texCoord2 0 0
GL.vertex $ vertex3 (0) 256 0
GL.texCoord $ texCoord2 0 1
GL.vertex $ vertex3 (0) (0) 0
GL.texCoord $ texCoord2 1 1
GL.vertex $ vertex3 256 (0) 0
GL.texCoord $ texCoord2 1 0
GL.vertex $ vertex3 256 256 0
-- type signatures to avoid ambiguity
vertex3 :: GLfloat -> GLfloat -> GLfloat -> GL.Vertex3 GLfloat
vertex3 = GL.Vertex3
texCoord2 :: GLfloat -> GLfloat -> GL.TexCoord2 GLfloat
texCoord2 = GL.TexCoord2
color3 :: GLfloat -> GLfloat -> GLfloat -> GL.Color3 GLfloat
color3 = GL.Color3
Here an example bitmap (which you need to convert to .tga).
The Gtk2Hs library fulfills all the requirements if you use the X11 version of the gtk2 framework.
Concerning the requirements:
Using X11 avoids many problems.
Install gtk2 via MacPorts and use the +x11 option (default). (That said, I've had numerous problems installing gtk2 in the past, but this time it seemed to work.)
I would be surprised if GTK+ can't do that.
Ditto.
Here a minimal example
import Graphics.UI.Gtk
hello :: (ButtonClass o) => o -> IO ()
hello b = set b [buttonLabel := "Hello World"]
main :: IO ()
main = do
initGUI
window <- windowNew
button <- buttonNew
set window [windowDefaultWidth := 200, windowDefaultHeight := 200,
containerChild := button, containerBorderWidth := 10]
onClicked button (hello button)
onDestroy window mainQuit
widgetShowAll window
mainGUI
As of early 2014, I wasn't able to use #heinrich-apfelmus answer in Mac OS X. This GLFW-b example (link) however worked.
So, ensure you have:
$ cabal install glfw-b
and, if you tried Apfelmus' answer, you may need to
$ ghc-pkg list
$ ghc-pkg unregister GLFW-x.x.x.x
as both provide Graphics.UI.GLFW, and you will get an "Ambiguous module name 'Graphics.UI.GLFW'" from ghc. Then I just tried the sample program above and it worked (Mac OS X, 10.9, Mavericks)
Have you seen the GLFW as referenced http://plucky.cs.yale.edu/soe/software1.htm
More information on Haskell+GUI+OpenGL is available in this discussion:
http://www.haskell.org/pipermail/haskell-cafe/2011-May/091991.html