Tag Info

New answers tagged

0

Looking at the problem further, it just seems to be an issue in darker areas. Adding just a low level of ambient light, such as in the attached image, resolves the issue. Maybe someone else can elaborate on the cause of the problem? I consider the issue resolved for the moment, as I always have some level of ambient lighting present, but further explanation ...


0

As I done in my project Seamles Noise Generator I suggest to apply a 3d noise (i.e. 3d perlin noise) on the cube surface and unwrap it like already suggested And use a cube sphere aproach


0

Please confirm that my other answer is not-at-all or, less-, applicable, so I can delete it. This is one way to "unwrap" a cube, (neglecting the bottom face (assuming there is a terrain of some kind)). (right-handed) For face 1: U+ corresponds to Y+ V+ corresponds to Z+ For face 4: U+ corresponds to X+ V+ corresponds to Y- and so on..


0

I have also successfully loaded a cube texture from file and applied it to my sphere and it looks awesome. This implies that you've already calculated the UV's on the CPU and stored them in the vertices. Those same UV's should work for any cube textures that are similarly oriented since they all range from 0:1. A diagram follows, in case it helps, but ...


0

So the tags [float_array id="Suzanne-mesh-positions-array" count="1521"] and [/float_array] contain the huge list of vertex positions right? Yes. And the tags [p] and [/p] inside [polylist count = "968"] and [/polylist] should contain vertex indices in triangular order right? But that doesn't make sense, cause then the first triangle is ...


0

they are stored in normalized GL_UNSIGNED_BYTE​s, a single color is 4 bytes, and are held under the KFbxLayer class and KFbxLayerElement class is the base class for Layer Elements and describes how all is arranged in memory. example layers KFbxLayerElementVertexColor KFbxLayerElementNormal KFbxLayerElementUV KFbxLayerElementTexture KFbxLayerElementMaterial ...


-1

The standard answer to "which is faster" is "profile it and see". Because everything varies a lot by platform, coding pattern, &c. (Method 2, with blending mode, might have direct hardware support... but you never know. Modern cards, behind the scenes, might do exactly the same work as you'd do with your shader.) Method 1 might, overall, "block" for ...


0

You just forget to enable vertex attrib with glEnableVertexAttribArray before calling glVertexAttribPointer int vertHandle = GL15.glGenBuffers(); GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vertHandle); GL15.glBufferData(GL15.GL_ARRAY_BUFFER, vertexBufferVAO, GL15.GL_STATIC_DRAW); **GL20.glEnableVertexAttribArray(0);** GL20.glVertexAttribPointer(0, 3, ...


0

Other information, the default constructor for the mat4 class is putting all the values to 0 This is incorrect. Your default matrix should be the identity matrix instead; i.e: 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1


5

If I have understood your question right, I believe you are asking if the tools you mentioned let you commercialize the games that you create using them. In that case, the answer is yes. Their licenses and terms and conditions are very generous. Here's what they give you: When it comes to OpenGL (licenced under MIT License) From Wikipedia Copyright ...


0

I found a solution to this. Conventional glReadPixels() blocks the pipeline and waits until all pixel data are transferred.Then, it returns control to the application. Thus we can overcome this by making glReadPixels() asynchronous . glReadPixels() with Pixel buffer object (PBO) can schedule asynchronous DMA transfer and returns immediately without stall. ...


0

I would recommend to check the lesson on perspective projection matrix on Scratchapixel http://www.scratchapixel.com/lessons/3d-basic-rendering/perspective-and-orthographic-projection-matrix/build-basic-perspective-projection-matrix It clearly explains that the why is to warp the view frustum space to a unit cube. Why? Essentially because the process of ...


5

While D3D doesn't support quad primitives, there's nothing in principle wrong with continuing to draw them as a triangle list. First thing to realise is that the index buffer used to simulate quads with a triangle list can always remain static, so you can create it once only (during startup), then just reuse it every time you wish to draw. The code to ...


3

First thing I would do is to figure out if any previous call to glCheckFramebufferStatus has failed. You are not calling glGetError at any point, which means you are probably missing a previous error that could help you figure out the problem. Make sure to add an error check after every previous GL call and log any error encountered. That will narrow down ...


5

There's no documented way to do this in Direct3D; it simply does not have support at the API level for quads as a primitive type. D3D doesn't have an extension mechanism like OpenGL does, but in some cases driver vendors support enabling certain kinds of "extended" features by passing certain combinations of invalid or otherwise-nonsense parameters to ...


1

Well.. sometimes you have to formulate a question and stop work until you find your answer yourself. In the evening I had some thoughts about resource management. We're talking about .Net ... thus a GC is involved. What if the finalizer thread comes along at a wrong time or state. Well - that would be actually a double fault. Not more right therefore, ...


1

The usual way to do this in openGL 2.1 would be to draw each one like this (pseudocode): applyCameraTransformation(); for sprite in sprites: glPushMatrix(); glTranslate3f(sprite.x, sprite.y, sprite.z); sprite.draw(); glPopMatrix(); However, notice that you now have many more draw calls, and each one has to send ...


1

Fixed, I didn't understand the meaning of off-screen rendering at the beginning. Just render the depth value stored in the texture into the default framebuffer for display, and everything work just fine. I can't believe I spent 5 days on this. gl.glBindFramebuffer(GL4.GL_FRAMEBUFFER, framebuff.get(0)); draw scene...(storing the depth value into the depth ...


4

According to the documentation for glutDisplayFunc(): Before the callback, the current window is set to the window needing to be redisplayed This means that inside the display callback, you can call glutGetWindow() to find out which window is being drawn to. This means that you can use a static member function as the display callback; just have ...


1

Yes, sending your mesh data to the GL every time you render it would be very wasteful. You should only be doing that if your data has changed from one frame to another (e.g. you are computing animations in the CPU). Otherwise, you shouldn't have to re-submit data if the model/mesh was not changed. Apparently, the problem with your program is that you are ...


0

What I'd do: Have your standard arrow draw from (0, 0, 0) to (1, 0, 0) (using a line) and the tip of the arrow be a triangle at the end (using a triangle, points at (0.95, 0, +/-0.025) and (1, 0, 0)). Then resize your arrow to the size you need with a scale matrix (since it's a unit vector, it's easy to have it the desired size) and then move your arrow to ...


1

They are not. Webgl coordinates refers to the positions of pixels in a canvas element and CSS describes the position of any HTML element in a page. You have to do math to apply the correct transformation if you wish align them. The default coordinate space for webgl is -1 being on one side of canvas and +1 on the other side (assuming viewport is same as ...


3

I was able to get the rotations expected by rotating an accumulated rotation matrix. setIdentityM(currentRotation, 0); rotateM(currentRotation, 0, angleY, 0, 1, 0); rotateM(currentRotation, 0, angleX, 1, 0, 0); // Multiply the current rotation by the accumulated rotation, // and then set the accumulated rotation to the result. multiplyMM(temporaryMatrix, ...


1

The point you draw is really a spot of the size you put on the screen. It has no volume. From opengl wiki: Points are rasterized as screen-aligned squares of a given window-space size. If you want to draw a point that changes size as you zoom in and out, you could Draw a point like you do but change the size as you zoom in and out (more complex ...


0

Thanks to @WolfgangSkyler for his answer (and also @Byte56 for his generous bounty), the problem was resolved yesterday by following your advice. This would not fit into a comment and I want to share further information about how the issue was resolved, but - of course - I will not un-accept WolfgangSkylers answer, just add to it. So now, as promised, what ...


1

first you transform the cannon ball into the coordinate space of the ship. Then you act as if you want to add the ball's model to the octree and step down through the nodes. If the ball straddles a boundary line then go through both sides. Once you get into a leaf not then there is the bucket with faces to test with.


1

You only have a set of 16 possible textures per-shader stage, so way 1 may get out of hand quickly. You have up to 80 possible unique binding locations in GL4 (16 * 5 stages = 80) and 48 in GL3 (16 * 3), but you can only use 16 of those in a single shader invocation. In truth, bindless textures, array textures and texture atlases have all been designed to ...


0

Yes you can detect this. If the determinant of the upper-left 3x3 part of the transformation matrix is negative, your model is flipped. Quoting this wikipedia page http://en.wikipedia.org/wiki/Back-face_culling: An odd number of reflections will leave triangle facing the other side, as if exactly after one reflection. Transformations containing an odd ...


0

This is an old question. However, in the interest of others seeking help with a similar problem, I believe I have a plausible solution: You could have a model prepared for smooth shading (without the duplicate vertices) and present an option of emulating flat shading through your pixel shader. It is possible to calculate the normal at a given pixel by ...


2

GIS systems actually use polygons for this kind of information, where each "ring" is a list of coordinates, so you can take the same approach. Once your borders are defined in a list of points, you can triangulate them, assign vertex colors, or even apply UV values in order to apply a texture. Then the same mechanics apply as with a 3D model. Polygons are ...


0

To use a cube map for shadows you need to recreate the world position of the pixel you are rendering and from that get the normal that points at that world position from the light source, now you can calculate the distance of your pixel from the light source as well as check the cube map for the distance to the first shadow casting object. Vertex shader ...


1

Your image corresponds with your rotationMatrix code, by rotating the x axis with your previous y rotation you get the local x axis, when you then rotate the object around that you would get the result that you show in your image. To have the rotation be logical from a users point of view you would want to rotate the object using the world coordinate axis ...


2

So with your provided problem image, the problem is that the top side of the quad is being affected, while the right side is supposed to have the majority of the effect? Is that correct? If that's the case then the problem is that your passing the wrong values to your ZHandler.getz function. Your code, from what I'm seeing, is: glTransform glBegin ... ...


3

The problem your having is called gimble lock. I think what your looking to do is called arcball rotation. The math for arcball can be abit complicated. A simpler way of doing it is finding a 2d vector perpendicular to the 2d swipe on screen. Take the vector and project it onto the camera near plane to get a 3d vector in world space. Screen space to World ...


0

For "modern" OpenGl, it's easiest to use all "custom" attributes, instead of a mix of classic built-in ones and your own. Add your own vec3 for "positionXyz" or whatever you'd like to call it, and so on. (For myself, I never pre-assign locations, just let OpenGl pick them has seemed sufficient for needs.)


2

You can, however, not if you'r vertices use distinct UV's for each side. Your example is, well, not the best. To use indexed VBOs, you need a few more vertices. For example, take a look at this Picture (found in google): As you see on the right, a lot of faces share their vertices and each vertex uses the same UV. The more vertices your model has, the ...


2

Hardware has not always supported floating-point texture formats. In fact, D3D has not always supported depth textures. When you see this sort of thing, it is usually because the application is trying to support an older API or older hardware. To store depth on these systems, they must be converted to fixed-point and packed into 4 channels of a traditional ...


1

To the best of my knowledge, still there isn't a function to toggle between windowed and fullscreen modes. Here is the listing of all functions provided by the library at the current version. Such feature might be added in the future though, if enough requests for it pop up. However, the window and the OpenGL context are two tightly coupled things, so ...


0

A Vertex Array Object (VAO) is an object which contains one or more Vertex Buffer Objects and is designed to store the information for a complete rendered object. You can think of it as being just a sort of parent to you VBO's, which are what store the real data. Binding a VAO just makes it easy for you, otherwise you would have to bind the buffers ...


0

Turns out to have been caused by a lwjgl bug I reported here.


4

To elaborate on OpenGL's future: OpenGL might achieve comparable performance to Vulkan, in draw calls per second, but also regarding general driver overhead: The most recent OpenGL extensions actually remove a lot of driver overhead by making everything bindless (e.g. ARB_direct_state_access (4.5 core), ARB_bindless_texture, ...). With persistent mapping ...


1

The answer is spread across the following links. Due to size constraints / requirements it had to be a Buffer Texture. Overview listing of possible technologies: http://stackoverflow.com/questions/7954927/glsl-passing-a-list-of-values-to-fragment-shader OpenGL reference to Buffer Texture: https://www.opengl.org/wiki/Buffer_Texture Different question but ...


0

Why do you need to convert the MVP matrix to a string? You could use the raw values even faster than you could parse a string. Furthermore, That doesn't supply you with enough information. That could tell you where the object is, how it's rotated, and how RELATIVELY large it is, it couldn't tell you how large it ACTUALLY is or where it could collide ...


2

I'm not an expert about it but I'll try to explain. When you compute per pixel lighting in camera space, you transform your normal map from tangent space to camera space. The idea of working in tangent space is to transform the camera and lights to tangent space then perform lighting computations. So instead of transforming normals from your normal map to ...


47

Vulkan is a new API for hardware-accelerated graphics (and general computation) via traditional GPUs. OpenGL will continue to be developed, as it is a higher-level API than Vulkan is intended to be. Originally referred to "glNext," one can infer that Vulkan was likely going to end up being "OpenGL 5," but that the standards body eventually decided that a new ...


2

When uploading shader source, you may provide more than one string. The lines of the strings are concatenated into the full text source for the shader compiler. You can thus emulate an include system (poorly) by putting the text of the required sources before the string with the main shader source. This is the origin of the numbers before the line numbers ...



Top 50 recent answers are included