Quake C and Open GL
-
daemonicky
- Posts: 185
- Joined: Wed Apr 13, 2011 1:34 pm
Quake C and Open GL
Is there any mod (engine...) where you can directly use opengl commands from Quake C? Is it even possible, Quake probably redraws scene after physics and quake c.
QuakeC is just a game logic scripting language, nothing else. It's entirely limited to the behaviours that are built into the engine, and you cannot go outside of those 4 walls.
Yes, Quake has a very specific order it does things in. Roughly put it goes like this:
Now think about it a little more. Even if you could make OpenGL function calls directly from QC (or CSQC), it is not desirable to do at all. Why not? Some reasons:
So back to the first point. QC is a game logic scripting language. It's not the be-all end-all do-everything solution-for-all-problems answer-to-all-requirements ("when you have a hammer everything you see looks like nails"). So use it for scripting game logic and leave enginey stuff to the engine.
Yes, Quake has a very specific order it does things in. Roughly put it goes like this:
- Send commands to server (SP).
- Run a server frame.
- Send commands to server (MP).
- Read from the server.
- Update screen.
- Finish up stuff.
Now think about it a little more. Even if you could make OpenGL function calls directly from QC (or CSQC), it is not desirable to do at all. Why not? Some reasons:
- OpenGL versions currently range from 1.0 to 4.1; if you make a call for a later version than the player has, interesting things might happen - like Quake crashing.
- The display is updated in a very specific order; you can't just throw in calls wherever you want.
- Some engines don't use OpenGL at all. What happens if the player is running an engine that uses software or Direct3D?
- QC is slow, rendering needs to be fast.
- OpenGL isn't just about making function calls. It also needs to work with complex and interesting data types, abstract objects, function pointers, a long long long list of #defines, arrays and structs, some operating system stuff, etc. You need to extend QC to support all these too.
So back to the first point. QC is a game logic scripting language. It's not the be-all end-all do-everything solution-for-all-problems answer-to-all-requirements ("when you have a hammer everything you see looks like nails"). So use it for scripting game logic and leave enginey stuff to the engine.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
We knew the words, we knew the score, we knew what we were fighting for
csqc has an extension where it is able to draw explicit polys where it wants, reminisent of glBegin/glVertex/glEnd, which typically uses whatever shader system the engine supports, but its not a complete opengl api. that's never going to happen. and definitely not for ssqc. there's a separation of responsibilities.
-
daemonicky
- Posts: 185
- Joined: Wed Apr 13, 2011 1:34 pm
Thank You all very much. 
mh : Thanks, for disadvantages list. I did not wanted fancy stuff, just some wireframe boxes and lines to visually debug (I use particles and prints now).
Spike : This "opengl" in CSQC is done in step 5, isnt't it? Is it commands which are inserted into some list in step 2 which is executed at step 5? Thanks.
mh : Thanks, for disadvantages list. I did not wanted fancy stuff, just some wireframe boxes and lines to visually debug (I use particles and prints now).
Spike : This "opengl" in CSQC is done in step 5, isnt't it? Is it commands which are inserted into some list in step 2 which is executed at step 5? Thanks.