Git Product home page Git Product logo

glfw.mod's Introduction

bmx-ng

The Open Source BlitzMax Compiler Project.

glfw.mod's People

Contributors

woollybah avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

denise-amiga

glfw.mod's Issues

Weird projection error

Hi Brucey,

We think there may be a problem somewhere that's causing a projection error -- both me and medi71 have run into it.

My example has a switchable setting showing the different projection settings needed to get a cube on-screen, as compared to the various tutorials, while medi71's own take is frankly way tidier!

See next few posts from here with samples...

https://www.syntaxbomb.com/index.php/topic,7495.msg347041994.html#msg347041994

May turn out to be user error, but we've both run into it and are both stumped, so seems like it may be a problem in GFLW (or one of the math libs?).

Is there a problem with matrices or something? (Sorry for vagueness!)

No matter what I do, I can't get the view to match that of various tutorials, the main one being this:

https://www.tomdalling.com/blog/modern-opengl/03-matrices-depth-buffering-animation/

... the code for which is here:

https://github.com/tomdalling/opengl-series/blob/master/source/03_matrices/source/main.cpp

I've attached a sample, and the relevant settings are a few lines above LoadCube () -- note:

50 degrees fov
0.1, 10.0 for near/far
3, 3, 3 for camera position.

	projection_matrix	= SMat4F.Perspective (50, _RetroGraphicsWidth, _RetroGraphicsHeight, 0.1, 10.0)

	Local uni_prj:Int	= glGetUniformLocation (Program, "projection")
	glUniformMatrix4fv (uni_prj, 1, False, Varptr projection_matrix.a)

	view_matrix			= SMat4F.LookAt (New SVec3F (3, 3, 3), New SVec3f (0.0, 0.0, 0.0), New SVec3f (0.0, 1.0, 0.0))
'	view_matrix			= SMat4F.LookAt (New SVec3F (1.1, 1.1, 1.1), New SVec3f (0.0, 0.0, 0.0), New SVec3f (0.0, 1.0, 0.0)) ' VISIBLE
 

I have to use the last line just to get something to show, but the perspective is then all wrong.

These settings in the original, for comparison:

    //set the "projection" uniform in the vertex shader, because it's not going to change
    glm::mat4 projection = glm::perspective(glm::radians(50.0f), SCREEN_SIZE.x/SCREEN_SIZE.y, 0.1f, 10.0f);
    gProgram->setUniform("projection", projection);

    //set the "camera" uniform in the vertex shader, because it's also not going to change
    glm::mat4 camera = glm::lookAt(glm::vec3(3,3,3), glm::vec3(0,0,0), glm::vec3(0,1,0));

I'd really like to get these to match up when using the original settings before trying to move on, unless there's actually a good reason to expect this result... which there may well be!

Runnable sample: texcube.zip

In passing: by messing about with the LookAt matrix (hacking in glm's version), I got something close, but still not quite right, so I assume that's not actually the problem and that I was just lucky it came out similar...

https://www.syntaxbomb.com/index.php/topic,7495.msg347042033.html#msg347042033

I went back to the original LookAt, as medi71 felt it was working, and I then converted/hacked the original C source linked above, but it's frankly a horrible mess, and it still gives the wrong results! (The code attachment.)

Please can you have a look and put me out of my misery... one way or another?! (Or, put another way, try converting the original C code and getting it to show the same result!)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.