Archived

This topic is now archived and is closed to further replies.

kaiel090x

OpenGL
What exactly is OpenGL for anyway?

14 posts in this topic

Allright, OpenGL is obviosly a powerful API, but it mainly makes graphics. I want to program games, not make graphics(?!?!?!?!?!??!) Why should I need to know OpenGL? I really dont quite understand that. If the programmer makes the graphics in opengl, what does a graphic artist do? Please, someone explain this to me. Maybe its because I havent learned much of OpenGL yet, though I currently am, while reading my book, I was thinking to myself, "Why should I have to do all this, I just want to make it say hey attack now, rip his head off, feed him to the rabid monkees, and through his body to the zombies on the fourth floor." Thats just a ridiculus example(lol) but I mean, I dont mind dealing with the graphics, I just dont understand then what a graphic artist is for. "He who fights monsters should look to it that he himself does not become a monster... when you gaze long into the abyss, the abyss also gazes into you."~Friedrich Nietzsche Edited by - kaiel090x on August 19, 2001 3:03:33 AM
0

Share this post


Link to post
Share on other sites
OpenGL is an API for showing graphics already made BY artists, it''s not like Photoshop or anything like that, it''s used to show triangles, textures, make effects and things like that, an artists doesn''t need to know how to program to make the graphics, but is you are going to use OpenGL you NEED to know how to program.
0

Share this post


Link to post
Share on other sites
Basically, a graphic artist has to make the graphics. The programmer then has to get the computer to display those graphics on screen. This is what OpenGL and other APIs (like DirectX) are for. A graphic artist can make a 2D texture or something within a graphics program. But to use that in your game, you have to have some way of displaying that texture.

I think you''ve confused two things. Programming games doesn''t have to do with making graphics, but rather, displaying graphics. That''s why you would benefit from knowing OpenGL. Without using OpenGL, or another API, you''d have to write your own software routines for displaying graphics.
0

Share this post


Link to post
Share on other sites
Hi, kaiel090x!
Judging by what you said it seems to do a mod for an existing game (-engine) like q3 or ut would be more what you should be looking into. When programming a mod you don''t have to mess with opengl or directx instead you can load your models and write in your code
model->ripHeadOff(targetModell); //(veeeeeerrrryyyy simplified ;-)
Hope you get what I meen. This way you can concentrate on creating your models an maps and only have to code the game logics not the graphics routines.

baumep
0

Share this post


Link to post
Share on other sites
Actualy I want to make 2d games in OpenGL and C++, I know C++ and I am learning OpenGL(well, I know a decent amount of C++, the extremely advanced stuff I am still learning). But, im better off reading a book and actually learning openGL then just taking tutorials on 2d, cuz they assume you know some of OpenGL anyway, plus they are hard to find. I didnt understand why I should need to make the graphics for the game a program, because if I did what is the point of having a grafic designer? But I understand now, and I just dont agree with it, but if its what I have to do to be a programmer, I will do it. Its not muhc a of a deal. THank you everyone for answering my question.
quote:
Original post by baumep
Hi, kaiel090x!
Judging by what you said it seems to do a mod for an existing game (-engine) like q3 or ut would be more what you should be looking into. When programming a mod you don't have to mess with opengl or directx instead you can load your models and write in your code
model->ripHeadOff(targetModell); //(veeeeeerrrryyyy simplified ;-)
Hope you get what I meen. This way you can concentrate on creating your models an maps and only have to code the game logics not the graphics routines.

baumep




"He who fights monsters should look to it that he himself does not become a monster... when you gaze long into the abyss, the abyss also gazes into you."~Friedrich Nietzsche

Edited by - kaiel090x on August 19, 2001 1:21:27 PM
0

Share this post


Link to post
Share on other sites
quote:
Original post by kaiel090x
I didnt understand why I should need to make the graphics for the game a program, because if I did what is the point of having a grafic designer? But I understand now, and I just dont agree with it, but if its what I have to do to be a programmer, I will do it.

Er, what''s to disagree with? Artists do the art. They are in charge of something looks. The programmer is in charge of how it acts. Objects move around the map and obscure other objects. This is tracked in code. Therefore the code has to decide how and where to draw things, and what to draw. It''s just the same with sprites: the artist draws the sprite, but the programmer still has to tell the program when and where and how to draw it.
0

Share this post


Link to post
Share on other sites
quote:

I didnt understand why I should need to make the graphics for the game a program, because if I did what is the point of having a grafic designer? But I understand now, and I just dont agree with it, but if its what I have to do to be a programmer, I will do it.



Um, kaiel090x, I don''t think you''re quite understanding this.

OpenGL is an API, interfaced to by C functions, which is used by programmers to communicate with 3D hardware, basically to draw triangles. The graphic designer will still make the graphics in a 3D modeller such as 3DSMax. As the coder, you have to write the code needed to load and draw the objects the artist makes, which is where OpenGL comes in (with the drawing, anyway, not the loading).

If using an API is a problem, you''d better start learning ASM.


www.elf-stone.com
0

Share this post


Link to post
Share on other sites
I am sorry if you didnt quite understandme correctly. I know OpenGL is an API. I know what it can do, and I know whats its for. I said in m last response that learning it really isnt much a problem for me. What I DIDNT(notice it is dont anymore) was why the programmer has to screw with graphcs, I understand it now, PROGRAMMERS LOAD THE TEXTURES INTO THE TRIANGLES/ECT WE MAKE. Then we can control the graphcs.
quote:
Original post by benjamin bunny
[quote]
I didnt understand why I should need to make the graphics for the game a program, because if I did what is the point of having a grafic designer? But I understand now, and I just dont agree with it, but if its what I have to do to be a programmer, I will do it.



Um, kaiel090x, I don''t think you''re quite understanding this.

OpenGL is an API, interfaced to by C functions, which is used by programmers to communicate with 3D hardware, basically to draw triangles. The graphic designer will still make the graphics in a 3D modeller such as 3DSMax. As the coder, you have to write the code needed to load and draw the objects the artist makes, which is where OpenGL comes in (with the drawing, anyway, not the loading).

If using an API is a problem, you''d better start learning ASM.


www.elf-stone.com



"He who fights monsters should look to it that he himself does not become a monster... when you gaze long into the abyss, the abyss also gazes into you."~Friedrich Nietzsche
0

Share this post


Link to post
Share on other sites
quote:
Original post by Galileo430
2D? Learn Direct Draw.

Lots of nice books out there on it.

I think that kaiel090x has the right idea, OpenGL is postable to just about every system instead of being stuck on Windows.

0

Share this post


Link to post
Share on other sites
Just my 2 cents I think Opengl does a great job of doing 2d its really easy to do and you can get some nice sfxs going on too and its portable like ya guys said .
0

Share this post


Link to post
Share on other sites
al right, all right... Ok. I KNOW (cleaer to say printf or cout in front for some of ya? lol) that i CAN(see C_A_N- Can- being able to) do 2d, and I know its WORKS just as welll as Direct Draw, but I dont know HOW to put 2D into the game. But, a very great person, the best guy in the world, lol, ShiningKnight told me hes makin a tutorial SO i dcided just to wait till than. Thank for trying to help me

"He who fights monsters should look to it that he himself does not become a monster... when you gaze long into the abyss, the abyss also gazes into you."~Friedrich Nietzsche
0

Share this post


Link to post
Share on other sites
Hmm Im a bit bored so I''ll put in some info here.

OK, now assume you have some sprites that you want to animate in 2D [your characters/fighters/backgrounds/weapons/etc]. Your graphics are already drawn.

You have these drawn out already in something like photoshop and they are bitmaps [or JPEGS or whatever.. they''re images in some form]

Now you have to have something that puts it all together. Your program in C++ calls OpenGL in order to draw the pixels to the screen.

In the case of 3D, OpenGL is actually calculating the position, lighting, texturing/etc for each triangle. It is converting from the XYZ coordinates you specify into actual pixels that are to be displayed on the screen.

In the case of 2D, OpenGL allows you to draw and animate your existing 2D sprites. It will load in the images you have made and move them around the screen based on the instructions you give it. It can layer images [like putting a character on top of a background] or blend images together [using transparancy/etc]. You can rotate/scale the images, and tons of other stuff.

OpenGL is not what you use to create the images, it is what you use to display the final result.

The graphics artist will make the content that OpenGL uses to display on the screen, but the programmer must tell OpenGL how to use that content.

Anyway, hope this helps.
~Dom C.
binary1230
0

Share this post


Link to post
Share on other sites

  • Similar Content

    • By Ivy_ZH
      I want to use OpenGL to show a STL model . But why the picture look like in 2D ?  
      Public Sub CreateGLPannel(Pannel As PictureBox) Dim PixelFormat As GLuint Dim pfd As PIXELFORMATDESCRIPTOR With pfd .cColorBits = Bits .cDepthBits = 16 .dwFlags = PFD_DRAW_TO_WINDOW Or PFD_SUPPORT_OPENGL Or PFD_DOUBLEBUFFER .iLayerType = PFD_MAIN_PLANE .iPixelType = PFD_TYPE_RGBA .nSize = Len(pfd) .nVersion = 1 End With PixelFormat = ChoosePixelFormat(Pannel.hdc, pfd) SetPixelFormat Pannel.hdc, PixelFormat, pfd hrc = wglCreateContext(Pannel.hdc) wglMakeCurrent Pannel.hdc, hrc InitGL ResizeGLScene Pannel, 4000, 4000, 4000 End Sub Private Sub InitGL() glShadeModel smSmooth glClearColor 0, 0, 0, 0 glClearDepth 1 glEnable glcDepthTest glDepthFunc cfLEqual glHint htPerspectiveCorrectionHint, hmNicest Lighting End Sub Private Sub Lighting() Dim Specular(0 To 3) As GLfloat Specular(0) = 0.5: Specular(1) = 1.5: Specular(2) = 2.5: Specular(3) = 3.5 glMaterialf faceFrontAndBack, Shininess, 0.5 glMaterialf faceFrontAndBack, mprSpecular, Specular(0) glMaterialf faceFrontAndBack, AmbientAndDiffuse, 0 glEnable glcColorMaterial glLightf ltLight0, lpmPosition, -100 glEnable glcLighting glEnable glcLight0 End Sub Public Sub DrawPart() glMatrixMode mmModelView glLoadIdentity Select Case isfrontview Case True gluLookAt 0, 0, 0, 0, -1, 0, 1, 0, 0 Case False gluLookAt 0, 0, 0, 0, 0, -1, 0, 1, 0 End Select Select Case zoomcounter Case 1.5 glScalef 1.5, 1.5, 1.5 Case 2 glScalef 2, 2, 2 Case 2.5 glScalef 2.5, 2.5, 2.5 Case 3 glScalef 3, 3, 3 End Select glTranslatef gpQuadX, 1000, -800 glRotatef grQuadX, 1, 0, 0 glRotatef grQuadY, 0, 1, 0 glRotatef grQuadZ, 0, 0, 1 DrawPartList End Sub Private Sub DrawPartList() Dim i As Integer Dim Temp As Integer Dim TrangleCounter As Integer TrangleCounter = CInt((PartVertexCounter - 1) / 3) glColor3f PartColor.R, PartColor.G, PartColor.B glBegin bmTriangles For i = 1 To TrangleCounter Temp = (i - 1) * 3 + 1 glVertex3f Abs_PartVertex(Temp).x, Abs_PartVertex(Temp).y, Abs_PartVertex(Temp).z glVertex3f Abs_PartVertex(Temp + 1).x, Abs_PartVertex(Temp + 1).y, Abs_PartVertex(Temp + 1).z glVertex3f Abs_PartVertex(Temp + 2).x, Abs_PartVertex(Temp + 2).y, Abs_PartVertex(Temp + 2).z Next i glEnd End Sub  

    • By Freezee
      Hi, I'm 16 years old (nearly 17) french guy who loves coding, and pizzas, and music, and a lot of other things...
      I started learning some programming languages 6 years ago, and always failed to achieve something with them. Then I decided to re-try Java 2 years ago, and it went pretty well. So well that from this time I did not stopped programming. I really started to dig into C++ a year ago because I wanted lower level programming skills, with one specific goal: create games. Unfortunately I always overestimate myself and my ideas, and I've not been able to create a single real game because of my lack of experience in that specific domain. So I'm looking for a 3D FPS game project (multiplayer would be great too) to see how that kind of project is managed, and to finally be able to create something. I would like for once to work with other people on the same thing, I think it could really help me to help back the others. I have a lot of free time right now and I'm ready to spend some (if not a lot) into a project.
      I learned a lot of C++ features when I started, but I feel like I'm missing a lot of other features and I want to learn them on something useful.
      I really prefer not working on a project with a pre-used game engine (GM, UE, Unity, ...) because for me the most interesting part is what happens at the lowest programming level of a game. I learned basics of modern OpenGL so if there is a graphical engine to improve, I can work on it. I'm also very interested into working on the game engine structure, and on implementing a scripting language if it's needed. If the game is multiplayer, I will not guarantee that I could really work on that (because I really don't know a lot about networking) but I'll try my best to continue learning things and maybe work on that too.
      If you're interested, feel free to contact me on Discord: Freezee#2283. If you don't have Discord, reply back a way to contact you
    • By Jon Alma
      Some time ago I implemented a particle system using billboarding techniques to ensure that the particles are always facing the viewer.  These billboards are always centered on one 3d coordinate.
      I would like to build on this and use billboarding as the basis for things like laser bolts and gunshots.  Here the difference is that instead of a single point particle I now have to draw a billboard between two points - the start and end of the laser bolt for example.  I appreciate that having two end points places limits on how much the billboard can be rotated to face the viewer, but I'm looking to code a best effort solution.  For the moment I am struggling to work out how to do this or find any tutorials / code examples that explain how to draw a billboard between two points ... can anyone help?
      Thanks.
    • By Sagaceil
      It's always better to fight with a bro.
    • By recp
      Hi,
      I'm working on new asset importer (https://github.com/recp/assetkit) based on COLLADA specs, the question is not about COLLADA directly
      also I'm working on a new renderer to render (https://github.com/recp/libgk) imported document.
      In the future I'll spend more time on this renderer of course, currently rendering imported (implemented parts) is enough for me
      assetkit imports COLLADA document (it will support glTF too),
      importing scene, geometries, effects/materials, 2d textures and rendering them seems working
      My actual confusion is about shaders. COLLADA has COMMON profile and GLSL... profiles,
      GLSL profile provides shaders for effects so I don't need to wory about them just compile, link, group them before render

      The problem occours in COMMON profile because I need to write shaders,
      Actually I wrote them for basic matrials and another version for 2d texture
      I would like to create multiple program but I am not sure how to split this this shader into smaller ones,

      Basic material version (only colors):
      https://github.com/recp/libgk/blob/master/src/default/shader/gk_default.frag
      Texture version:
      https://gist.github.com/recp/b0368c74c35d9d6912f524624bfbf5a3
      I used subroutines to bind materials, actually I liked it,
      In scene graph every node can have different program, and it switches between them if parentNode->program != node->program
      (I'll do scene graph optimizations e.g.  view frustum culling, grouping shaders... later)

      I'm going to implement transparency but I'm considering to create separate shaders,
      because default shader is going to be branching hell
      I can't generate shader for every node because I don't know how many node can be exist, there is no limit.
      I don't know how to write a good uber-shader for different cases:

      Here material struct:
      struct Material { ColorOrTexture emission; ColorOrTexture ambient; ColorOrTexture specular; ColorOrTexture reflective; ColorOrTexture transparent; ColorOrTexture diffuse; float shininess; float reflectivEyety; float transparency; float indexOfRefraction; }; ColorOrTexture could be color or 2d texture, if there would be single colorOrTex then I could split into two programs,
      Also I'm going to implement transparency, I am not sure how many program that I needed

      I'm considering to maintain a few default shaders for COMMON profile,
      1-no-texture, 2-one of colorOrTexture contains texture, 3-........

      Any advices in general or about how to optimize/split (if I need) these shaders which I provied as link?
      What do you think the shaders I wrote, I would like to write them without branching if posible,
      I hope I don't need to write 50+ or 100+ shaders, and 100+ default programs

      PS: These default shaders should render any document, they are not specific, they are general purpose...
             I'm compiling and linking default shaders when app launched

      Thanks
  • Popular Now