Permalink
Browse files

removed metadata folder from repo

  • Loading branch information...
alihelmy committed Apr 22, 2012
1 parent 24a0c14 commit fa08557fef709c05195e48e5750facac63ec86f5
Showing with 4 additions and 2,699 deletions.
  1. +4 −1 .gitignore
  2. 0 .metadata/.lock
  3. +0 −39 .metadata/.log
  4. BIN .metadata/.mylyn/.taskListIndex/segments.gen
  5. BIN .metadata/.mylyn/.taskListIndex/segments_1
  6. BIN .metadata/.mylyn/repositories.xml.zip
  7. BIN .metadata/.mylyn/tasks.xml.zip
  8. +0 −141 .metadata/.plugins/org.eclipse.core.resources/.history/12/1050fe65858c0011174fca66da80c486
  9. +0 −7 .metadata/.plugins/org.eclipse.core.resources/.history/12/90b27db8858c0011174fca66da80c486
  10. +0 −95 .metadata/.plugins/org.eclipse.core.resources/.history/17/700c2efc898c00111f1581251e4956b9
  11. +0 −5 .metadata/.plugins/org.eclipse.core.resources/.history/1c/809bca70898c00111f1581251e4956b9
  12. +0 −106 .metadata/.plugins/org.eclipse.core.resources/.history/25/305948cb898c00111f1581251e4956b9
  13. +0 −94 .metadata/.plugins/org.eclipse.core.resources/.history/33/503646cb898c00111f1581251e4956b9
  14. +0 −58 .metadata/.plugins/org.eclipse.core.resources/.history/43/d0c805128a8c00111f1581251e4956b9
  15. +0 −93 .metadata/.plugins/org.eclipse.core.resources/.history/46/c00dd7abc18c00111abff6c8b064978b
  16. +0 −21 .metadata/.plugins/org.eclipse.core.resources/.history/4c/b0fcbe53858c0011174fca66da80c486
  17. +0 −21 .metadata/.plugins/org.eclipse.core.resources/.history/51/10020af8858c0011174fca66da80c486
  18. +0 −23 .metadata/.plugins/org.eclipse.core.resources/.history/53/40a8fb4e858c0011174fca66da80c486
  19. +0 −94 .metadata/.plugins/org.eclipse.core.resources/.history/55/0088cebe898c00111f1581251e4956b9
  20. +0 −141 .metadata/.plugins/org.eclipse.core.resources/.history/56/10c10066858c0011174fca66da80c486
  21. +0 −94 .metadata/.plugins/org.eclipse.core.resources/.history/57/20c78fa7c18c00111abff6c8b064978b
  22. +0 −93 .metadata/.plugins/org.eclipse.core.resources/.history/5b/002b90a9c18c00111abff6c8b064978b
  23. +0 −106 .metadata/.plugins/org.eclipse.core.resources/.history/63/c03110b9898c00111f1581251e4956b9
  24. +0 −21 .metadata/.plugins/org.eclipse.core.resources/.history/7f/106ef965858c0011174fca66da80c486
  25. +0 −7 .metadata/.plugins/org.eclipse.core.resources/.history/88/009f3073898c00111f1581251e4956b9
  26. +0 −98 .metadata/.plugins/org.eclipse.core.resources/.history/8a/3035c053858c0011174fca66da80c486
  27. +0 −133 .metadata/.plugins/org.eclipse.core.resources/.history/9d/30ca4acb898c00111f1581251e4956b9
  28. +0 −98 .metadata/.plugins/org.eclipse.core.resources/.history/b0/20b3f465858c0011174fca66da80c486
  29. +0 −141 .metadata/.plugins/org.eclipse.core.resources/.history/c3/b06dc153858c0011174fca66da80c486
  30. +0 −94 .metadata/.plugins/org.eclipse.core.resources/.history/cd/7042baf8898c00111f1581251e4956b9
  31. +0 −94 .metadata/.plugins/org.eclipse.core.resources/.history/d/d0740e2bc18c00111abff6c8b064978b
  32. +0 −133 .metadata/.plugins/org.eclipse.core.resources/.history/d1/b029debc898c00111f1581251e4956b9
  33. +0 −21 .metadata/.plugins/org.eclipse.core.resources/.history/d6/e069fb65858c0011174fca66da80c486
  34. +0 −94 .metadata/.plugins/org.eclipse.core.resources/.history/df/002db2d2bf8c00111abff6c8b064978b
  35. +0 −92 .metadata/.plugins/org.eclipse.core.resources/.history/f3/80942cb5c18c00111abff6c8b064978b
  36. +0 −98 .metadata/.plugins/org.eclipse.core.resources/.history/fd/304bf765858c0011174fca66da80c486
  37. BIN .metadata/.plugins/org.eclipse.core.resources/.projects/LessonOne/.indexes/2e/history.index
  38. BIN .metadata/.plugins/org.eclipse.core.resources/.projects/LessonOne/.indexes/7/2e/history.index
  39. BIN .metadata/.plugins/org.eclipse.core.resources/.projects/LessonOne/.indexes/e4/1e/e/history.index
  40. BIN .metadata/.plugins/org.eclipse.core.resources/.projects/LessonOne/.indexes/e4/history.index
  41. BIN .metadata/.plugins/org.eclipse.core.resources/.projects/LessonOne/.indexes/history.index
  42. BIN .metadata/.plugins/org.eclipse.core.resources/.projects/LessonOne/.markers
  43. BIN .metadata/.plugins/org.eclipse.core.resources/.projects/LessonOne/.markers.snap
  44. BIN .metadata/.plugins/org.eclipse.core.resources/.projects/LessonOne/.syncinfo.snap
  45. BIN .metadata/.plugins/org.eclipse.core.resources/.projects/LessonOne/org.eclipse.jdt.core/state.dat
  46. BIN .metadata/.plugins/org.eclipse.core.resources/.projects/LessonTwo/.indexes/3e/f4/history.index
  47. BIN .metadata/.plugins/org.eclipse.core.resources/.projects/LessonTwo/.indexes/81/df/3e/14/history.index
  48. BIN .metadata/.plugins/org.eclipse.core.resources/.projects/LessonTwo/.markers
  49. BIN .metadata/.plugins/org.eclipse.core.resources/.projects/LessonTwo/.markers.snap
  50. BIN .metadata/.plugins/org.eclipse.core.resources/.projects/LessonTwo/.syncinfo.snap
  51. BIN .metadata/.plugins/org.eclipse.core.resources/.projects/libs/.indexes/af/history.index
  52. BIN .metadata/.plugins/org.eclipse.core.resources/.projects/libs/.markers.snap
  53. BIN .metadata/.plugins/org.eclipse.core.resources/.projects/libs/.syncinfo.snap
  54. BIN .metadata/.plugins/org.eclipse.core.resources/.projects/libs/org.eclipse.jdt.core/state.dat
  55. +0 −1 .metadata/.plugins/org.eclipse.core.resources/.root/.indexes/history.version
  56. BIN .metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index
  57. +0 −1 .metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version
  58. BIN .metadata/.plugins/org.eclipse.core.resources/.root/.markers.snap
  59. BIN .metadata/.plugins/org.eclipse.core.resources/.root/2.tree
  60. BIN .metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources
  61. BIN .metadata/.plugins/org.eclipse.core.resources/.snap
  62. +0 −3 .metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ant.ui.prefs
  63. +0 −2 .metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs
  64. +0 −5 .metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.debug.ui.prefs
  65. +0 −8 .metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs
  66. +0 −2 .metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs
  67. +0 −19 .metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs
  68. +0 −2 .metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.m2e.discovery.prefs
  69. +0 −2 .metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.context.core.prefs
  70. +0 −2 .metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.java.ui.prefs
  71. +0 −2 .metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.monitor.ui.prefs
  72. +0 −2 .metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.team.cvs.ui.prefs
  73. +0 −2 .metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.team.ui.prefs
  74. +0 −4 .metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.editors.prefs
  75. +0 −7 .metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs
  76. +0 −3 .metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs
  77. +0 −5 .metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.workbench.prefs
  78. +0 −2 .metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.wst.sse.core.prefs
  79. +0 −3 ...ata/.plugins/org.eclipse.core.runtime/.settings/org.tigris.subversion.subclipse.tools.usage.prefs
  80. +0 −11 .metadata/.plugins/org.eclipse.debug.core/.launches/LessonOne.launch
  81. +0 −11 .metadata/.plugins/org.eclipse.debug.core/.launches/LessonTwo.launch
  82. +0 −11 .metadata/.plugins/org.eclipse.debug.ui/dialog_settings.xml
  83. +0 −25 .metadata/.plugins/org.eclipse.debug.ui/launchConfigurationHistory.xml
  84. +0 −1 .metadata/.plugins/org.eclipse.e4.workbench/deltas.xml
  85. BIN .metadata/.plugins/org.eclipse.jdt.core/1195944079.index
  86. BIN .metadata/.plugins/org.eclipse.jdt.core/1789169078.index
  87. BIN .metadata/.plugins/org.eclipse.jdt.core/2382864401.index
  88. BIN .metadata/.plugins/org.eclipse.jdt.core/2481996896.index
  89. BIN .metadata/.plugins/org.eclipse.jdt.core/2791608477.index
  90. BIN .metadata/.plugins/org.eclipse.jdt.core/2877109961.index
  91. BIN .metadata/.plugins/org.eclipse.jdt.core/3000053649.index
  92. BIN .metadata/.plugins/org.eclipse.jdt.core/3270002986.index
  93. BIN .metadata/.plugins/org.eclipse.jdt.core/3277441100.index
  94. BIN .metadata/.plugins/org.eclipse.jdt.core/3452083210.index
  95. BIN .metadata/.plugins/org.eclipse.jdt.core/3585733931.index
  96. BIN .metadata/.plugins/org.eclipse.jdt.core/3730526690.index
  97. BIN .metadata/.plugins/org.eclipse.jdt.core/4088397835.index
  98. BIN .metadata/.plugins/org.eclipse.jdt.core/4251467834.index
  99. BIN .metadata/.plugins/org.eclipse.jdt.core/externalLibsTimeStamps
  100. BIN .metadata/.plugins/org.eclipse.jdt.core/invalidArchivesCache
  101. +0 −1 .metadata/.plugins/org.eclipse.jdt.core/javaLikeNames.txt
  102. BIN .metadata/.plugins/org.eclipse.jdt.core/nonChainingJarsCache
  103. +0 −15 .metadata/.plugins/org.eclipse.jdt.core/savedIndexNames.txt
  104. BIN .metadata/.plugins/org.eclipse.jdt.core/variablesAndContainers.dat
  105. +0 −14 .metadata/.plugins/org.eclipse.jdt.debug.ui/dialog_settings.xml
  106. +0 −4 .metadata/.plugins/org.eclipse.jdt.launching/.install.xml
  107. +0 −22 .metadata/.plugins/org.eclipse.jdt.launching/libraryInfos.xml
  108. +0 −2 .metadata/.plugins/org.eclipse.jdt.ui/OpenTypeHistory.xml
  109. +0 −2 .metadata/.plugins/org.eclipse.jdt.ui/QualifiedTypeNameHistory.xml
  110. +0 −30 .metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml
  111. BIN .metadata/.plugins/org.eclipse.jdt.ui/jdt-images/0.png
  112. BIN .metadata/.plugins/org.eclipse.jdt.ui/jdt-images/1.png
  113. BIN .metadata/.plugins/org.eclipse.jdt.ui/jdt-images/2.png
  114. BIN .metadata/.plugins/org.eclipse.jdt.ui/jdt-images/3.png
  115. BIN .metadata/.plugins/org.eclipse.jdt.ui/jdt-images/4.png
  116. +0 −3 .../.plugins/org.eclipse.ltk.core.refactoring/.refactorings/LessonOne/2012/4/16/refactorings.history
  117. +0 −5 ...ta/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/LessonOne/2012/4/16/refactorings.index
  118. +0 −4 .../.plugins/org.eclipse.ltk.core.refactoring/.refactorings/LessonTwo/2012/4/16/refactorings.history
  119. +0 −1 ...ta/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/LessonTwo/2012/4/16/refactorings.index
  120. +0 −4 ...adata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/libs/2012/4/16/refactorings.history
  121. +0 −1 .metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/libs/2012/4/16/refactorings.index
  122. +0 −9 .metadata/.plugins/org.eclipse.ltk.ui.refactoring/dialog_settings.xml
  123. 0 .metadata/.plugins/org.eclipse.m2e.logback.configuration/0.log
  124. +0 −41 .metadata/.plugins/org.eclipse.m2e.logback.configuration/logback.1.1.0.20120320-0058.xml
  125. 0 .metadata/.plugins/org.eclipse.team.cvs.core/.running
  126. +0 −5 .metadata/.plugins/org.eclipse.ui.editors/dialog_settings.xml
  127. +0 −9 .metadata/.plugins/org.eclipse.ui.ide/dialog_settings.xml
  128. +0 −25 .metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml
  129. +0 −6 .metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml
  130. +0 −3 .metadata/.plugins/org.tigris.subversion.subclipse.ui/dialog_settings.xml
  131. +0 −1 .metadata/version.ini
View
@@ -1,5 +1,8 @@
#built Class files#
*.class
+#eclipse metadata
+.metadata/*
+
#build dir#
-bin/*
+bin/*
View
No changes.
View
@@ -1,39 +0,0 @@
-!SESSION 2012-04-22 16:28:49.157 -----------------------------------------------
-eclipse.buildId=I20120315-1300
-java.version=1.6.0_26
-java.vendor=Sun Microsystems Inc.
-BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_GB
-Framework arguments: -product org.eclipse.epp.package.java.product
-Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product
-
-!ENTRY org.eclipse.core.resources 2 10035 2012-04-22 16:28:51.949
-!MESSAGE The workspace exited with unsaved changes in the previous session; refreshing workspace to recover changes.
-
-!ENTRY org.eclipse.jdt.ui 4 10001 2012-04-22 16:46:57.956
-!MESSAGE Internal Error
-!STACK 1
-Java Model Exception: Java Model Status [Timed out while retrieving the attached javadoc for BufferedReader [in BufferedReader.class [in java.io [in C:\Program Files\Java\jre6\lib\rt.jar]]] ]
- at org.eclipse.jdt.internal.core.JavaElement.getURLContents(JavaElement.java:808)
- at org.eclipse.jdt.internal.core.BinaryType.getJavadocContents(BinaryType.java:1037)
- at org.eclipse.jdt.internal.core.BinaryMethod.getAttachedJavadoc(BinaryMethod.java:643)
- at org.eclipse.jdt.internal.ui.text.javadoc.JavadocContentAccess2.getHTMLContent(JavadocContentAccess2.java:465)
- at org.eclipse.jdt.internal.ui.text.java.ProposalInfo.extractJavadoc(ProposalInfo.java:95)
- at org.eclipse.jdt.internal.ui.text.java.ProposalInfo.computeInfo(ProposalInfo.java:75)
- at org.eclipse.jdt.internal.ui.text.java.ProposalInfo.getInfo(ProposalInfo.java:58)
- at org.eclipse.jdt.internal.ui.text.java.AbstractJavaCompletionProposal.getAdditionalProposalInfo(AbstractJavaCompletionProposal.java:555)
- at org.eclipse.jface.text.contentassist.AdditionalInfoController$3.run(AdditionalInfoController.java:106)
- at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
-!SUBENTRY 1 org.eclipse.jdt.core 4 1012 2012-04-22 16:46:57.957
-!MESSAGE Timed out while retrieving the attached javadoc for BufferedReader [in BufferedReader.class [in java.io [in C:\Program Files\Java\jre6\lib\rt.jar]]]
-!SESSION 2012-04-22 23:08:23.176 -----------------------------------------------
-eclipse.buildId=I20120315-1300
-java.version=1.6.0_26
-java.vendor=Sun Microsystems Inc.
-BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_GB
-Framework arguments: -product org.eclipse.epp.package.java.product
-Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product
-
-!ENTRY org.eclipse.help.base 4 4 2012-04-22 23:20:02.119
-!MESSAGE Help documentation could not be indexed completely.
-!SUBENTRY 1 org.eclipse.help.base 4 4 2012-04-22 23:20:02.119
-!MESSAGE Help document /org.eclipse.mylyn.help.ui/doc/notices.html cannot be opened.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,141 +0,0 @@
-package lwjgltutorial.lessonOne;
-
-import static org.lwjgl.opengl.ARBShaderObjects.*;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.IntBuffer;
-
-import org.lwjgl.BufferUtils;
-import org.lwjgl.opengl.ARBFragmentShader;
-import org.lwjgl.opengl.ARBVertexShader;
-import static org.lwjgl.opengl.GL11.*;
-
-public class ShaderTriangle {
-
- private int shader, vertexShader, fragmentShader;
- private boolean useShaders;
-
- public static boolean verboseValidityCheck=false;
- private static final String SHADERS_ROOT_PATH="shaders";
-
- public ShaderTriangle() {
- this.shader=0;
- this.vertexShader=0;
- this.fragmentShader=0;
- this.useShaders=false;
- this.initShaders();
- }
-
- private void initShaders() {
- //create the main shader program
- this.shader=glCreateProgramObjectARB();
- if(this.shader!=0) { //if passed, create sub shaders
- this.vertexShader=createVertexShader(SHADERS_ROOT_PATH+File.separator+"screen.vert");
- this.fragmentShader=createFragmentShader(SHADERS_ROOT_PATH+File.separator+"screen.frag");
- if(this.vertexShader!=0 && this.fragmentShader!=0) {
- //add in shaders to main program
- glAttachObjectARB(this.shader, this.vertexShader);
- glAttachObjectARB(this.shader, this.fragmentShader);
- glLinkProgramARB(this.shader);
- glValidateProgramARB(this.shader);
- this.useShaders=true;
- }
- }
- }
-
- public void draw() {
- if(useShaders) { //use the shader linked
- glUseProgramObjectARB(this.shader);
- }
-
- glLoadIdentity();
- //red, which will show if our fragment shader doesn't work
- glColor3f(1.0f, 0.0f, 0.0f);
-
- drawVertices();
-
- //free up use of shader program
- glUseProgramObjectARB(0);
- }
-
- protected void drawVertices() {
- //drawn at 0.0 in z axis, so wont show if vertex shader doesn't work
- glBegin(GL_TRIANGLES);
- glVertex2f(0.0f, 0.8f);
- glVertex2f(-0.8f, -0.8f);
- glVertex2f(0.8f, -0.8f);
- glEnd();
- }
-
- private int createFragmentShader(String pathToShaderFile) {
- int fragmentShader=createShader(pathToShaderFile, ARBFragmentShader.GL_FRAGMENT_SHADER_ARB);
- return fragmentShader;
- }
-
- private int createVertexShader(String pathToShaderFile) {
- int vertexShader=createShader(pathToShaderFile, ARBVertexShader.GL_VERTEX_SHADER_ARB);
- return vertexShader;
- }
-
- private int createShader(String pathToShaderFile, int shaderType) {
- int newShader=glCreateShaderObjectARB(shaderType);
- if(newShader!=0) {
- String shaderCode=readInShaderCodeFromShaderFile(pathToShaderFile);
- if(shaderCode!=null && !shaderCode.isEmpty()) {
- glShaderSourceARB(newShader, shaderCode);
- glCompileShaderARB(newShader);
- if(isShaderValid(newShader)) {
- return newShader;
- }
- }
- }
- //if anything fails, return 0 as error code
- return 0;
- }
-
- private String readInShaderCodeFromShaderFile(String pathToShaderFile) {
- try {
- BufferedReader bufferedReader=new BufferedReader(new FileReader(pathToShaderFile));
- StringBuffer shaderCodeBuffer=new StringBuffer();
- String codeLine=bufferedReader.readLine();
- while(codeLine!=null) {
- shaderCodeBuffer.append(codeLine+"\n");
- codeLine=bufferedReader.readLine();
- }
- return shaderCodeBuffer.toString();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- return null;
- }
- }
-
- private boolean isShaderValid(int shaderToCheck) {
- IntBuffer iVal = BufferUtils.createIntBuffer(1);
- glGetObjectParameterARB(shaderToCheck, GL_OBJECT_INFO_LOG_LENGTH_ARB, iVal);
- int length = iVal.get();
- boolean isValid = length>1;
-
- if (isValid && verboseValidityCheck) {
- printShaderLogInfo(shaderToCheck, iVal, length);
- }
-
- return isValid;
- }
-
- private void printShaderLogInfo(int shaderToCheck, IntBuffer iVal,
- int length) {
- ByteBuffer infoLog = BufferUtils.createByteBuffer(length);
- iVal.flip();
- glGetInfoLogARB(shaderToCheck, iVal, infoLog);
- byte[] infoBytes = new byte[length];
- infoLog.get(infoBytes);
- String out = new String(infoBytes);
- System.out.println("Info log:\n"+out);
- }
-
-}
@@ -1,7 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
@@ -1,95 +0,0 @@
-package lwjgltutorial.lessonTwo;
-
-import static org.lwjgl.opengl.ARBShaderObjects.GL_OBJECT_INFO_LOG_LENGTH_ARB;
-import static org.lwjgl.opengl.ARBShaderObjects.glCompileShaderARB;
-import static org.lwjgl.opengl.ARBShaderObjects.glCreateShaderObjectARB;
-import static org.lwjgl.opengl.ARBShaderObjects.glGetInfoLogARB;
-import static org.lwjgl.opengl.ARBShaderObjects.glGetObjectParameterARB;
-import static org.lwjgl.opengl.ARBShaderObjects.glShaderSourceARB;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.IntBuffer;
-
-import org.lwjgl.BufferUtils;
-import org.lwjgl.opengl.ARBFragmentShader;
-import org.lwjgl.opengl.ARBVertexShader;
-
-public class ShaderUtilities {
-
- private static boolean verboseValidityCheck=false;
- private static final String SHADERS_ROOT_PATH="shaders";
-
- public static int createFragmentShader(String pathToShaderFile) {
- int fragmentShader=createShader(pathToShaderFile, ARBFragmentShader.GL_FRAGMENT_SHADER_ARB);
- return fragmentShader;
- }
-
- public static int createVertexShader(String pathToShaderFile) {
- int vertexShader=createShader(pathToShaderFile, ARBVertexShader.GL_VERTEX_SHADER_ARB);
- return vertexShader;
- }
-
- public static int createShader(String shaderFileName, int shaderType) {
- String shaderFilePath=SHADERS_ROOT_PATH+File.separator+shaderFileName;
- int newShader=glCreateShaderObjectARB(shaderType);
- if(newShader!=0) {
- String shaderCode=readInShaderCodeFromShaderFile(shaderFilePath);
- if(shaderCode!=null && !shaderCode.isEmpty()) {
- glShaderSourceARB(newShader, shaderCode);
- glCompileShaderARB(newShader);
- if(isShaderValid(newShader)) {
- return newShader;
- }
- }
- }
- //if anything fails, return 0 as error code
- return 0;
- }
-
- private static String readInShaderCodeFromShaderFile(String pathToShaderFile) {
- try {
- BufferedReader bufferedReader=new BufferedReader(new FileReader(pathToShaderFile));
- StringBuffer shaderCodeBuffer=new StringBuffer();
- String codeLine=bufferedReader.readLine();
- while(codeLine!=null) {
- shaderCodeBuffer.append(codeLine+"\n");
- codeLine=bufferedReader.readLine();
- }
- bufferedReader.close();
- return shaderCodeBuffer.toString();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- return null;
- }
- }
-
- public static boolean isShaderValid(int shaderToCheck) {
- IntBuffer iVal = BufferUtils.createIntBuffer(1);
- glGetObjectParameterARB(shaderToCheck, GL_OBJECT_INFO_LOG_LENGTH_ARB, iVal);
- int length = iVal.get();
- boolean isValid = length>1;
-
- if (isValid && verboseValidityCheck) {
- printShaderLogInfo(shaderToCheck, iVal, length);
- }
-
- return isValid;
- }
-
- private static void printShaderLogInfo(int shaderToCheck, IntBuffer iVal,
- int length) {
- ByteBuffer infoLog = BufferUtils.createByteBuffer(length);
- iVal.flip();
- glGetInfoLogARB(shaderToCheck, iVal, infoLog);
- byte[] infoBytes = new byte[length];
- infoLog.get(infoBytes);
- String out = new String(infoBytes);
- System.out.println("Info log:\n"+out);
- }
-
-}
@@ -1,5 +0,0 @@
-#version 120
-attribute vec2 coord2d;
-void main(void) {
- gl_Position = vec4(coord2d, 0.0, 1.0);
-}
Oops, something went wrong.

0 comments on commit fa08557

Please sign in to comment.