Java-Gaming.org Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (612)
Games in Android Showcase (172)
games submitted by our members
Games in WIP (658)
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] 2 3 ... 19
1  Discussions / General Discussions / small 120hz display? on: 2015-08-18 21:50:08
Just wondering if anyone's seen a 120hz display around 17inch size.I've been looking around, and the smallest I've been able to find is 24inch, which is too large for me considering the space on my desk.
2  Game Development / Shared Code / Re: embedding javaFX inside opengl on: 2015-07-22 20:02:10
texture's going to be UV mapped. I could just use java to composite the cursor on top before i update the texture. Or maybe do it inside my shader.
3  Game Development / Shared Code / Re: embedding javaFX inside opengl on: 2015-07-22 19:31:35
that works for GLFW, but i want the capability so i can do those in-game terminals like in doom3.
4  Game Development / Shared Code / Re: embedding javaFX inside opengl on: 2015-07-22 19:02:12
any ideas how i could draw a cursor in the texture for if the window hides the system cursor or if i'm doing an in-game screen like in doom3?
5  Discussions / General Discussions / Re: Steam Machine vs homebuilt PC on: 2015-07-02 14:11:52
I was just wondering if they were trying to subsidize or sell at a loss like consoles do.
6  Game Development / Shared Code / Re: embedding javaFX inside opengl on: 2015-07-01 20:26:54
How are you getting mouse and keyboard events into javafx?
7  Discussions / General Discussions / Re: What projects are you guys working on? How's progress going? on: 2015-07-01 20:16:52
3d engine in java. I've mostly finished making some classes to embed Javafx in openGL for the GUI

Pretty please can you open source it once you have a working product? Even something really rudimentary, the people need a good GUI backend for OpenGL.

I've put it in Shared code

http://www.java-gaming.org/topics/embedding-javafx-inside-opengl/36349/view.html
8  Discussions / General Discussions / Steam Machine vs homebuilt PC on: 2015-07-01 20:01:13
How do steam machines compare to PCs for price vs performance? I'm trying to decide whether i should build my own desktop or get a steam machine and install linux on it.
9  Game Development / Shared Code / Re: embedding javaFX inside opengl on: 2015-07-01 19:59:44
JavaFX has components for embedding itself into Swing and SWT. What i'm doing is loading the image into a ByteBuffer and then using that to update a texture (you could subclass texupdater and use a PBO with a mapped bytebuffer too). then in my demo, I'm using GLFW to get input from the mouse and keyboard to feed to Javafx.
10  Discussions / Miscellaneous Topics / Re: What's your favorite OS and why? on: 2015-06-30 21:11:34
running Linux Mint right now
11  Discussions / General Discussions / Re: What projects are you guys working on? How's progress going? on: 2015-06-30 21:08:33
3d engine in java. I've mostly finished making some classes to embed Javafx in openGL for the GUI
12  Game Development / Shared Code / embedding javaFX inside opengl on: 2015-06-30 15:40:02
this code allows you to use Javafx as your GUI in OpenGL. Includes an example using LWJGL3 and GLFW

http://pastebin.java-gaming.org/e0c5c939d2a19
http://pastebin.java-gaming.org/0c5c30d0a391f
http://pastebin.java-gaming.org/c5c3d1a093f15
13  Discussions / Miscellaneous Topics / Re: What is your opinion about ... on: 2015-06-01 16:47:10
I usually just use printlns for exceptions. for incorrect results i sometimes use breakpoints because printlns would fill the console up too fast
14  Game Development / Networking & Multiplayer / Re: Netcode works perfectly on one network, doesn't work on another. on: 2015-05-31 17:51:16
it could be all sorts of things. are you entering IP addresses manually, or using some form of discovery?
15  Discussions / Miscellaneous Topics / Re: What are your current personal projects? on: 2015-05-25 19:28:06
Game engine in java. right now i'm trying to integrate JavaFX with opengl.
16  Java Game APIs & Engines / OpenGL Development / Re: texture problems on: 2015-05-22 19:58:32
Thanks, that worked.
17  Java Game APIs & Engines / OpenGL Development / texture problems on: 2015-05-22 18:47:23
I am using the following java code

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  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
package SPAGE.engine.gui;

import java.io.File;
import java.io.FileNotFoundException;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.util.Random;
import java.util.Scanner;

import javafx.application.Platform;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.Text;

import org.lwjgl.BufferUtils;
import org.lwjgl.glfw.Callbacks;
import org.lwjgl.glfw.GLFWErrorCallback;
import org.lwjgl.glfw.GLFWKeyCallback;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL13;
import org.lwjgl.opengl.GL20;
import org.lwjgl.opengl.GLContext;

import static org.lwjgl.glfw.GLFW.*;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL15.*;
import static org.lwjgl.opengl.GL20.*;
import static org.lwjgl.opengl.GL30.*;
import static org.lwjgl.opengl.GL31.*;
import static org.lwjgl.opengl.GL32.*;
import static org.lwjgl.opengl.GL33.*;
import static org.lwjgl.system.MemoryUtil.*;


public class glembedtest {
   
   private GLFWErrorCallback errorCallback = Callbacks.errorCallbackPrint(System.err);
   
   long window;
   
   private GLFWKeyCallback keyCallback = new GLFWKeyCallback() {
       @Override
       public void invoke(long window, int key, int scancode, int action, int mods) {
           if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) {
               glfwSetWindowShouldClose(window, GL_TRUE);
           }
       }
   };
   
   glStagePlatform plat = new glStagePlatform();
   
   int vbo;
   int tcb;
   int tex;
   int program;
   
   public void go()
   {
      glfwSetErrorCallback(errorCallback);
     
      if (glfwInit() != GL_TRUE) {
          throw new IllegalStateException("Unable to initialize GLFW");
      }
     
     
      glfwDefaultWindowHints();
      glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
      glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
      glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
      glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
     
       window = glfwCreateWindow(640, 480, "Simple example", NULL, NULL);
      if (window == NULL) {
          glfwTerminate();
          throw new RuntimeException("Failed to create the GLFW window");
      }
     
      glfwSetKeyCallback(window, keyCallback);
     
      glfwMakeContextCurrent(window);
      GLContext.createFromCurrent();
     
      /*
        Platform.runLater(new Runnable() {
            @Override
            public void run() {
           plat.setScene(createScene());
            }
       });
   
   plat.setsize(512, 512);
   */

   
   
   
   
   
   ByteBuffer buf= ByteBuffer.allocateDirect(512*512*3);
   Random r = new Random();
   for(int x=0;x<buf.capacity();x++)
   {
      buf.put((byte) r.nextInt(255));
     
   }
   
   buf.flip();
   
   
   
   tex=glGenTextures();
   glBindTexture(GL_TEXTURE_2D, tex);
   
   GL11.glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,512,512,0,GL_RGB,GL_UNSIGNED_BYTE,buf);

   
   int vao = glGenVertexArrays();
   glBindVertexArray(vao);
   
   //set up vbo
   
   float[] vbodata = {
         -0.9f, -0.9f, 0.0f,
         0.9f, -0.9f, 0.0f,
         -0.9f, 0.9f,0.0f,
         0.9f,  0.9f, 0.0f,
         
      };
   
   FloatBuffer fb= BufferUtils.createFloatBuffer(vbodata.length);
   fb.put(vbodata);
   fb.flip();
   
   vbo=glGenBuffers();
   
   glBindBuffer(GL_ARRAY_BUFFER,vbo);
   
    glBufferData(GL_ARRAY_BUFFER,fb,  GL_STATIC_DRAW);
   
    float[] tcs={0f,0f,
                    0f,1f,
                    1f,1f,
                    1f,0f};
   
    fb= BufferUtils.createFloatBuffer(tcs.length);
      fb.put(tcs);
      fb.flip();
   
      tcb=glGenBuffers();
     
      glBindBuffer(GL_ARRAY_BUFFER,tcb);
     
       glBufferData(GL_ARRAY_BUFFER,fb,  GL_STATIC_DRAW);
     
     
   
    program=createshaders("shaders/shader.vtex","shaders/shader.frag");
       
    glClearColor(0.0f, 0.0f, 0.4f, 0.0f);
     
      while (glfwWindowShouldClose(window) != GL_TRUE)
      {
       mainloop();
      }
     
      glfwDestroyWindow(window);
      keyCallback.release();
      glfwTerminate();
      errorCallback.release();
     
   }
   
   public static void main(String[] args)
   {
      new glembedtest().go();
     
   }

   
   public void mainloop()
   {
      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
      glUseProgram(program);
     
      glEnableVertexAttribArray(0);
      glEnableVertexAttribArray(1);
      glBindBuffer(GL_ARRAY_BUFFER, vbo);
      GL20.glVertexAttribPointer(0, 3, GL_FLOAT, false, 0, 0);
     
      glBindBuffer(GL_ARRAY_BUFFER, tcb);
      GL20.glVertexAttribPointer(1, 2, GL_FLOAT, false, 0, 0);
     
     
      GL13.glActiveTexture(GL13.GL_TEXTURE0);
      int texloc=glGetUniformLocation(program, "mytex");
      glUniform1i(texloc, 0);
      glBindTexture(GL_TEXTURE_2D, tex);
     
     
     
      glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
     


      glfwSwapBuffers(window);
      glfwPollEvents();
   }
   
   
   
    private static Scene createScene() {
        Group  root  =  new  Group();
        Scene  scene  =  new  Scene(root, Color.BLUE);
        Text  text  =  new  Text();
       
        text.setX(40);
        text.setY(100);
        text.setFont(new Font(25));
        text.setText("Welcome JavaFX!");

        root.getChildren().add(text);

        return (scene);
    }
   
   
   
    int createshaders(String vert, String frag)
    {
       int VertexShaderID = glCreateShader(GL_VERTEX_SHADER);
        int FragmentShaderID = glCreateShader(GL_FRAGMENT_SHADER);
       
        String code="";
        try {
         Scanner scan = new Scanner(new File(vert));
         
         while(scan.hasNext())
         {
            code+=scan.nextLine()+"\n";
         }
         scan.close();
         
      glShaderSource(VertexShaderID,code);
      glCompileShader(VertexShaderID);

      int result=glGetShaderi(VertexShaderID, GL_COMPILE_STATUS);
      String log=glGetShaderInfoLog(VertexShaderID);
      System.out.println("vtx shader returned: "+log);
     
     
       scan = new Scanner(new File(frag));
     
       code="";
      while(scan.hasNext())
      {
         code+=scan.nextLine()+"\n";
      }
      scan.close();
     
   glShaderSource(FragmentShaderID,code);
   glCompileShader(FragmentShaderID);

    result=glGetShaderi(FragmentShaderID, GL_COMPILE_STATUS);
    log=glGetShaderInfoLog(FragmentShaderID);
   System.out.println("frag shader returned: "+log);
     
     
   int ProgramID = glCreateProgram();
    glAttachShader(ProgramID, VertexShaderID);
    glAttachShader(ProgramID, FragmentShaderID);
    glLinkProgram(ProgramID);
   
    result=glGetProgrami(ProgramID, GL_LINK_STATUS);
    log=glGetProgramInfoLog(ProgramID);
    System.out.println("program link returned: "+log);
         
    return ProgramID;
         
      } catch (FileNotFoundException ex) {
         
         ex.printStackTrace();
      }
       
        return -1;
       
    }
   
}


and shaders
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
// vertex shader
#version 330 core
 
// Input vertex data, different for all executions of this shader.
layout(location = 0) in vec3 vertexPosition_modelspace;
layout(location = 1) in vec2 vertexUV;
 
// Output data ; will be interpolated for each fragment.
out vec2 UV;

 
void main(){
 
    // Output position of the vertex, in clip space : MVP * position
    gl_Position = vec4(vertexPosition_modelspace,1);
 
    // UV of the vertex. No special space for this one.
    UV = vertexUV;
}


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
//fragment shader
#version 330 core
 
// Interpolated values from the vertex shaders
in vec2 UV;
 
// Ouput data
out vec3 color;
 
// Values that stay constant for the whole mesh.

uniform sampler2D mytex;

 
void main(){
 
    // Output color = color of the texture at the specified UV
    color = texture( mytex, UV ).rgb;
 
}


I'm expecting a rectangle with random noise in it (i'm actually trying to make a gui, but i'm just loading noise into my texture to test the shader), but all i get is a black rectangle. any ideas what i'm doing wrong here?
18  Discussions / General Discussions / Re: What's your day job? on: 2015-05-07 14:22:06
just got a job for the summer teaching at a tech summer camp
19  Java Game APIs & Engines / OpenGL Development / javafx render to texture on: 2015-04-25 22:09:01
is there any way get an image from javafx that could be loaded into a texture and feed in events from the engine? I'd like to use it for my menu and possibly a doom3 style GUI.
20  Discussions / General Discussions / Re: The Khronos Group announces "Vulkan": the successor to OpenGL on: 2015-03-15 15:51:28
I'm wondering if this might make VGA passthrough possible without having to have 2 graphics cards. since this would move control of the graphics card away from the driver, that would make it less complex for the driver on the guest OS to be modified to share the graphics card?
21  Discussions / Miscellaneous Topics / version control for ported project. on: 2015-03-14 15:43:55
I am intending to port a project from c++ to java. I would like to be able to keep track of the other project in my repository too, so i can see how it changes and keep my own parallel version updated. I'm using eclipse EGit. any recommendations?
22  Discussions / General Discussions / Re: What's your day job? on: 2015-03-13 14:58:49
- so please, when you all get filthy rich, don't go buy a Lambo!
Wouldn't dream of anything other than an AMC javelin or 1970 Roadrunner
23  Discussions / General Discussions / Re: What's your day job? on: 2015-02-17 00:15:42
it does come at a slight cost and that is incompetent teachers.

Beats Texas. We have teachers that are incompetent AND psycho.
24  Discussions / General Discussions / Re: What's your day job? on: 2015-02-16 16:05:25
the usual college-level jobs. studying robotics.
25  Game Development / Newbie & Debugging Questions / Re: convert expression for use with vecmath on: 2015-02-15 19:54:17
javax.vecmath creates so much garbage that it is best avoided

Unfortunately I need it for jbullet
26  Game Development / Newbie & Debugging Questions / Re: convert expression for use with vecmath on: 2015-02-15 15:30:09
Javax.vecmath

It doesn't. For example adding vectors v1 and v2 with v1.add(v2) stores the result in v1
27  Game Development / Newbie & Debugging Questions / convert expression for use with vecmath on: 2015-02-14 01:48:31
since all the math operations in vecmath apply the result to the object they're called on instead of returning the result, i can't just replace + with add() and make sure the parentheses are in the right place. How should i convert a mathematical expression to vecmath without using a bunch of temporary variables?
28  Java Game APIs & Engines / OpenGL Development / Re: LWJGL 3; how's it getting along? on: 2015-02-13 21:50:51
any significant advantages over JOGL2?
29  Game Development / Shared Code / Source Engine MDL code on: 2015-01-19 17:27:35
http://www.java-gaming.org/user-generated-content/members/18483/crowbar-port.jar

This code loads up data from SourceEngine model files. for examples on how to use the data, check the Core/Filedatacompiled code

crowbar_.24_vb contains the original Visual Basic code
/crowbar_pidgin_.24 contains a bastardized VB/java version output by a program I cobbled together to make porting easier.
crowbar contains the converted code.

the Decompiler.readcompiledfiles method reads the model files.
30  Discussions / Community & Volunteer Projects / porting VB code for source engine MDL files on: 2015-01-16 15:45:46
I am working on porting a VB program that decompiles Source Engine MDL files into Java.  If anybody wants to load MDL files or is interested in helping, I can put up the VB code and my current progress
Pages: [1] 2 3 ... 19
 
Roquen (15 views)
2015-08-29 11:30:54

GamerC4 (25 views)
2015-08-22 20:38:50

GamerC4 (23 views)
2015-08-22 20:37:18

GamerC4 (27 views)
2015-08-22 20:37:01

Kefwar (31 views)
2015-08-22 18:07:24

GamerC4 (24 views)
2015-08-22 01:00:24

GamerC4 (37 views)
2015-08-22 01:00:17

GamerC4 (24 views)
2015-08-22 00:57:35

GamerC4 (25 views)
2015-08-22 00:56:59

BurntPizza (31 views)
2015-08-21 01:38:01
HotSpot Options
by Roquen
2015-08-29 11:33:11

Rendering resources
by Roquen
2015-08-17 12:42:29

Rendering resources
by Roquen
2015-08-17 09:36:56

Rendering resources
by Roquen
2015-08-13 07:40:51

Networking Resources
by Roquen
2015-08-13 07:40:43

List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30
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!