Jump to content

  • Log In with Google      Sign In   
  • Create Account


Question about immediate mode


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 Chris528   Members   -  Reputation: 186

Like
0Likes
Like

Posted 04 July 2013 - 05:52 PM

I'm working on a simple opengl test app with sdl 2. I'm using opengl 4.2 and for some reason immediate mode still works after setting the app to use the core profile. Am i doing something wrong? Here's my current code on Pastebin.


Edited by Chris528, 04 July 2013 - 06:04 PM.


Sponsor:

#2 Arkhyl   Members   -  Reputation: 513

Like
0Likes
Like

Posted 05 July 2013 - 03:44 AM

You have to put thee three SDL_GL_SetAttributes before the context creation for them to be taken into account. Actually you create a GL context with default parameters, which is surely a forward compatible context.



#3 marcClintDion   Members   -  Reputation: 431

Like
0Likes
Like

Posted 05 July 2013 - 04:05 AM

You sound like you want it to fail... maybe if you could explain your logic in wanting this this to happen, if this really is what you want. 

 

Is your expectation that a core OpenGL 4.2 profile should fail when legacy code is used?

 

I suspect that the most reliable way to unsure this happens is to prevent the code from compiling to begin with.  You would likely have problems doing this if you are using an extension wrangler.  It's kind of hard to pull apart everything they attach to your program.

 

If, however, you decide to only use gl.h and a glext.h header files for initializing OpenGL, then you have pretty much full control with easy access to functions you want to omit. 

 

Search online for "OpenGL deprecated" then search for those functions and definitions in the above mentioned header files.  Manually delete everything that you do not want to support.  Add only what you do want to use.  What you can't remove you will know not to use.

 

Or you could hope that someone will do this for you seamlessly in the background.  Personally, I'd rather take control of this than leave it in the hands of others.


Consider it pure joy, my brothers and sisters, whenever you face trials of many kinds, because you know that the testing of your faith produces perseverance. Let perseverance finish its work so that you may be mature and complete, not lacking anything.


#4 Chris528   Members   -  Reputation: 186

Like
0Likes
Like

Posted 05 July 2013 - 04:44 AM

You have to put thee three SDL_GL_SetAttributes before the context creation for them to be taken into account. Actually you create a GL context with default parameters, which is surely a forward compatible context.

This brings up another question, is the context supposed to be created before or after the creation of the window? It crashes at runtime when I try to create the context first. According to the sdl_video.h header, SDL_GL_SetAttribute should be used before window creation.


Edited by Chris528, 05 July 2013 - 04:47 AM.


#5 Chris528   Members   -  Reputation: 186

Like
0Likes
Like

Posted 05 July 2013 - 04:51 AM


You sound like you want it to fail... maybe if you could explain your logic in wanting this this to happen, if this really is what you want.

 

I was just curious why my app still worked with immediate mode, when I thought immediate mode was dropped sometime after version 3.0. Was it working because I set the version and the core profile after creating the context? when I added that stuff before the creation of the window, the screen just showed up as black. Does that mean its working as intended now and is no longer registering the immediate mode stuff?


Edited by Chris528, 05 July 2013 - 04:55 AM.


#6 Brother Bob   Moderators   -  Reputation: 7744

Like
0Likes
Like

Posted 05 July 2013 - 04:58 AM

A quick look at some of the many tutorials widely available via your favorite search engine suggests that the call order (whether recommended or required, I don't know) is SetAttribute, CreateWindow and then CreateContext. In any case, as far as OpenGL goes and not related to SDL specifically, the window has to be created before the context.



#7 marcClintDion   Members   -  Reputation: 431

Like
0Likes
Like

Posted 05 July 2013 - 05:45 AM

I was just curious why my app still worked with immediate mode, when I thought immediate mode was dropped sometime after version 3.0.

 

It's always been my experience that if the code is in any way valid, nVidia, ATI, and Intel drivers will run it and even correct errors to the best of their abilities.  One of the design goals of OpenGL has always been backwards compatibility. 

 

Here is a page with people that are attempting to do what you are doing.  There are several extensions available to help you with this.

 

http://stackoverflow.com/questions/13062149/how-do-i-make-this-simple-opengl-code-works-in-a-lenient-3-3-and-4-2-profile

http://stackoverflow.com/questions/4693017/forcing-opengl-core-profile-only

 

You should consider what you are doing to be experimental with only limited truly real support.  The various video card manufacturers are not required to have fully implemented features in hardware before claiming that they meet the spec.  If the GPU's drivers can run a particular feature on the host CPU then they meet the spec so far as the "law" is concerned. 

 

It could be several years before all the various manufacturers really do have full hardware accelerated support that works consistently on all brands without huge portability issues popping up.  Unless you are interested in a particular 4.0+ feature such as 5 stage tessellation then you are asking for trouble by forcing a profile that has not been out in the wild for very long. 

Most of the example code that you find right now will be full of bugs, it will work on one GPU and not another.

This is likely why Apple appears to be behind the curve with support for these things.  It's often better to wait than to push something that will fail on someone's else's computer simply because that other person has a different driver or GPU installed.

 

If you do want to be a trail-blazer here, then just make sure you are constantly verifying everything you do on as many different GPU's as possible.  Check them all for stability as well as performance benefit. 

Try every possible method and extension to find the ones that work consistently across the board.  I'm not convinced that this is even possible at the current time with the 4.0+ specs.  We still have not seen this happen in the open source community with the 3.0-ish stuff.

 

It can take years for new technology to be decimated through the open source community in a form that is consistent and reliable,  but if you are one of the people who will help to pull this off then I say go for it. 

Just be forewarned and you will be mostly prepared is all I'm saying here.

 

Here is an example of what's going on here on a different thread for some 3.0-ish techniques.  You should expect much worse for what you are going after,4.0+ , but you can also learn from his method.  Just don't be so quick to blame one particular brand.  I have no doubt at all that some other person is having the reverse problem with both these companies.  It's the nature of forging a new path.

 

http://www.gamedev.net/topic/644327-custom-pseudo-instancing-faster-than-real-instancing-on-nvidia-cards/


Consider it pure joy, my brothers and sisters, whenever you face trials of many kinds, because you know that the testing of your faith produces perseverance. Let perseverance finish its work so that you may be mature and complete, not lacking anything.


#8 Brother Bob   Moderators   -  Reputation: 7744

Like
0Likes
Like

Posted 05 July 2013 - 06:34 AM

 


I was just curious why my app still worked with immediate mode, when I thought immediate mode was dropped sometime after version 3.0.

 

It's always been my experience that if the code is in any way valid, nVidia, ATI, and Intel drivers will run it and even correct errors to the best of their abilities.  One of the design goals of OpenGL has always been backwards compatibility. 

Backward compatibility was reset with the release of new version 3.0 API and the core profile, although you can create a compatibility profile up to 3.1 or 3.2, don't remember which, that allows you to run both the pre-3.0 and the post-3.0 APIs at the same time. In 3.3 and forward at least, that is no longer possible.

 

Since he's creating a 4.2 context (or rather, tried to), there is no compatibility with the pre-3.0 era and any such call shall fail.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS