Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (517)
Games in Android Showcase (123)
games submitted by our members
Games in WIP (578)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Failing to render?  (Read 743 times)
0 Members and 1 Guest are viewing this topic.
Offline Quarry
« Posted 2013-07-16 12:33:43 »

Here's a little library base I started recently, however even though the OpenGL parts seems to be all set it won't show anything on screen

http://www.mediafire.com/download/p5l33d03ho0t1nj/bps.rar

I hope someone can help me with this, the net.jmatrix package is a port of glMatrix to Java by me @ https://github.com/Quarynn/jMatrix
Offline Quarry
« Reply #1 - Posted 2013-07-27 15:39:26 »

Sorry for the necro but I really need help!

I changed a few stuffs here and there but still no luck

http://www.mediafire.com/download/mbcfh35tv0ssro4/bps2.rar

EDIT: The vert and frag shaders as well

http://pastebin.com/4E5vjnRr
http://pastebin.com/SMB5jSrv
Offline Quarry
« Reply #2 - Posted 2013-07-29 15:48:10 »

halp
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Quarry
« Reply #3 - Posted 2013-08-01 18:02:44 »

No-one can help me with this?
Offline Redocdam

Senior Duke


Medals: 17



« Reply #4 - Posted 2013-08-01 21:29:59 »

You're presenting a bit of a broad problem. So this is likely going to take a bit of going back and forth while we narrow down what's going on.

You mentioned porting a matrix library, but you also said nothing appears on the screen. Does this mean
a.) It doesn't matter what matrix values are used (Id etc...) nothing renders.
b.) Nothing appears on screen using your matrices, but you've been able to render things with this engine in the past.

Scenario A
I think the best place to start debugging here is from the Shader level. If you're familiar with Geometry shaders, you can create one to output a simple triangle and then just tell your fragment shader to output a single color (instead of the texture stuff you're trying to do).

On that note, I would just tell your fragment shader to output a single color until you get this stuff ironed out.

Vertex Attribute Array Pointer
More often than not, when I've encountered something not rendering it was actually due to the Vertex array. Either I was passing in the wrong values, or the more common case where I was setting the vertex array attributes incorrectly.

If you're able to implement the Geometry shader this would help you determine if you have a Vertex array issue. If you can draw something with the shader, then you likely have a Vertex array issue.
Gemotry shaders are somewhat easy to work with and should be something like:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
out vec3 vertex;

void main(){
   vertex = vec3(-0.5, 0, 0);
   EmitVertex();

   vertex = vec3(0, 0.5, 0);
   EmitVertex();
   
   vertex = vec3(0, 0, 0);
   EmitVertex();
}

Keep your culling in mind with the order. Or just err on the safe side for now and disable any culling you may be doing.

If none of the above has gotten you to a point where you see at least -something- on the screen, then you've likely got a problem with initialization or calling the draw function incorrectly.
But I'll wait on your findings before trying to drill down into that.

Scenario B
If you -have- in the past been able to render a "Hello World Triangle", then I just wrote a bunch of shit for no reason. But that's ok, it's all penance to please the coder gods.

Perspective Projection
It also means I would wager a soul (not mine, of course) that you've got a perspective projection matrix problem.
You can check this by making the perspective matrix an Identity matrix and the same for the other matrices you pass in.
If that works, then here's a general overview about investigating the perspective projection matrix.
A lot of perspective matrix implementation looks similar to the following
1  
2  
3  
4  
5  
6  
7  
R   0   0   0
0   R   0   0
0   0     A    B
0   0   -1   0

A = (F+N)/(N-F)
B = (2FN)/(N-F)

R is the frustum
F is the far plane
N is the near plane

Unless you're doing something crazy, you can ignore the upper left portion of this matrix. All it does is compress the window by width or height.
The easiest place to make a mistake is the lower right quadrant, since this controls the Z. It's easily possible to project an object behind your view. You can try flipping the -1 to positive.

Transpose
The classic transposed matrix, where your rows are your columns and columns are your rows. Though most of the time this just results in objects looking behaving strangely vs not appearing.

You can easily play with this by simply flipping the transpose boolean value from false to true in the function which sets the uniform matrices for the shaders.
glUniformMatrix4(int location, boolean transpose, java.nio.FloatBuffer matrices)

Offline Quarry
« Reply #5 - Posted 2013-08-02 01:03:50 »

Ahhhh... I figured out that it was wrong strides and bad matrices. That explains some stuff Tongue
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

DarkCart (16 views)
2014-10-31 21:44:48

DarkCart (21 views)
2014-10-31 21:43:57

TehJavaDev (40 views)
2014-10-27 03:28:38

TehJavaDev (31 views)
2014-10-27 03:27:51

DarkCart (44 views)
2014-10-26 19:37:11

Luminem (27 views)
2014-10-26 10:17:50

Luminem (30 views)
2014-10-26 10:14:04

theagentd (36 views)
2014-10-25 15:46:29

Longarmx (64 views)
2014-10-17 03:59:02

Norakomi (62 views)
2014-10-16 15:22:06
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!