CreedVI / Raylib-J

Handmade Java binding for Raylib
zlib License
97 stars 16 forks source link

Raylib-J does not render to the window in any examples using GL33 #4

Closed CreedVI closed 3 years ago

CreedVI commented 3 years ago

When running either of the written examples (WindowText.java, BasicShapes.java) Raylib-J will successfully clear the window with the desired color, but will not render any text or shapes.

CreedVI commented 3 years ago

After playing around with the settings I discovered this issue only applies to OpenGL 33. OpenGL 11 renders shapes to the window fine.

CreedVI commented 3 years ago

GenDrawQuad() renders to the window. So it looks like the issue is somewhere within DrawRenderBatch() or the shader program.

CreedVI commented 3 years ago

With commit f7a5a2b there's been a good chuck of progress made in squashing this.

First, a lot of troubleshooting with RenderDoc and a good chuck of test code (removed from file for commit) I discovered the shader property locs[] was not being initialized correctly leading to no data going to the proper destination.

While all the data is in place as far as I can see (vertexPosition, vertexTexCoord, and vertexColor) and the Vertex Shader is outputting as expected we're still not rendering anything.

This is the last thing I want to get squared away before trying to put out an alpha build for testing.

CreedVI commented 3 years ago

So, the next issue I've identified is that gl_Position is passing the values of vertexPosition which are not in NDC format which is causing the mesh to be placed incorrectly. See the following images I took from RenderDoc to see what I'm talking about:

Raylib-J: Raylib-J Mesh View

Raylib: Raylib Mesh View

(also there's an issue where DrawRectanglePro() is passing as if the x and y coordinates are 0, but that's unrelated to the current problem I believe)

CreedVI commented 3 years ago

This'll probably be my final update for a while as I'm being deployed. It looks like the root issue of all of this (including the issue of incorrect x, y coordinates for the rectangle being drawn in my program) is the projection and modelview matrices are not being populated with the correct values.

CreedVI commented 3 years ago

Quick update while I have the time. Projection and modelview matrices are populating correct values after fixing an issue with assigning matrix values during the initialization. Unfortunately, I don't have access to all my tools on my laptop (or internet for that matter), so work is slow but progress is being made!

CreedVI commented 3 years ago

Major update: I have items rendering, however I have a couple hacks in place to get things rendering properly for now, but I'm working on correcting the need for those.

I will try to push my updates later tonight