Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (808)
Games in Android Showcase (239)
games submitted by our members
Games in WIP (872)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Newbie & Debugging Questions / Re: JOGL Shader Linking Issues on: 2015-09-26 13:53:12
Thanks for the replies, I'll be sure to fix up the static GL object issue. But referring to your statement that I'm not loading or creating a texture, I'm not entirely sure what you mean. https://github.com/DonDrews/DominationIVClient/blob/master/src/render/RenderUtils.java#L315-L321 <- That is how I'm doing it currently, but for all I know this could be a very outdated/wrong approach. I saw in your code that you used textures mostly in the standard OpenGL way. glBindTexture2D() and the like. I just saw a few different people using the other approach and assumed that was somehow the "correct" way to do it in JOGL. I don't believe the documentation says either are deprecated.
2  Game Development / Newbie & Debugging Questions / Re: JOGL Shader Linking Issues on: 2015-09-21 14:58:44
Quote
You sure you didn't mean in your fragment shader? Because that is where the "out vec4" should be.. check that

What are you trying to render? Start from a basic scenario and the build on.. is at least the clearing color working?

If you can, show us some of your code

I checking and the output is infact from the vertex shader, it's a vec2 for the texture coordinates.

Basically, I'm trying to render a single quad "the background" with a texture. I tried changing the clear color and the clearing is definitely working, so I believe the context is set up correctly. Perhaps I don't have the geometry in the right place? I've tried moving it around but to no avail.  Sad

Anywho, if you'd like to take a look at the code here's a link to the repositiory: https://github.com/DonDrews/DominationIVClient/tree/master/src/render

Most of the related code is under /src/render. I should probably mention that this project is being ported from Java2D.

Thanks for showing an interest by the way, opengl can be rather confusing when you're new to it.
3  Game Development / Newbie & Debugging Questions / Re: JOGL Shader Linking Issues on: 2015-09-20 17:59:14
Thanks, I tried your way of loading shaders and it not only cleaned up my code, it also let me see what the linking error actually was. Can't believe I had never heard of doing it that way before.

Anyways, it turned out that I had forgot to put a data type in a "out" variable in my vertex shader. The program doesn't crash now, but just has a black screen  Huh. I'm sure I'll figure it out eventually though.

Thanks again, couldn't have done it without your help.
4  Game Development / Newbie & Debugging Questions / JOGL Shader Linking Issues on: 2015-09-17 00:50:02
So recently I have been working on porting a game from Java2D to JOGL. The process has been going well, but I ran into an error about 2 weeks ago and it's been pretty elusive. I did the shaders like I've done in all my other projects, but this is the error I'm getting:

GLDebugEvent[ id 0x1
   type Error
   severity High: dangerous undefined behavior
   source GL API
   msg GL_INVALID_OPERATION in glGetAttribLocation(program not linked)
   when 1442422448181
   source 3.3 (Core profile, arb, debug, compat[ES2, ES3], FBO, hardware) - 3.3 (Core Profile) Mesa 10.6.2 - hash 0x6009cf80]

Here is the code for loading shaders:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
      shaders[B_V] = glo.glCreateShader(GL3.GL_VERTEX_SHADER);
      shaders[B_F] = glo.glCreateShader(GL3.GL_FRAGMENT_SHADER);
      shaders[U_V] = glo.glCreateShader(GL3.GL_VERTEX_SHADER);
      shaders[U_F] = glo.glCreateShader(GL3.GL_FRAGMENT_SHADER);
     
      String tempString = "";
     
      try {
         //Background vertex shader
         BufferedReader read = new BufferedReader(new InputStreamReader(RenderUtils.class.getResourceAsStream("BackgroundShaderV.glsl")));
         while((tempString = read.readLine()) != null)
         {
            shaderSources[B_V][0] += (tempString + System.lineSeparator());
         }
         
         tempString = "";
         
         //Background fragment shader
         read = new BufferedReader(new InputStreamReader(RenderUtils.class.getResourceAsStream("BackgroundShaderF.glsl")));
         while((tempString = read.readLine()) != null)
         {
            shaderSources[B_F][0] += (tempString + System.lineSeparator());
         }
         
         tempString = "";
         
         //Unit vertex shader
         read = new BufferedReader(new InputStreamReader(RenderUtils.class.getResourceAsStream("UnitShaderV.glsl")));
         while((tempString = read.readLine()) != null)
         {
            shaderSources[U_V][0] += (tempString + System.lineSeparator());
         }
         
         tempString = "";
         
         //Unit fragment shader
         read = new BufferedReader(new InputStreamReader(RenderUtils.class.getResourceAsStream("UnitShaderF.glsl")));
         while((tempString = read.readLine()) != null)
         {
            shaderSources[U_F][0] += (tempString + System.lineSeparator());
         }
         
         //compile shaders
         glo.glShaderSource(shaders[B_V], 1, shaderSources[B_V], null, 0);
         glo.glCompileShader(shaders[B_V]);
         
         glo.glShaderSource(shaders[B_F], 1, shaderSources[B_F], null, 0);
         glo.glCompileShader(shaders[B_F]);
         
         glo.glShaderSource(shaders[U_V], 1, shaderSources[U_V], null, 0);
         glo.glCompileShader(shaders[U_V]);
         
         glo.glShaderSource(shaders[U_F], 1, shaderSources[U_F], null, 0);
         glo.glCompileShader(shaders[U_F]);
         
         //link shaders
         backgroundShader = glo.glCreateProgram();
         glo.glAttachShader(backgroundShader, shaders[B_V]);
         glo.glAttachShader(backgroundShader, shaders[B_F]);
         glo.glLinkProgram(backgroundShader);
         
         unitShader = glo.glCreateProgram();
         glo.glAttachShader(unitShader, shaders[U_V]);
         glo.glAttachShader(unitShader, shaders[U_F]);
         glo.glLinkProgram(unitShader);
         
         
         glo.glUseProgram(backgroundShader);


If anyone has run into this issue before and could give some advice it would be most appreciated.
5  Game Development / Newbie & Debugging Questions / Re: Avoiding JOGL Artifacts on: 2015-04-03 04:10:22
Thanks! I made the far/near planes 10 times closer and it fixed the issue.

As for making all the vertices reused, would I have to use a glDrawElements approach for this?
6  Game Development / Newbie & Debugging Questions / Re: Avoiding JOGL Artifacts on: 2015-04-02 23:08:21
The shape is randomly generated. The vertices are done by a mostly hardcoded design of turning cubes into 12 seperate polygons. Here's the method:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
void putCube(int x, int y, int z)
   {
            //x normals
            for(int j = 0; j < 6; j++)
            {
               normals.put(-1);
               normals.put(0);
               normals.put(0);
            }
            for(int j = 0; j < 6; j++)
            {
               normals.put(1);
               normals.put(0);
               normals.put(0);
            }
            //x perpendicular sides
            for(int i = 0; i < 2; i++)
            {
               //triangles per side
               for(int j = 0; j < 2; j++)
               {
                  //vertex 1
                  vertices.put(i + x);
                  vertices.put(0 + y);
                  vertices.put(0 + z);
                  //vertex 2
                  vertices.put(i + x);
                  vertices.put(j + y);
                  if(j == 0)
                  {
                     vertices.put(1 + z);
                  }
                  else
                  {
                     vertices.put(0 + z);
                  }
                  //vertex 3
                  vertices.put(i + x);
                  vertices.put(1 + y);
                  vertices.put(1 + z);
               }
            }
            //y normals
            for(int j = 0; j < 6; j++)
            {
               normals.put(0);
               normals.put(-1);
               normals.put(0);
            }
            for(int j = 0; j < 6; j++)
            {
               normals.put(0);
               normals.put(1);
               normals.put(0);
            }
            //y perpendicular sides
            for(int i = 0; i < 2; i++)
            {
               //triangles per side
               for(int j = 0; j < 2; j++)
               {
                  //vertex 1
                  vertices.put(0 + x);
                  vertices.put(i + y);
                  vertices.put(0 + z);
                  //vertex 2
                  vertices.put(j + x);
                  vertices.put(i + y);
                  if(j == 0)
                  {
                     vertices.put(1 + z);
                  }
                  else
                  {
                     vertices.put(0 + z);
                  }
                  //vertex 3
                  vertices.put(1 + x);
                  vertices.put(i + y);
                  vertices.put(1 + z);
               }
            }
            //z normals
            for(int j = 0; j < 6; j++)
            {
               normals.put(0);
               normals.put(0);
               normals.put(-1);
            }
            for(int j = 0; j < 6; j++)
            {
               normals.put(0);
               normals.put(0);
               normals.put(1);
            }
            //z perpendicular sides
            for(int i = 0; i < 2; i++)
            {
               //triangles per side
               for(int j = 0; j < 2; j++)
               {
                  //vertex 1
                  vertices.put(0 + x);
                  vertices.put(0 + y);
                  vertices.put(i + z);
                  //vertex 2
                  vertices.put(j + x);
                  if(j == 0)
                  {
                     vertices.put(1 + y);
                  }
                  else
                  {
                     vertices.put(0 + y);
                  }
                  vertices.put(i + z);
                  //vertex 3
                  vertices.put(1 + x);
                  vertices.put(1 + y);
                  vertices.put(i + z);
               }
            }
   }


Sorry about the indenting. Maybe it's because I'm putting ints into a FloatBuffer?
7  Game Development / Newbie & Debugging Questions / Re: Avoiding JOGL Artifacts on: 2015-04-02 22:28:40
Thanks for the help. I have checked through the code and I can confirm there aren't any setups like the one in your diagram. However, I'm still not sure how to make sure vertices are bitwise identical. Is there a certain way you are supposed to put vertices into buffers?
8  Game Development / Newbie & Debugging Questions / Avoiding JOGL Artifacts on: 2015-04-02 22:00:42
So I have been working on a rather simple program that just renders a shape. However, as it's rendering, it has some miscalculated pixels around where the polygons meet. From my experience with ray tracing, I know these things are usually caused by a precision error. Does anyone know a workaround to this?



(I have turned off AA in order to emphasize the effect for demonstration purposes.)
9  Game Development / Newbie & Debugging Questions / Re: JOGL init() method not being called on: 2015-03-22 16:31:39
Thanks for the help! It didn't render anything but now the functions are being called.

I'll ask any additional questions on the JOGL forums, I honestly didn't even know there was such a thing.
10  Game Development / Newbie & Debugging Questions / JOGL init() method not being called on: 2015-03-22 05:04:12
I have been working on a JOGL program for a few weeks, and I found that the init() method in my event listener is never being called. If anyone could help me out with this I would greatly appreciate it.

Main Class:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
package mainLoop;

import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLDrawableFactory;
import javax.media.opengl.GLProfile;
import javax.media.opengl.awt.GLCanvas;
import javax.swing.JFrame;
import javax.swing.JPanel;

import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.util.FPSAnimator;

public class MainFrame extends JFrame {

   public static MainFrame frame;
   public static JPanel panel;
   public static GLCapabilities glCaps;
   public static GLCanvas canvas;
   public static FPSAnimator animator;
   
   public MainFrame(String s)
   {
      super(s);
   }

   public static void main(String[] args)
   {
      frame = new MainFrame("GL Test");
      frame.setSize(1280, 720);
      panel = new JPanel();
      panel.setSize(1280, 720);
      frame.add(panel);
      frame.setDefaultCloseOperation(MainFrame.EXIT_ON_CLOSE);
      GLProfile.initSingleton();
      glCaps = new GLCapabilities(GLProfile.get(GLProfile.GL3));
      canvas = new GLCanvas(glCaps);
      canvas.addGLEventListener(new JOGLEventListener());
      animator = new FPSAnimator(60);
      panel.add(canvas);
      animator.add(canvas);
      animator.start();
      frame.setVisible(true);
   }
}


Event Listener Class:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
package mainLoop;

import java.io.IOException;
import java.nio.FloatBuffer;

import javax.media.opengl.GL;
import javax.media.opengl.GL2ES2;
import javax.media.opengl.GL3;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.fixedfunc.GLMatrixFunc;

import com.jogamp.opengl.util.PMVMatrix;

import shaders.ShaderLoader;

public class JOGLEventListener implements GLEventListener{
   
   GL3 gl;

   @Override
   public void display(GLAutoDrawable arg0)
   {
      gl = (GL3) arg0.getGL();
      gl.glDrawArrays(GL.GL_TRIANGLES, 0, 3);
   }

   @Override
   public void dispose(GLAutoDrawable arg0)
   {
     
     
   }

   @Override
   public void init(GLAutoDrawable gld)
   {
      gl = (GL3) gld.getGL();
      int[] array = new int[1];
      gl.glGenVertexArrays(1, array, 0);
      gl.glBindVertexArray(array[0]);
      gl.glEnable(GL.GL_DEPTH_TEST);
      gl.glDepthFunc(GL.GL_LEQUAL);
      int[] buffer = new int[1];
      gl.glGenBuffers(1, buffer, 0);
      gl.glBindBuffer(GL.GL_ARRAY_BUFFER, buffer[0]);
      FloatBuffer vertices = FloatBuffer.allocate(9);
      vertices.put(1);
      vertices.put(0);
      vertices.put(-3);
      vertices.put(0);
      vertices.put(0);
      vertices.put(-3);
      vertices.put(0);
      vertices.put(1);
      vertices.put(-3);
      vertices.rewind();
      gl.glBufferData(GL.GL_ARRAY_BUFFER, 12 * Float.BYTES, vertices, GL.GL_STATIC_DRAW);
      try {
         gl = ShaderLoader.getShaderProgram((GL3) gl);
      } catch (IOException e) {
         System.exit(0);
         e.printStackTrace();
      }
      //make matrices
      PMVMatrix matrixMaker = new PMVMatrix();
      matrixMaker.gluLookAt(10, 10, 10, 0, 0, 0, -1, -1, 1);
      matrixMaker.gluPerspective(90, 16.0f/9.0f, 0.1f, 100);
      //apply to uniform
      int tempLoc = gl.glGetUniformLocation(ShaderLoader.finalShader, "uniform_Projection");
      gl.glUniformMatrix4fv(tempLoc, 1, false, matrixMaker.glGetMatrixf());
      //set up attributes
      tempLoc = gl.glGetAttribLocation(ShaderLoader.finalShader, "attribute_Position");
      gl.glVertexAttribPointer(tempLoc, 3, GL.GL_FLOAT, false, 0, 0);
      gl.glEnableVertexAttribArray(array[0]);
   }

   @Override
   public void reshape(GLAutoDrawable arg0, int arg1, int arg2, int arg3, int arg4)
   {
     
   }
   
   
   
   

}


If it helps, I am using java 8 on windows 8.1
11  Game Development / Newbie & Debugging Questions / Unsure About JOGL Basics on: 2015-03-21 23:45:19
This is my first post on JGO so I apologize if it seems weirdly worded.

So for the past week or so I have been working on my first JOGL program. Lots of information on the internet is conflicting, so I am not entirely sure I am doing this right. I am trying to render a single triangle and all I get is just a blank frame. If anybody could take a look at my code and point me in the right direction it would be greatly appreciated. This is using java 8 if it makes any difference.

Main Class: (MainFrame)
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
package mainLoop;

import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLDrawableFactory;
import javax.media.opengl.GLProfile;
import javax.media.opengl.awt.GLCanvas;
import javax.swing.JFrame;
import javax.swing.JPanel;

import com.jogamp.opengl.util.Animator;

public class MainFrame extends JFrame {

   public static MainFrame frame;
   public static JPanel panel;
   public static GLCapabilities glCaps;
   public static GLCanvas canvas;
   public static Animator animator;
   
   public MainFrame(String s)
   {
      super(s);
   }

   public static void main(String[] args)
   {
      frame = new MainFrame("GL Test");
      frame.setSize(1280, 720);
      panel = new JPanel();
      panel.setSize(1280, 720);
      frame.add(panel);
      frame.setDefaultCloseOperation(MainFrame.EXIT_ON_CLOSE);
      frame.setVisible(true);
      GLProfile.initSingleton();
      glCaps = new GLCapabilities(GLProfile.get(GLProfile.GL3));
      canvas = new GLCanvas(glCaps);
      canvas.addGLEventListener(new JOGLEventListener());
      animator = new Animator(canvas);
      panel.add(canvas);
      animator.start();
     
   }
}


Event Listener Class: (JOGLEventListener)

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
package mainLoop;

import java.io.IOException;
import java.nio.FloatBuffer;

import javax.media.opengl.GL;
import javax.media.opengl.GL2ES2;
import javax.media.opengl.GL3;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.fixedfunc.GLMatrixFunc;

import com.jogamp.opengl.util.PMVMatrix;

import shaders.ShaderLoader;

public class JOGLEventListener implements GLEventListener{
   
   GL3 gl;

   @Override
   public void display(GLAutoDrawable arg0)
   {
      gl = (GL3) arg0.getGL();
      gl.glDrawArrays(GL.GL_TRIANGLES, 0, 3);
   }

   @Override
   public void dispose(GLAutoDrawable arg0)
   {
     
     
   }

   @Override
   public void init(GLAutoDrawable gld)
   {
      gl = (GL3) gld.getGL();
      int[] array = new int[1];
      gl.glGenVertexArrays(1, array, 0);
      gl.glBindVertexArray(array[0]);
      gl.glEnable(GL.GL_DEPTH_TEST);
      gl.glDepthFunc(GL.GL_LEQUAL);
      int[] buffer = new int[1];
      gl.glGenBuffers(1, buffer, 0);
      gl.glBindBuffer(GL.GL_ARRAY_BUFFER, buffer[0]);
      FloatBuffer vertices = FloatBuffer.allocate(9);
      vertices.put(1);
      vertices.put(0);
      vertices.put(-3);
      vertices.put(0);
      vertices.put(0);
      vertices.put(-3);
      vertices.put(0);
      vertices.put(1);
      vertices.put(-3);
      vertices.rewind();
      gl.glBufferData(GL.GL_ARRAY_BUFFER, 12 * Float.BYTES, vertices, GL.GL_STATIC_DRAW);
      try {
         gl = ShaderLoader.getShaderProgram((GL3) gl);
      } catch (IOException e) {
         System.exit(0);
         e.printStackTrace();
      }
      //make matrices
      PMVMatrix matrixMaker = new PMVMatrix();
      matrixMaker.gluLookAt(10, 10, 10, 0, 0, 0, -1, -1, 1);
      matrixMaker.gluPerspective(90, 16.0f/9.0f, 0.1f, 100);
      //apply to uniform
      int tempLoc = gl.glGetUniformLocation(ShaderLoader.finalShader, "uniform_Projection");
      gl.glUniformMatrix4fv(tempLoc, 1, false, matrixMaker.glGetMatrixf());
      //set up attributes
      tempLoc = gl.glGetAttribLocation(ShaderLoader.finalShader, "attribute_Position");
      gl.glVertexAttribPointer(tempLoc, 3, GL.GL_FLOAT, false, 0, 0);
      gl.glEnableVertexAttribArray(array[0]);
   }

   @Override
   public void reshape(GLAutoDrawable arg0, int arg1, int arg2, int arg3, int arg4)
   {
     
   }  

}


Shader Handling Class: (ShaderLoader)

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
package shaders;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import javax.media.opengl.GL3;

public class ShaderLoader {
   
   public static String[] vertexShader;
   public static String[] fragmentShader;
   public static int vertShader;
   public static int fragShader;
   public static int finalShader;
   
   public static GL3 getShaderProgram(GL3 gl) throws IOException
   {
      vertShader = gl.glCreateShader(GL3.GL_VERTEX_SHADER);
      fragShader = gl.glCreateShader(GL3.GL_FRAGMENT_SHADER);
      BufferedReader questionReader = new BufferedReader(new InputStreamReader(ShaderLoader.class.getResourceAsStream("VTest.glsl")));
      String buffLine = questionReader.readLine();
      while( buffLine != null )
      {
         vertexShader[0] += (buffLine + System.lineSeparator());
         buffLine = questionReader.readLine();
      }
      questionReader = new BufferedReader(new InputStreamReader(ShaderLoader.class.getResourceAsStream("FTest.glsl")));
      buffLine = questionReader.readLine();
      while( buffLine != null )
      {
         fragmentShader[0] += (buffLine + System.lineSeparator());
         buffLine = questionReader.readLine();
      }
      gl.glShaderSource(vertShader, 1, vertexShader, null, 0);
      gl.glCompileShader(vertShader);
      gl.glShaderSource(fragShader, 1, vertexShader, null, 0);
      gl.glCompileShader(fragShader);
      finalShader = gl.glCreateProgram();
      gl.glAttachShader(finalShader, vertShader);
      gl.glAttachShader(finalShader, fragShader);
      gl.glLinkProgram(finalShader);
      gl.glUseProgram(finalShader);
      return gl;
   }

}


Shaders:

Vertex Shader: (VTest.glsl)

1  
2  
3  
4  
5  
6  
7  
8  
#version 400
uniform mat4 uniform_Projection;
attribute vec4 attribute_Position;

void main()
{
   gl_Position = uniform_Projection * attribute_Position;
}


Fragment Shader: (FTest.glsl)

1  
2  
3  
4  
5  
#version 400
void main()
{
   gl_FragColor = vec4(1, 1, 0.5, 1);
}


Thanks in advance to anyone who is knowledgeable on this subject.
Pages: [1]
 
Riven (847 views)
2019-09-04 15:33:17

hadezbladez (5795 views)
2018-11-16 13:46:03

hadezbladez (2603 views)
2018-11-16 13:41:33

hadezbladez (6211 views)
2018-11-16 13:35:35

hadezbladez (1499 views)
2018-11-16 13:32:03

EgonOlsen (4734 views)
2018-06-10 19:43:48

EgonOlsen (5793 views)
2018-06-10 19:43:44

EgonOlsen (3276 views)
2018-06-10 19:43:20

DesertCoockie (4175 views)
2018-05-13 18:23:11

nelsongames (5501 views)
2018-04-24 18:15:36
A NON-ideal modular configuration for Eclipse with JavaFX
by philfrei
2019-12-19 19:35:12

Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!