Skip to content

Commit

Permalink
Port Courtney's fix of vertex attribute for gles3init
Browse files Browse the repository at this point in the history
  • Loading branch information
ggfan committed Oct 12, 2016
1 parent f4f65fc commit 36c1ed3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ Known Issues

For samples using `Android.mk` build system with `ndk-build` see the [android-mk](https://github.com/googlesamples/android-ndk/tree/android-mk) branch.


Build Steps
----------
- With Android Studio: use "Import Project(Eclipse ADT, Gradle, etc)" or "File" > "Import Projec"t option
- On Command Line/Terminal: make sure set up ANDROID_HOME and ANDROID_NDK_HOME to local installation of SDK and NDK, then go to individual sample dir, and use "gradlew assembleDebug"

Support
-------

Expand Down
2 changes: 1 addition & 1 deletion gles3jni/app/src/main/cpp/RendererES2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ void RendererES2::draw(unsigned int numInstances) {
glUseProgram(mProgram);

glBindBuffer(GL_ARRAY_BUFFER, mVB);
glVertexAttribPointer(mPosAttrib, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid*)offsetof(Vertex, pos));
glVertexAttribPointer(mPosAttrib, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid*)offsetof(Vertex, pos));
glVertexAttribPointer(mColorAttrib, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Vertex), (const GLvoid*)offsetof(Vertex, rgba));
glEnableVertexAttribArray(mPosAttrib);
glEnableVertexAttribArray(mColorAttrib);
Expand Down
2 changes: 1 addition & 1 deletion gles3jni/app/src/main/cpp/RendererES3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ bool RendererES3::init() {
glBindVertexArray(mVBState);

glBindBuffer(GL_ARRAY_BUFFER, mVB[VB_INSTANCE]);
glVertexAttribPointer(POS_ATTRIB, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid*)offsetof(Vertex, pos));
glVertexAttribPointer(POS_ATTRIB, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid*)offsetof(Vertex, pos));
glVertexAttribPointer(COLOR_ATTRIB, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Vertex), (const GLvoid*)offsetof(Vertex, rgba));
glEnableVertexAttribArray(POS_ATTRIB);
glEnableVertexAttribArray(COLOR_ATTRIB);
Expand Down

0 comments on commit 36c1ed3

Please sign in to comment.