It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
Is there a way to create a glass cup with OpenGL ES/OpenGl? And if it's possible, what can i read to start creating? Need to get the most realistic view of a glass, for example -
see glass cup image
For simplicity, without handles.
Maybe, anybody has example with sources?
Thanks.
Getting something that looks very close to the image you linked would be very complicated (the handle is not the hard part). If this is a learning project, I would suggest starting smaller. Rougher approximations would be a better starting place.
You can make a semi-transparent object easily in OpenGL ES. The OpenGL feature you want is Alpha Blending. This won't get you very close to your glass though. http://www.opengl.org/resources/faq/technical/transparency.htm
A basic level of replicating this object would be to use a hand-drawn grayish texture that looks sort of like the interior refractions and draw it on a camera-oriented sprite with partial transparency. Then render a regular cup-shaped model with high transparency with only a small amount of ambient and diffuse lighting and a lot of specular lighting to make it look shiny.
The multi-bounce refraction effect of a rounded glass object is much more difficult. Especially if you want it to look convincing when something other than a blank background is behind the cup. It's fairly straightforward to do in a raytracer, but not in a rasterizer like OpenGL. Look up Caustics. There are methods to approximate this effect but they are not beginner projects.
According to this there are some examples in GLUT if you're serious about it. http://www.opengl.org/resources/faq/technical/lights.htm
I know this post is over a year old , but i came across this post on the internet, which may help. (Its russian or whatever, use google translate to change it to english)
With programmable shaders it is possible to create nice glass effects, such as reflection combined with refraction. OpenGL ES 2.0 has programmable shaders, but OpenGL ES 1.X does not.
A good example of glass with OpenGL ES 2.0 comes with AMD RenderMonkey (free). Download here, and have a look at the glass examples.
Related
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I am using libgdx and I was wondering how to simulate a lamp.
What I mean is that I have a background texture and all the colors in it are pretty dark becuase it is suppose to a dark environment. What I want to do is to grab a region of the texture and make all the colors brighter like if it there was a lamp somewhere.
Now, the lamp is supposed to be moving and that will be calculated at run time so it is unpredictable to know where it would be, and the only thing that comes to my mind is to get every pixel from the texture and get the color and just change the rgb values to be higher to have that effect.
The thing is that the lamp is suppose to be moving a lot. It wont stop moving until the game is over and I feel that changing the color of every pixel is kind of a heavy process. Is there another way to it?
By the way, the game is a cartoon so I don't need the lamp too be realistic.
Could you instead layer an alpha blended transparency to darken the visible area except where the lamp is? I plan to use this to achieve a pseudo-lighting effect in a game.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I'm trying to learn OpenGL. I've got experience with C and C++, setting up a build environment, and all that jazz, but I'm trying to figure out a good starting point.
I'm aware of the fixed function pipeline that was prominent in OpenGL <= 2.1, and it seems relatively easy to get started with. However, the core profile that OpenGL pushes in OpenGL >= 3.1 makes me want to stay away from the FFP due to deprecation. But I'm confused as to how it all works in 3.1 and above. In 2.1 and below you have your glBegin(GL_WHATEVER) and glEnd() when you're drawing shapes. The first thing I noticed when looking through the core profile API, is that those two function calls are gone. I realize there's probably a simple replacement, but it's quite shocking to see something so (seemingly useful) taken out of such a basic task. It almost seems like deprecating printf() from the c standard library. And when I work through the newest Red Book, they still use the old deprecated code which further muddles my thinking.
When reading through various answers to similar questions I see the typical "shader based" or "it's all done with shaders" etc etc. If I want to draw a simple white square onto a black background (the first example in the newest Red Book), I don't understand how a shader is relevant to drawing a box at all. Shouldn't they do... well.. shading? I've looked into buying the Orange Book and the Blue Book, but I don't want to spend anymore money on something that's going to hide it all behind a library (the Blue Book) or something that's going to talk about programming a shader to perform some lighting task in a 3D environment (the Orange Book).
So where do I begin? How do I draw a box (or a cube or a pyramid or whatever) using nothing but the core profile. I'm not asking for a code snippet here, I'm looking for a expansive tutorial or a book or something that someone could point me to. If this has been answered previously and I didn't find it, please redirect me.
The reason for the sudden "complexity" in the core profile is the fact that the fixed functionality pipeline was not representative of what the GPU actually does for you. Much of the functionality was done on the CPU, and only the actual drawing happened on the GPU. The other problem with the fixed pipeline is that it's a losing battle. The fixed pipeline has sooooooo many knobs and switches! So, not only is it painfully complicated already, it will never keep up with the endless demand of new ways to draw scenes. Enter GLSL, and you have the ability to tell the GPU precisely how you want to draw your scene. This shifts the power to the developer and frees everyone from having to wait for OpenGL updates for new switches/knobs.
Now, regarding your frustration with the sudden loss of glBegin and glEnd... there are simple frameworks that mimic their behavior on the new core profile, and that is a good thing. Again, it shifts the power to developers to choose how they approach the pipeline. However, there is nothing wrong with practicing 3D on the FFP. You need to learn 3D math and concepts first anyway. Those concepts apply regardless of API. (Matrix math will save your life both in OpenGL and Direct3D.) So, first you practice with simple triangles and colors. Then you move onto textures (with texture coordinates). Then you add normals (with lighting). Then, after you understand all those concepts, you stop using glBegin/glEnd, and you start batching large amounts of vertex data into buffers. You will not understand glDrawElements all that well if you do not understand glBegin/glEnd anyway. So, it's OK to learn on those tools.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
Ive got a project for school that is to create the tanks game ( like worms or something else )
With a little research I found that the best way to create the 2D world would be to hold a bitmap of 1 and 0 to switch between background and foreground. So that I could load 2 images one for the background like the worms game the sea or something and another image with the map that is placed on it. Now because of that bitmap if I shoot something I could simply replace a 1 in a 0 so that there is a whole in the map..
With QT I could then just draw a canvas where I could display that bitmap.
I just don't find how to program this, maybe someone could help me out, where to start?
What you're describing with the 1's and 0's is called transparency and bitmaps can be made to encode this information in them, usually known as the alpha channel.
The key is to break down the problem into smaller parts and then tackle each small part - your question is very broad. So, break it down like this:
Create a window
Draw a bitmap on the window (no transparency - it's the background)
Draw a second bitmap with transparency
Modify transparency of second bitmap at run time
Although I think the qt is not the right tool for that, you can start with Graphics View Examples. That should give you a quick start.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I am creating a game that requires heavy use of 3D Models. I started using Blender for creating models. Here are some models which I came across while developing a model
I need to create a model of a Cube with Horizontal Grooves/Depressions and impart glow to those Grooves. I went through a blender tutorial which described how to impart glow to certain objects but I don't how to create a Cube with Grooves/Depressions.
Second Question is related more to the field of Graphics. What is Bloom effect ? Is it related to lighting models in any way? How do I impart it using Opengl and C++ ?
I can only try to help you with your second question, since I'm not experienced with blender. A Bloom effect is a graphical effect to visualize strong light sources. It is often implemented as a shader. The wikipedia article is actually quite interesting.
You should be able to find tons of tutorials for both OpenGL and DirectX respective their shader languages. A quick search provided these, which look promising:
http://prideout.net/archive/bloom/
http://doenemeier.de/2011/03-opengl-bloom-shader.html
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
i was reading opengl superbible, they were telling i can use the arrow keys to rotate the output and get a 3d view of the whole image
but i dont seem to get it........
Any new functions needed to be invoked?
Thanks in advance
First of all you have to understand the difference between the windowing library and the opengl context. In short, here is an overall summary.
OpenGL can be split in 2 parts:
The client
The driver
The client library is just a bunch of headers that you have to install. The driver is shipped with your graphic card.
The only thing that you can do is to manipulate an OpenGL context, that is, a set of buffers (frame buffers: color, depth, stencil, accumulation...) and states.
The context itself has no notion of "window" or "key". All it does is take some inputs, let it go through its pipeline, and save the output in frame buffers.
Next, there is the windowing system ( native ones: Win32, Cocoa, ..., or libraries built on top of it: Qt, GLFW, SDL, SFML, ... ) that provides windows, user input, drawings, etc... It is the windowing library that knows how to read OpenGL buffers and display them on screen.
So basically, all you have to do is to choose a windowing library, set up an OpenGL context, feed it with some inputs, and ask the window library to display the content on a canvas-like widget.
Give some more informations on what you're trying to do if you want more information.
Sides notes:
http://www.songho.ca/opengl/gl_pipeline.html for a description of the OpenGL rendering pipeline
http://www.opengl.org/sdk/docs/man/ for the OpenGL 2 reference manual
Look at these simple windowing libraries:
http://www.libsdl.org/ : SDL
http://www.sfml-dev.org/index.php : SFML
http://glfw.sourceforge.net/ : GLFW
http://www.opengl.org/resources/libraries/glut/ : GLUT
The OpenGL SuperBible doesn't bother including the entire program in the text of the book, just the pertenate code snippets that illuminate the topic at hand. Just download the complete source code at www.opengl.org/supperbible. Running these programs will give you the complete functionality described in the text of the book.
The OpenGL graphics library does not include user interaction functions such as moving the model with arrow keys. Another library or custom code is required to supply that functionality. The OpenGL SuperBible's sample programs use the GLUT library to supply user interaction functionality. The OpenGL SuperBible covers GLUT in addition to OpenGL, see chapter 2 for enough information on GLUT to understand the example programs.