#[SOLVED] Been stuck for 2 days trying to render a 3D polygon in OpenGL using Silk.NET and C#

59 messages · Page 1 of 1 (latest)

mint spear
#

Repo containing my code: https://github.com/safron1111/DignDig, So for the past 2 days I have been looking all through my code and looking back at guides and looking things up to try to make a 3D enviornment in OpenGL, so far I have gotten to the point where I am using matrices to make 3D work, but when I moved from 2D rendering to 3D, it hasnt worked and I've really been stumped. I believe its either the matrices or shader code but I am really not sure, the polygon that is meant to render on the ground isn't, and I am not sure if it's because my code isnt set up in the right order or if I am missing something. The goal currently is to render a square polygon facing so that it appears to be on the floor, or atleast something similar, but I have not been able to acheive this, I have tried not using textures, changing to wireframe mode, changing the order of code, and messing with values and matrices, and nothing seems to work, nor do I get any errors. Thanks! (As you can see there is no square visible)

hybrid wadi
#

you have a lot of code for how much drawing you're doing

#

why do you have both a class called Camera and a class called CameraClass?

#

why do you have a tonne of functions called Draw* that don't draw anything, but instead compile and link shaders and fill buffers?

#

as with all things, I would recommend you start with opening renderdoc, but also I feel like you might need to peel back some layers here too

#

you're also doing so much stuff in statics that stuff could be going wrong at any point

#

definitely also try with a regular C# debugger to see if your values make sense

#

also note you're doing math with ints here, so your aspect ratio is probably wrong as well, but thats likely not your main issue

mint spear
mint spear
mint spear
mint spear
#

this is like the first day ive been properly awake with enough sleep

#

let me fix that

hybrid wadi
#

as is keeping code around that you're not using

mint spear
hybrid wadi
#

anyway, the answer to "why is my screen blank" is to open renderdoc

#

that should be your first stop

mint spear
hybrid wadi
#

huh?

mint spear
hybrid wadi
#

you are trying to open your executable as a capture, which is not how your use renderdoc

#

please read the getting started guide

mint spear
#

nothing happens after i press it

hybrid wadi
#

it doesn't open a menu, it focusses a panel

mint spear
#

ok ill stop bothering you

#

im clearly not paying enough attention

#

sorry

hybrid wadi
#

just spend a little time with it first 😅

mint spear
#

i think i found the problem but i dont know how to fix it, i was told you had to load the modelLoc, viewLoc, and projectionLoc, after the program is linked or else they wouldnt get locations on the gpu, and i even tested this myself, and it seemed to be true, however, in renderdoc, its saying im passing "no resource" to the gpu when trying to pass model, view, and projection matrices to the shaders, but i cant send them to the shaders if its already been linked right??

#

im probably misunderstanding how opengl works

hybrid wadi
mint spear
#

because its right after the program is linked

hybrid wadi
#

that is immediately

#

once the program is linked, you can set uniforms whenever you want

mint spear
#

so is it just saying no resource for no reason or am i doing it wrong?

hybrid wadi
#

i don't know what you are looking at

hybrid wadi
#

that means you don't have a valid program bound

mint spear
#

i followed how silk.nets documentation does it

#

i also havent changed this bit of code since it was 2D and untextured (except for defining the shaders)

hybrid wadi
#

no that's fine

#

but you need to bind it to set uniforms

#

have you gone through learnopengl?

#

if not if recommend going through it

mint spear
#

but I was sleep deprived and very tired when I did

hybrid wadi
#

i would recommend going through it again

#

slowly, and not sleep deprived

#

just reading through it once is not enough, you need to understand everything there

mint spear
#

it works

#

doesnt look right but it works

#

thank you