Sign in to follow this  
tre

OpenGL To transition to OpenGL 3.2

Recommended Posts

tre    168
Hi, my question is basically: How do I move to 3.2 core profile from before using and mostly understanding the Nehe tutorials? The projects I've previously written have been based on the Nehe tutorials and now that I feel kind of comfortable with that code I thought that moving to more modern code would be a good thing. However I'm getting stumped all around when I try to find tutorials, guides or whatever that explains how to set up a 3.2 context (the highest version supported by my graphics card). Are there any great tutorials out there on this? Or, rather, how should I start? I'm lost again :) Thanks, Marcus Axelsson (goes back to reading the specification with a worried expression)

Share this post


Link to post
Share on other sites
ZHAO Peng    108
I have been learning OpenGL 3.2 core profile for about a month. There are some tutorials which are very useful. For example,

http://www.opengl.org/wiki/Category:Tutorials
http://sites.google.com/site/opengltutorialsbyaks/introduction-to-opengl-3-2---tutorial-01
http://nopper.tv/opengl_3_2.html
http://www.g-truc.net/post-0204.html

By reading these materials, it is easy to set up my first demo with phong lighting and texture mapping.

However, the most troublesome problem for me is the immature support by related development libraries. Especially, the GUI libraries like freeglut, SDL and QT, are still far away from stable support for core profile. I have post some threads in this forum to show the bugs of freeglut and no solution could be received. I hope all the problems could be solved as soon as possible.

Share this post


Link to post
Share on other sites
tre    168
I've checked out two of those links (the sample program links) before and they're OK. I hope to understand them better after having read through the specification. The other two links seem allright. I'll have a close look at those.

The libraries you mention will probably have support soon enough. Or maybe they're working on 4.0 compatible code instead? It'd be great with some 3 compatible stuff though, since I'm not really in a position to buy a new graphics card right now :)

Thanks for the links.

Anyone else got something? All references and guides, tutorials and code samples are welcome.

Thanks,
Marcus Axelsson

Share this post


Link to post
Share on other sites
Quote:
Original post by ZHAO Peng
Especially, the GUI libraries like freeglut, SDL and QT, are still far away from stable support for core profile.
It is even worse, not even the most basic libraries like GLEW and GLee do, which is ironical since they explicitely claim to support all the new versions and extensions. Nevertheless, both libraries use the 1.x mechanism for querying extensions. Which, in principle is fine, since the 3.x way totally sucks (especially if you want support both 1.x/2.x and 3.x codepaths), whereas the 1.x way works perfectly well.

However, the 1.x extension query mechanism is deprecated for 3.0 and removed from 3.1, and it is indeed unimplemented (or rather, disabled -- returns null) on recent drivers. I've even had that happen on a compatibility profile (where it's supposed to work!) on a nVidia development driver not long ago, though that was probably a driver bug.
Sadly, the Khronos group seems to have put a lot of effort into making migrating to OpenGL 3.x while retaining a legacy path as troublesome as possible (GLSL versions being another such thing), you have to wonder why. Probably the plan behind that is something like "move on, no way back".

In reply to the OP:
You must use either wglCreateContextAttribsARB or the glx counterpart, depending on whether you're under Windows or Unix.
These functions take a zero-terminated list of name-value integer pairs. Upon first sight, this may be confusing, but once you get it, it is actually quite nice, flexible, and easy. Don't forget the zero at the end!
Also, do note that you must create a fake context first to get the function pointer to that function. You cannot just call the function like that.
The links posted by ZHAO Peng show how to do this.

Also, you must use glGetStringi instead of glGetString to query for extensions. This involves many more driver calls than "the old way" did, and it makes caching the info a lot more tedious too, but alas... that's how it is. If you structure your program properly so all caps are queried at startup and stored in a few global variables, it doesn't make a real difference at runtime, though it might take half a second longer to start up.
Actually, to be correct, you must get a function pointer for glGetStringi, too, since it is not a OpenGL 1.3 function (only implemented after 3.0). Strange enough, it does work either way on my system, so it seems that glGetStringi actually has an entry in the GL import library. I don't think that this is technically correct.

Share this post


Link to post
Share on other sites
ZHAO Peng    108
Sorry! After lots of tries, I should admit that the core profile support of freeglut is not so bad. The problems I met are caused by GLEW. "glewExperimental" should be set to "GL_TRUE" for the drivers NVIDIA-Linux-x86_64-190.53 and NVIDIA-Linux-x86_64-195.36.07.04.

God! I have wasted several days for this "trap".

Share this post


Link to post
Share on other sites
dave j    681
Quote:
Original post by ZHAO Peng
Sorry! After lots of tries, I should admit that the core profile support of freeglut is not so bad. The problems I met are caused by GLEW. "glewExperimental" should be set to "GL_TRUE" for the drivers NVIDIA-Linux-x86_64-190.53 and NVIDIA-Linux-x86_64-195.36.07.04.
God! I have wasted several days for this "trap".

I've not tried it yet but someone's written a OpenGL 3/4 core profile extractor (see here). It looks a bit like a GLEW for core profiles.

Looks like it might be useful if your IDE does function name completion and you don't want it to keep suggesting deprecated functions.

Share this post


Link to post
Share on other sites
ZHAO Peng    108
Quote:
Original post by dave j
Quote:
Original post by ZHAO Peng
Sorry! After lots of tries, I should admit that the core profile support of freeglut is not so bad. The problems I met are caused by GLEW. "glewExperimental" should be set to "GL_TRUE" for the drivers NVIDIA-Linux-x86_64-190.53 and NVIDIA-Linux-x86_64-195.36.07.04.
God! I have wasted several days for this "trap".

I've not tried it yet but someone's written a OpenGL 3/4 core profile extractor (see here). It looks a bit like a GLEW for core profiles.

Looks like it might be useful if your IDE does function name completion and you don't want it to keep suggesting deprecated functions.


Yes, GL3W looks a new and easy use library which is similar to GLEW. It's good news for programmers to have one more choice. Thanks!

Share this post


Link to post
Share on other sites
tre    168
Hm. gl3w seemed really useful. But I can't run the script at all. I get an "invalid syntax" error when I try to run it (python.exe "gl3w.py"). So... too bad :/

With GLUT and this gl3w I think it'd be a breeze to get the ogl 3.2 context up and running. Which would be great :)

Thanks for keeping the thread alive, guys.

Share this post


Link to post
Share on other sites
dave j    681
Quote:
Original post by tre
Hm. gl3w seemed really useful. But I can't run the script at all. I get an "invalid syntax" error when I try to run it (python.exe "gl3w.py"). So... too bad :/

With GLUT and this gl3w I think it'd be a breeze to get the ogl 3.2 context up and running. Which would be great :)

Thanks for keeping the thread alive, guys.

Which version of Python are you using? The script is for 2.6.

Share this post


Link to post
Share on other sites
tre    168
I have to be honest, I'm about to give up on all of this.
I'm still counting myself as a beginner and I've been focused on getting OpenGL functioning correctly for me. I've got a small program up and running in the old context. I've got shaders creating "nightlights" on a globe which the user can rotate around.
Now I'm supposed to go from this to the new context and nothing will work. There are no decent tutorials out there at all. I've searched, believe me.
There are sample programs but they are very, very, very lacking in comment or explaining text.

I do not want to have it all laid out in front of me, but man, this is ridiculous!
I can get an OGL 3.2 context going. I did actually. But when I got the context going I found out that I can't do... well... anything. Since everything I've been learning for the past one and a half years is now deprecated code.

Previously I've used the NeHe tutorials to get me going and understanding OGL and Windows programming and that went so well that I finally could stand on my own wobbly legs. Now that the context has changed, and not only from 3.x but to 4.0 (which I can't program for), there is nothing I can read and understand. I've never used GLUT before but used NeHe's code for creating a window and the OGL context. But now I've found myself using GLUT instead, which I'm not really comfortable with. It feels strange. Is it really this easy to use (create a couple of display/reshape/input functions, glutSwapBuffers and then compile)? Or am I missing something? Because it feels like I'm skipping most of the programming I've been doing the last year.

And more questions. What the H is GLUS? The Python script gave me a OGL3.2 context but now what? How do I proceed? What has substituted GL_MATRIXMODE and GL_PROJECTION? And why? Setting up shaders with GLUT? My god, I can't even figure out why the keyboard won't react to the "r" button on my keyboard (or turns my cube turqoise) with the keyboardfunc in GLUT.

You see, it's quite a bit to catch up on. What I'm seriously considering is if it's really worth the trouble.

Input, please. I'm not really ready to quit my game programming aspirations just yet, but it's such a daunting task right now. Everything is new, and I have nothing to go by. I'm sort of fumbling in the dark here.

Sorry if this comes off as a crazed rant. I'm sure OGL is still as powerful (or more powerful) than ever before. It just took a turn for the worse for me. Too many changes, too soon.
The specifications aren't really helping me much. Just feels like Khronos is saying "we're so great since OGL can do this and this now and by the way 90 percent of what you've learnt is now pure crap". And then a list over deprecated functions. So I'm not really too hot for the specification just yet (however, note that I've not read all of it yet).

I'm frustrated and this became too long. Sorry for that.

What I'm really hoping for is some guidance, really.

All the best,
Marcus Axelsson

Share this post


Link to post
Share on other sites
HuntsMan    368
If it's too hard, try learning OpenGL 2.0 first, then shaders, and then, you'll be ready to use OpenGL 3.2 without problems.

Share this post


Link to post
Share on other sites
tre    168
Quote:
Original post by HuntsMan
If it's too hard, try learning OpenGL 2.0 first, then shaders, and then, you'll be ready to use OpenGL 3.2 without problems.


Thanks for your reply.
I thought I had a grip on 2.0 though, but maybe not. I've allready written some shaders. Maybe it's not enough.
Thanks again. I'll go back to 2.0 and hack on through that one.

Share this post


Link to post
Share on other sites
ZHAO Peng    108
Quote:
Original post by tre
I have to be honest, I'm about to give up on all of this.
I'm still counting myself as a beginner and I've been focused on getting OpenGL functioning correctly for me. I've got a small program up and running in the old context. I've got shaders creating "nightlights" on a globe which the user can rotate around.
Now I'm supposed to go from this to the new context and nothing will work. There are no decent tutorials out there at all. I've searched, believe me.
There are sample programs but they are very, very, very lacking in comment or explaining text.


Yes, I agree with you about the tutorials and samples. However, it is not very hard to read the sample codes and find the explain on the wiki (like VBO, VAO, UBO...).

Quote:
Original post by tre
I do not want to have it all laid out in front of me, but man, this is ridiculous!
I can get an OGL 3.2 context going. I did actually. But when I got the context going I found out that I can't do... well... anything. Since everything I've been learning for the past one and a half years is now deprecated code.
Previously I've used the NeHe tutorials to get me going and understanding OGL and Windows programming and that went so well that I finally could stand on my own wobbly legs. Now that the context has changed, and not only from 3.x but to 4.0 (which I can't program for), there is nothing I can read and understand. I've never used GLUT before but used NeHe's code for creating a window and the OGL context. But now I've found myself using GLUT instead, which I'm not really comfortable with. It feels strange. Is it really this easy to use (create a couple of display/reshape/input functions, glutSwapBuffers and then compile)? Or am I missing something? Because it feels like I'm skipping most of the programming I've been doing the last year.

And more questions. What the H is GLUS? The Python script gave me a OGL3.2 context but now what? How do I proceed? What has substituted GL_MATRIXMODE and GL_PROJECTION? And why? Setting up shaders with GLUT? My god, I can't even figure out why the keyboard won't react to the "r" button on my keyboard (or turns my cube turqoise) with the keyboardfunc in GLUT.


I have learned the OpenGL core profile for several weeks. I use freeglut (codes from SVN), GLEW 1.5.4, GLM 0.9Beta2 on OpenSUSE 11.2 with Nvidia GTX260. After some hard work, everything is OK. It is necessary to call "glutInitContextVersion(3,3); glutInitContextProfile(GLUT_CORE_PROFILE);" and " glewExperimental= GL_TRUE;
GLenum err = glewInit();". This can make sure that freeglut and GLEW could work properly.

GL_MATRIXMODE and GL_PROJECTION have been removed from core profile. Firstly, uniform variables for model view matrix and projection matrix should be declared in vertex shader.Then we can compute the matrices using GLM which is really simple in the host application and set the values using glUniformMatrix4fv. You can find these codes in most samples.
The keyboard function should work well in freeglut. I am not sure what is your problem.


Quote:
Original post by tre
You see, it's quite a bit to catch up on. What I'm seriously considering is if it's really worth the trouble.

Input, please. I'm not really ready to quit my game programming aspirations just yet, but it's such a daunting task right now. Everything is new, and I have nothing to go by. I'm sort of fumbling in the dark here.

Sorry if this comes off as a crazed rant. I'm sure OGL is still as powerful (or more powerful) than ever before. It just took a turn for the worse for me. Too many changes, too soon.
The specifications aren't really helping me much. Just feels like Khronos is saying "we're so great since OGL can do this and this now and by the way 90 percent of what you've learnt is now pure crap". And then a list over deprecated functions. So I'm not really too hot for the specification just yet (however, note that I've not read all of it yet).


Although it is painful to forget the old functions and experiences, we have to go ahead to the future. Modern OpenGL pipeline is more flexible and powerful. I think it is worth working hard at it.


Share this post


Link to post
Share on other sites
tre    168
First off I'd like to ask forgiveness for the above post that I made. I got very, very frustrated and when I do I usually rant. However my point is still in there and very much alive: Why would anyone, no matter how much better it is with this new way of doing things, in their right mind change it all and then not give simple code with enough comments so that anyone who's been using OGL < 3.x could understand it? It is a very strange way of doing things, this. Changing it this much and then not provide enough information so that people are left spending hours, days, months to get it working.


Quote:
Original post by ZHAO Peng
Yes, I agree with you about the tutorials and samples. However, it is not very hard to read the sample codes and find the explain on the wiki (like VBO, VAO, UBO...).

I guess I got very frustrated. The sample code I've downloaded (nopper and the rest) run stuff I can't find information on. Say Nopper, those code samples run something called GLUS and I can't find documentation on it anywhere. Very strange.

Quote:
Original post by ZHAO Peng
I have learned the OpenGL core profile for several weeks. I use freeglut (codes from SVN), GLEW 1.5.4, GLM 0.9Beta2 on OpenSUSE 11.2 with Nvidia GTX260. After some hard work, everything is OK. It is necessary to call "glutInitContextVersion(3,3); glutInitContextProfile(GLUT_CORE_PROFILE);" and " glewExperimental= GL_TRUE;
GLenum err = glewInit();". This can make sure that freeglut and GLEW could work properly.

GL_MATRIXMODE and GL_PROJECTION have been removed from core profile. Firstly, uniform variables for model view matrix and projection matrix should be declared in vertex shader.Then we can compute the matrices using GLM which is really simple in the host application and set the values using glUniformMatrix4fv. You can find these codes in most samples.
The keyboard function should work well in freeglut. I am not sure what is your problem.

I'm trying to get this working with GLUT / FreeGLUT, GLEW in Vista x64 on a 8800GTX.
Where can I find documentation on FreeGLUT, then? How should I know that I need to run the InitContext and ContextProfile? And what does glewExperimental do? When I try to find information on that on google I just end up confused. Why is it necessary for OpenGL 3.x?
So when I've created an OGL 3.2 context I should create a shader pair, just the normal "here's the vertex" and "this is the fragment color" shaders? Or is it more advanced? What do I need to do at this point?
I've downloaded GLM now and I've been reading about it a bit. So setting the "position values" in main.cpp and sending them to a shader with a uniform would be allright?
Never mind the keyboard function, that's just got to be a part of my rant yesterday :)

Quote:
Original post by ZHAO Peng
Although it is painful to forget the old functions and experiences, we have to go ahead to the future. Modern OpenGL pipeline is more flexible and powerful. I think it is worth working hard at it.

I know. I want to move forward but can't seem to get a grip around how to walk. It's frustrating for me, but I'm going to move forward (or die trying it seems like). The new pipeline does look more flexible and powerful, but as an aspiring developer I don't want to see the GL shrouded in fog and difficulties. It should be open and clear. It doesn't have to be easy, but the more difficult something is, the better commented and documented it has to be. It would've made everything much easier.
I will keep trying to get this to work and try to be a part of the future.

Thanks for taking the time and answering my very long rant that I'm a bit embarrassed about today :)

Share this post


Link to post
Share on other sites
ZHAO Peng    108
Quote:
Original post by tre
First off I'd like to ask forgiveness for the above post that I made. I got very, very frustrated and when I do I usually rant. However my point is still in there and very much alive: Why would anyone, no matter how much better it is with this new way of doing things, in their right mind change it all and then not give simple code with enough comments so that anyone who's been using OGL < 3.x could understand it? It is a very strange way of doing things, this. Changing it this much and then not provide enough information so that people are left spending hours, days, months to get it working.

Actually, I also felt painful to meet so many new concepts and techniques like VBO, VAO,UBO...
After reading some materials, I have got initial understanding about them. The red book has been updated to the version 7 which covers OpenGL 3.0&3.1. If you could get one, it should be very useful. The books and other materials for OpenGL 3.2 or later should be published in the future. However, programmers could not wait so long. Sometimes learning these new techniques is like an adventure which could make me excited.

Quote:

Say Nopper, those code samples run something called GLUS and I can't find documentation on it anywhere. Very strange.

GLUS is just a very preliminary library written by Nopper for his OpenGL 3.2 samples. It is lack of many indispensable functions. It is not fair to ask him to build a great libary for us in a short time.:) Maybe it will become more mature. However, libraries like freeglut and qt should be used currently.

Quote:

Where can I find documentation on FreeGLUT, then? How should I know that I need to run the InitContext and ContextProfile? And what does glewExperimental do? When I try to find information on that on google I just end up confused. Why is it necessary for OpenGL 3.x?

In fact, I don't read the document of freeglut because most of the functions don't change. When move to the OpenGL3.2, I know it introduces the profile mechanism. So I search in the head file and find glutInitContextVersion and glutInitContextProfile. glewExperimental really upset me. When I use core profile, some functions could not be got by GLEW. I wasted several days for this problem. Finally I found glewExperimental=GL_TRUE in Nopper's samples. You can find the detail on the website of GLEW.

Quote:

I've downloaded GLM now and I've been reading about it a bit. So setting the "position values" in main.cpp and sending them to a shader with a uniform would be allright?

Yes, just compute the transform matrixes using GLM and send them to shader. In the vertex shader, vertex coordinates should be multiplied by these matrixes.

Quote:

The new pipeline does look more flexible and powerful, but as an aspiring developer I don't want to see the GL shrouded in fog and difficulties. It should be open and clear. It doesn't have to be easy, but the more difficult something is, the better commented and documented it has to be. It would've made everything much easier.

Maybe Khronos are too busy and other evolved companies don't want to put their effort into it. The only way is to wait for the books and better tutorials. But for me it is too slow.
Come on! Good luck!

Share this post


Link to post
Share on other sites
tre    168
First off, thanks Zhao for your replies. They give me hope as well as helping me move forward.

I've decided to go with a 50/50 approach to this, that is OpenGL 2.0 but I'll be leaning heavily on GLSL. Using this approach I should be able to get on better terms with both GLSL and VAO, VBO and whatever other abbreviations I need to learn. A good approach? Thoughts?

I'm also thinking of buying some more books. I've got the "OpenGL Game Programming" and "More OpenGL game programming" books. The new books I'm thinking of buying is "Beginning C++ Game Programming" and the "Orange Book 3rd Edition".
The "beginning"-book should prove useful however I decide to move forwards, but how is the 3rd edition of the orange book? Is it close to what I'll be doing in 3.2 and 4.0? I have found some information on it - that it's written with 3.1 in mind. How much does 3.1, 3.2 and 4.0 differ from each other?
Mainly, will I have to buy the fourth edition of the orange book just to get started in the programmable pipeline?

Thanks for taking the time.
Marcus Axelsson

Share this post


Link to post
Share on other sites
ZHAO Peng    108
Quote:
Original post by tre
First off, thanks Zhao for your replies. They give me hope as well as helping me move forward.

You are welcome. I am also happy to have a companion on the road to modern OpenGL.

Quote:

I've decided to go with a 50/50 approach to this, that is OpenGL 2.0 but I'll be leaning heavily on GLSL. Using this approach I should be able to get on better terms with both GLSL and VAO, VBO and whatever other abbreviations I need to learn. A good approach? Thoughts?


If you don't want to learn core profile purely, compatibility profile of OpenGL 3.2 or later should be good choice. It contains all the features of 2.0 and other more advanced functions.

Quote:

I'm also thinking of buying some more books. I've got the "OpenGL Game Programming" and "More OpenGL game programming" books. The new books I'm thinking of buying is "Beginning C++ Game Programming" and the "Orange Book 3rd Edition".
The "beginning"-book should prove useful however I decide to move forwards, but how is the 3rd edition of the orange book? Is it close to what I'll be doing in 3.2 and 4.0? I have found some information on it - that it's written with 3.1 in mind. How much does 3.1, 3.2 and 4.0 differ from each other?
Mainly, will I have to buy the fourth edition of the orange book just to get started in the programmable pipeline?


I am not familiar with the books of game programming. For the orange book, I think it is not very necessary when I looked through the first edition. It has too many pages. For programmers who are good at c or cplusplus, it is not hard to learn GLSL by reading the specification because the grammar is very similar. Maybe what we need is the application examples. If the third edition has good examples and application informations, it should be useful.

Good luck.

Share this post


Link to post
Share on other sites
Bregma    9214
One other suggestion is to learn OpenGL ES 2.0: it is very similar to OpenGL 3.0 core profile and there are plenty of resources out there for learning from.

Share this post


Link to post
Share on other sites
tre    168
Quote:
Original post by ZHAO Peng
If you don't want to learn core profile purely, compatibility profile of OpenGL 3.2 or later should be good choice. It contains all the features of 2.0 and other more advanced functions.


Didn't even think of the compability profile. Great idea.

And yeah, I agree. Modern application examples, thoroughly commented and documented would be the single best thing when it comes to learning GLSL. Well, save from school.

I want to lean the core profile, but I think I have too much other stuff to learn before I can dive into it. I'll be taking the long road instead, learning the things that are important for the core profile. I'll probably start up a couple of core profile projects just to see if I'm ready to move on yet or if I need to read even more.

I'll probably see if I can get my hands on the Orange Book since it at least covers GLSL which I could need. The C++ Game programming book seems like a great book for learning game logic and such. I'm on the hunt for more great books. I need more places to jump off from, so to speak.

Thanks again,
Marcus Axelsson

Share this post


Link to post
Share on other sites
tre    168
Quote:
Original post by Bregma
One other suggestion is to learn OpenGL ES 2.0: it is very similar to OpenGL 3.0 core profile and there are plenty of resources out there for learning from.


I will probably stick with OpenGL 3.2 compability profile for now. But thanks for the tip. I'll keep it in mind.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Similar Content

    • By pseudomarvin
      I assumed that if a shader is computationally expensive then the execution is just slower. But running the following GLSL FS instead just crashes
      void main() { float x = 0; float y = 0; int sum = 0; for (float x = 0; x < 10; x += 0.00005) { for (float y = 0; y < 10; y += 0.00005) { sum++; } } fragColor = vec4(1, 1, 1 , 1.0); } with unhandled exception in nvoglv32.dll. Are there any hard limits on the number of steps/time that a shader can take before it is shut down? I was thinking about implementing some time intensive computation in shaders where it would take on the order of seconds to compute a frame, is that possible? Thanks.
    • By Arulbabu Donbosco
      There are studios selling applications which is just copying any 3Dgraphic content and regenerating into another new window. especially for CAVE Virtual reality experience. so that the user opens REvite or CAD or any other 3D applications and opens a model. then when the user selects the rendered window the VR application copies the 3D model information from the OpenGL window. 
      I got the clue that the VR application replaces the windows opengl32.dll file. how this is possible ... how can we copy the 3d content from the current OpenGL window.
      anyone, please help me .. how to go further... to create an application like VR CAVE. 
       
      Thanks
    • By cebugdev
      hi all,

      i am trying to build an OpenGL 2D GUI system, (yeah yeah, i know i should not be re inventing the wheel, but this is for educational and some other purpose only),
      i have built GUI system before using 2D systems such as that of HTML/JS canvas, but in 2D system, i can directly match a mouse coordinates to the actual graphic coordinates with additional computation for screen size/ratio/scale ofcourse.
      now i want to port it to OpenGL, i know that to render a 2D object in OpenGL we specify coordiantes in Clip space or use the orthographic projection, now heres what i need help about.
      1. what is the right way of rendering the GUI? is it thru drawing in clip space or switching to ortho projection?
      2. from screen coordinates (top left is 0,0 nd bottom right is width height), how can i map the mouse coordinates to OpenGL 2D so that mouse events such as button click works? In consideration ofcourse to the current screen/size dimension.
      3. when let say if the screen size/dimension is different, how to handle this? in my previous javascript 2D engine using canvas, i just have my working coordinates and then just perform the bitblk or copying my working canvas to screen canvas and scale the mouse coordinates from there, in OpenGL how to work on a multiple screen sizes (more like an OpenGL ES question).
      lastly, if you guys know any books, resources, links or tutorials that handle or discuss this, i found one with marekknows opengl game engine website but its not free,
      Just let me know. Did not have any luck finding resource in google for writing our own OpenGL GUI framework.
      IF there are no any available online, just let me know, what things do i need to look into for OpenGL and i will study them one by one to make it work.
      thank you, and looking forward to positive replies.
    • By fllwr0491
      I have a few beginner questions about tesselation that I really have no clue.
      The opengl wiki doesn't seem to talk anything about the details.
       
      What is the relationship between TCS layout out and TES layout in?
      How does the tesselator know how control points are organized?
          e.g. If TES input requests triangles, but TCS can output N vertices.
             What happens in this case?
      In this article,
      http://www.informit.com/articles/article.aspx?p=2120983
      the isoline example TCS out=4, but TES in=isoline.
      And gl_TessCoord is only a single one.
      So which ones are the control points?
      How are tesselator building primitives?
    • By Orella
      I've been developing a 2D Engine using SFML + ImGui.
      Here you can see an image
      The editor is rendered using ImGui and the scene window is a sf::RenderTexture where I draw the GameObjects and then is converted to ImGui::Image to render it in the editor.
      Now I need to create a 3D Engine during this year in my Bachelor Degree but using SDL2 + ImGui and I want to recreate what I did with the 2D Engine. 
      I've managed to render the editor like I did in the 2D Engine using this example that comes with ImGui. 
      3D Editor preview
      But I don't know how to create an equivalent of sf::RenderTexture in SDL2, so I can draw the 3D scene there and convert it to ImGui::Image to show it in the editor.
      If you can provide code will be better. And if you want me to provide any specific code tell me.
      Thanks!
  • Popular Now