Jump to content
  • Advertisement
Sign in to follow this  
phil67rpg

OpenGL opengl 4.5

Recommended Posts

Advertisement

@Green_Baron: Any book you'd recommend for someone with code experience and works best from a physical book rather than online tutorials, etc.? 

And @fleabay , if you ever start a band, you could do far worse than Accidental Trolls as its name.

Share this post


Link to post
Share on other sites

I second @Green_Baron about "learnopengl.com".    This source alone covers 90% of all I need. 

Although I still prefer real paper book, I like this website so much.    It explains almost like a workshop book. 

The website is about OpenGL 3.3, but that should be enough for most general cases including my game.

Superbible Book is like ....  the more I read, the more I feel far away.

Share this post


Link to post
Share on other sites
Posted (edited)

Yep, learnopengl.com for the first steps. That helped me set things up.

Book to start from:

https://www.amazon.com/OpenGL-Programming-Guide-Official-Learning/dp/0134495497/ref=sr_1_1?crid=16DNXSJC7Z20M&keywords=opengl+programming+guide&qid=1564559224&s=gateway&sprefix=opengl+%2Caps%2C274&sr=8-1

And then:

https://www.amazon.com/OpenGL-Superbible-Comprehensive-Tutorial-Reference/dp/0672337479/ref=sr_1_1?crid=1WOXLY4I4W2W3&keywords=opengl+superbible&qid=1564559265&s=gateway&sprefix=opengl+superbib%2Caps%2C268&sr=8-1

Both come with their own little frameworks, nice for looking up how things work, but i'd just browse them and do my own stuff as early as possible. Aren't these well known everywhere ?

Edited by Green_Baron

Share this post


Link to post
Share on other sites

well I have read the opengl superbible 7th ed. I don't know how to setup a shader with visual studio 2017

Share this post


Link to post
Share on other sites
Posted (edited)

I assume you know how to add an empty textfile to your project and start editing it.

Loading, compiling and linking the components of a shader is described from pp. 219ff in the blue book. Overview: you create a shader object for each shader to load, load the shader's textfile(s) into memory, compile them one by one, create a shader program object and link the shaders into a program. A program consists of several shaders, the minimum is a vertex and a fragment shader, optional are geometry and tessellation shaders. After linking, the shader objects can be discarded if you don't plan to use them elsewhere. Then you can use that program, set its uniform variables, feed vertex- and other data to it.

Additionally to the superbible, a more cookbook style variant of the process of loading, compiling and linking shaders into a program is in the learnopengl.com site, here.

 

Edited by Green_Baron
clarification

Share this post


Link to post
Share on other sites

I am getting a "unrecognized preprocessor directive"  error  when using "#version 450 core".

Share this post


Link to post
Share on other sites
Posted (edited)

Because you are using GLSL directives in your C++ code. Maybe you told VS to create a new C++ source file and VS tries to compile it. GLSL is not C++ ! Use plain text as the format for a shader file.

You must strictly distinguish between your application code, which is C++ (i assume), and the shader code, which is GLSlang. The application code runs on your CPU, the shader code is executed by the GPU. Your application code calls the shader code by issuing OpenGl draw commands. But before you can draw, your must write the shader code that computes the positions and colour of your pixels on the screen, load the text, compile and link it, check for errors, etc. You do this by calling OpenGL functions (like glCreateShader, glCompileShader, glLinkProgram, ...) from your C++ code. See, read an understand the page on shaders from learnopengl i linked above, in addition to and as a fundament for the Blue Book.

 

Edited by Green_Baron

Share this post


Link to post
Share on other sites
3 hours ago, Green_Baron said:

Use plain text as the format for a shader file

how do I do this?

Share this post


Link to post
Share on other sites
50 minutes ago, phil67rpg said:

how do I do this?

I'm not sure what he is talking about. Your files are text files as are all C++ files and source code in general.

In the solution explorer, right click on each file that has the "#version 450 core" line. Go to properties and set "Exclude from build" to true.

The answer you got was mostly irrelevant for the problem. You would have found better and faster solutions to this if you had searched instead of asking. Do they have Google where you're from?

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!