Menu
  • HOME
  • TAGS

Is ARB_texture_storage core profile?

c++,c,opengl,texture-mapping,arb

The functionality of ARB_texture_storage is a core feature since OpenGL 4.2, both in compatibility and core profiles. However, as this is a core feature, there is no requirement that the implementation advertises this also as any existension. In GL >=4.2, the glTexStorage*() familiy of functions is available and can be...

Mimic OpenGL texture mapping on CPU for reprojection

c++,opengl,graphics,texture-mapping,uv-mapping

You are on the right track. To select mipmap level or apply anisotropic filtering you need a gradient. That gradient comes naturally in GL (in fragment shaders) because it is computed for all interpolated variables after rasterization. This all becomes quite obvious if you ever try to sample a texture...

Can I get a texture onto my second cube?

javascript,webgl,texture-mapping

I think you might really find these tutorials helpful. In particular this one about matrix math. In particular it's not common to do so much matrix creation a vertex shader. Generally all your code about rx, ry, rz, posMat & sizeMat would typically be done in JavaScript and only the...

Opengl texture flickering when used with mix()

opengl,shader,texture-mapping,fragment-shader,terrain

Your problem is non-uniform flow control. Basically, you can't call texture() inside an if. Two solutions: make all the calls to texture() first then blend the results with mix() calculate the partial derivatives of the texture coordinates (with dFdx & co., there is an example in the link above) and...

DirectX11 How to CreateTexture2D from unsigned char * data

c++,graphics,directx,directx-11,texture-mapping

It depends on what the format of the actual content in that p is, as well as the width, height, and stride. Assuming the image is an RGBA 32-bit format with simple byte pitch alignment and sized as w by h, then it would be something simple like: D3D11_SUBRESOURCE_DATA initData...

Wrapping images around sphere

javascript,three.js,texture-mapping

Two problems in your code: you're not waiting for the images to load before rendering the scene you're having Cross-domain Policy problems (https://en.wikipedia.org/wiki/Same-origin_policy) so the images are actually never loaded ...

Open-GL Texture-coordinates changing by changing triangle size

c,opengl,textures,texture-mapping,texture2d

You can't avoid this, this is a rasterization rule and later a filtering rule (rounding of UVs from fragment coordinates), what people usually do in these cases is apply a dilatation on the texture only for the blue pixels, which means copying the nearest colored pixel for every blue pixel...

Three.js Merge objects and textures

three.js,textures,projection,texture-mapping,decal

You'd need to do some tricky stuff to convert from the model geometry space into UV coordinate space so you could draw the new pixels into the texture map. If you want to be able to use more than one material that way, you'd also probably need to implement some...

glTexImage2D fails with error 1282 using PBO (bad texture resolution)

opengl,textures,glsl,texture-mapping,texture2d

It is obvous that the image data you loaded is padded to generate a 4-byte alignment for each row. THis is what the GL expects by default, and what you most probably also used in your non-PBO case. When you switched to PBOs, you ignored that padding bytes per row,...

How to add textures to vertex buffer objects in OpenGL (2.1)

c++,opengl,vbo,texture-mapping,texture2d

Your texture coord pointer is wrong. The offset is in bytes. And the 3 bytes your are specifying are somewhere inbetween the x and y coordinate of your vertex positions. The correct value would be glTexCoordPointer(2, GL_FLOAT, sizeof(float)*5, (GLvoid*) (3*sizeof(GLfloat)) ); ...

How to pass two textures to opengl shader with qt and qglwidget

qt,opengl,glsl,shader,texture-mapping

glGetUniformLocation (...) operates on linked GLSL programs, not shaders. You might think that since uniforms appear in individual shaders they are specific to a particular shader object, but that's not the case at all. In fact, GLSL uniforms are not even assigned locations until all stages of a GLSL program...

How are textures mapped to 3D objects?

c++,opengl,3d,textures,texture-mapping

acos (dot ( N, L )) gets the angle between the vectors N and L this will be in radians so it needs to be divided by pi to get in the range texture() expects. All the actual texturing magic happens here fragColor = vec4 (texture (texture1, vec2 ( theta,...

Loading a texture by passing RGB floating point pixel data to glTexImage2D

c++,image,opengl,texture-mapping,texture2d

You access elements by the index that you calculate as: ( i * currentGrid.sizeWd() + j) + c Where c is a channel, and it takes the values of: 0, 1, 2. However, this expression likely to be wrong. From this expression follows that two neighboring texels have offset of...

OpenGL: Can't get textures to display

c++,opengl,texture-mapping

You HAVE to specify filtering for your texture: glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); Because default filter uses mipmaps, but you don't generate them....

Add text to an object(the white circle) in three.js

javascript,jquery,css,three.js,texture-mapping

Simple 3D text, i found it in an old file i had: you need the source too: <script src="http://mrdoob.github.com/three.js/examples/fonts/helvetiker_regular.typeface.js"></script> var MyWords = "Thomas Sebastian"; var shape = new THREE.TextGeometry(MyWords, {font: 'helvetiker',size:'24',curveSegments: 20, weight: 'normal',height : 4,hover:30}); var wrapper = new THREE.MeshPhongMaterial({color: 0x65676,ambient: 0x030303, specular: 0x009900, shininess: 30}); var words =...

Android 'white box' textures OpenGL ES 1.0 on some devices

android,opengl-es,texture-mapping,texture2d,render-to-texture

In Square class add function: public boolean isNPOTSupported(GL10 gl) { String extensions = gl.glGetString(GL10.GL_EXTENSIONS); return extensions.indexOf("GL_OES_texture_npot") != -1; } And when you Generate textures, add this: final boolean isNPOTSupported = isNPOTSupported(gl); if(isNPOTSupported) { gl.glGenTextures(mImageEntityList.size(), textures, 0); }else{ for(int i = 0; i < mImageEntityList.size(); i++){ gl.glGenTextures(1, textures, i); } }...

Stretch a texture across multiple faces using Three.js

three.js,texture-mapping

In order to strech the texture you need to map the UV accros yours multiple faces. JsFiddle :http://jsfiddle.net/Lg5vbzot/1/ Replacing with the following code var faceuv = [ new THREE.Vector2(0, 0), new THREE.Vector2(0, 0.66), new THREE.Vector2(1, 0.66), new THREE.Vector2(1, 0), new THREE.Vector2(0.25, 0.66), new THREE.Vector2(0.25, 1), new THREE.Vector2(0.75, 1), new THREE.Vector2(0.75,...

Openframeworks iOS project: texture on ofSpherePrimitive breaks

ios,opengl-es,rendering,texture-mapping,openframeworks

There is two possible solution to make this work: As per this openprocessing forum post making sure the generated main.mm starts using the iOSWindow setup like so: int main(){ ofAppiOSWindow * iOSWindow = new ofAppiOSWindow(); iOSWindow->enableDepthBuffer(); ofSetupOpenGL(iOSWindow, 1024, 768, OF_FULLSCREEN); ofRunApp(new ofApp); } In particular the enableDepthBuffer() seems important. The...

What's the difference between TMU and openGL's GL_TEXTUREn?

mobile,opengl-es,opengl-es-2.0,texture-mapping

I'm not the ultimate hardware architecture expert, particularly not for Mali. But I'll give it a shot anyway, based on my understanding. The TMU is a hardware unit for texture sampling. It does not get assigned to a OpenGL texture unit on a permanent basis. Any time a shader executes...

OpenGL switching between 2 textures

c++,opengl,textures,glut,texture-mapping

You can not call glBindTexture between glBegin and glEnd. GL_INVALID_OPERATION is generated if glBindTexture is executed between the execution of glBegin and the corresponding execution of glEnd. See glBindTexture documentation....

Looping a texture on a surface

c++,qt,opengl,textures,texture-mapping

This is very easy to do. Where you currently use texture coordinates in the range [0.0, 1.0], you simply use a bigger range. For example, to repeat the texture twice, as shown in your example, you specify texture coordinates in the range [0.0, 2.0]. This works in combination with using...

glTexSubImage2D does not work correctly

opengl,texture-mapping

glTexSubImage2D() is used to replace parts or all of a texture that already has image data allocated. You have to call glTexImage2D() on the texture at least once before you can use glTexSubImage2D() on it. Unlike glTexSubImage2D(), glTexImage2D() allocates image data. You can use NULL for the last (data) argument...

Texturing GL_QUADS with (3x3) color array ignores the 4th color in each row

arrays,opengl,texture-mapping

You need to set the GL_UNPACK_ALIGNMENT pixel storage parameter to make this work: glPixelStorei(GL_UNPACK_ALIGNMENT, 1); This controls the alignment of rows in the data passed to glTexImage2D(). The default values is 4. In your case, since each row consists of 9 bytes of data (3 colors with 3 bytes each),...

Texturing 3d Object with UV Map OpenGL

c++,opengl,texture-mapping,3d-rendering

glNormal3f(...); glVertex3f(...); glTexCoord2f(...); // this will affect the *next* vertex Wrong order. glVertex commands are used within glBegin/glEnd pairs to specify point, line, and polygon vertices. The current color, normal, texture coordinates, and fog coordinate are associated with the vertex when glVertex is called. You need to call glTexCoord() before...

How to use glDrawArrays with a Texture Array without shaders

python,opengl,texture-mapping,gldrawarrays

As the spec quote in the answer by @derhass shows, array textures are not supported without shaders. However, you can use 3D textures to do pretty much the same thing. You store each texture in a layer of the 3D texture. Then you use the first 2 texture coordinates as...

OpenGL C++ order for using a vertex buffer and a texture buffer

c,opengl,texture-mapping,vertex-buffer

You're misusing your second buffer which is supposed to be the buffer with texcoords. So what you really want to achieve is having a pair of texture coordinates for every vertex. It means that you texcoords array should in fact store 4 pairs because you have 4 triples in the...

Write to texture GLSL

c++,opengl,glsl,texture-mapping,render-to-texture

Just to be clear, you'd like to bake decals into your sphere's grey texture. The trouble with writing to the grey texture while drawing another object is it's not one to one. You may be writing twice or more to the same texel, or a single fragment may need to...