Quote:
Originally Posted by abhimanipal
Hi everybody I am trying to write my first open gl es app and I have run into a road block. The objective of this exercise is to draw a line between 2 points
This is my code
Code:
glEnableVertexAttribArray(GLKVertexAttribPosition);
glVertexAttribPointer(GLKVertexAttribPosition,
2, // Two components per vertex
GL_FLOAT,
GL_FALSE,
0, // Stride
myMagicVertices);
glDrawArrays(
GL_LINE_STRIP,
0, // Start Index
2); // Number of vertices to read
glDisableVertexAttribArray(GLKVertexAttribPosition);
However I am getting an error when I compile the code. The error is GLKVertexAttribPosition is not defined. I have included the following header files in my .h file
Code:
#import <OpenGLES/EAGL.h>
#import <OpenGLES/ES2/gl.h>
#import <OpenGLES/ES2/glext.h>
#import <OpenGLES/EAGLDrawable.h>
What am I doing wrong here
|
Oh boy. OpenGL ES 2.0 is gnarly stuff. I suggest finding a good book on the subject.
I always have to look this stuff up myself.
I have only just started using GLKit, so I don't know it well. At first I thought your use of the constant GLKVertexAttribPosition was flat wrong. However, I see that it is defined in GLKit.h.
I'm too tired right now to verify that that constant is what you want, but it's defined in GLKit.h, so you should add that #import:
Code:
#import <GLKit/GLKit.h>
I suspect that you actually want the constant GLKVertexAttrib, (or the standard OpenGL constant ATTRIB_VERTEX) but I might be wrong. Like I said, I'm too tired to figure it out right now.