Browse other questions tagged swift opengl-es opengl-es-2.0 glkit. Perhaps I am not passing there might things into the matrix making function, or maybe im not getting it to the shader properly.ĮDIT: I have thrown up the project file incase you want to see how everything goes. Unfortunately switching that around in the vertex shader did nothing. Note: If you remove the multiplication with the matrix in the vertex shader the points show up, however obiously most of them are off screen because of how default OpenGL works.Īlso: I have tried using this function rather then glKit's method. GlUniformMatrix4fv(loc3, 1, GLboolean(GL_TRUE), &matrix) glUniformMatrix4fv(loc3, 1, GLboolean(GL_TRUE), &matrix) Let loc3 = glGetUniformLocation(program, "orthoMatrix") Passing it over to the shader func draw() Matrix = glkitmatrixtoarray( GLKMatrix4MakeOrtho(0, GLfloat(width), 0, GLfloat(height), -1, 1))įunc glkitmatrixtoarray(mat: GLKMatrix4) -> GlViewport(0, 0, GLsizei(height), GLsizei(width)) However If you have a custom function you think would better do this then that is fine! I can use it too. For the first step, the easiest thing to do is simply to add the shaders to the XCode project - they will automatically be copied to sit alongside the executable. I am using GLKit so it is theoretically making the orthographic matrix for me. You need to copy the shaders into the application bundle, and then you need to find out where your application bundle is. Gl_Position = vec4(position, 1) * orthoMatrix Īnd here is how I make the matrix.
SWIFT SHADER DOES NOTHING FOR GAMES CODE
So here is my code what exactly am I doing wrong? Swift shader 3 0 project is just experimental, and you can.
Unfortunately right now my efforts to get this going are in vain, and instead of having multiple points I have one in the dead center of the device (obviously they are all overlapping). It is a comprehensive program that permits a user to play massive games on a slow computer. Mostly at places like (0, 0), (width, height), (width / 2, height /2) etc so I can see if things are working right. Right now I am trying to plot a couple points on the screen. I am trying to get my coordinate space set up, so that the origin is at the bottom left of the screen, and the top right coordinates are (screen.width, screen.height).Īlso this is a COMPLETELY 2d engine, so no 3d stuff is needed.