110 questions
0
votes
0
answers
89
views
Updating a Vertex Array Tile Map?
I m trying to learn creating tilemap with vertex array.
I found a code from a tutorial and i read its necessary to use vertex array for creating huge tilemaps if we need optimal rendering performance ...
0
votes
1
answer
273
views
Unsure why 3x3 matrix as a vertex attribute in GLSL is not working
I am trying to make a simple 2D rectangle renderer in OpenGL. I'm storing transform of each rectangle as a 3x3 matrix inside a buffer object, and passing into my vertex shader as a vertex attribute. ...
1
vote
1
answer
94
views
How to refactor code from Vertex Array to Vertex Array Object methods
I'm studying Opengl and the book i've been using is OpenGL(R) ES 3.0 Programming Guide, 2nd Edition. And at chapter 6 they talk about Vertex arrays and they have a example code that uses Vertex Array ...
0
votes
0
answers
181
views
How would I draw a circle using an SFML vertex array?
For a university assignment, I need to draw various shapes using a vertex array, and one such shape that they have asked for is a circle.
I know that I would need to use sf::TriangleFan but I'm not ...
3
votes
1
answer
200
views
Rendering different models (with their own ELEMENT_ARRAY_BUFFER) without changing which VAO is used
I am trying to render multiple models sharing the same VAO and vertex format (following top answer on this post Render one VAO containing two VBOs), however I cannot get it to work with ...
2
votes
1
answer
722
views
Plane geometry, each segment different color, some of them transparent
I am using three.js and I want to create geometry 16x16 size. I want that each segment is different color and some of them is transparent. What is the best solution for this problem?
Should i render ...
1
vote
1
answer
267
views
c++ with openGl can't render
I try to make the code cleaner by extracting the whole main Proramm in some classes. So I have a vertex buffer, index buffer and a shader class. Only the array buffer is in the main and it worked.
Now ...
2
votes
1
answer
937
views
How do I get the indices of a vertex type object in ABAQUS?
Context:
I am trying to make a script in Abaqus that will automatically create partitions between vertices for all faces. The partitioning won't be perfect, but the users will be able to delete the ...
2
votes
1
answer
610
views
Is it ok to render Raycasting using vertex array?
Im making simple fps game using raycasting, because I thought its very fast and light method.
My Raycasting function saves data in to a vertex array, which is then rendered by OpenGl.
But because this ...
-2
votes
1
answer
622
views
Error when calling GL30.glGenVertexArrays();
i am trying to learn usinf opengl and lwjgl with java and i have amde a program and am trying to render some mesh but the class handling the Vaos and Vbos is faulty.After doing some research , i have ...
1
vote
0
answers
82
views
Motion field display on tile map SFML
I've tried to write a code that will draw a motion field by drawing green rectangles on a tile map everywhere where hero can go (hero can't move diagonally). It's very hard to me I have read: https://...
2
votes
1
answer
225
views
Corrupted data in vertex shader attribute location
My model looks stretched because of corrupted data in vertex shader attribute location
Here's the vertex shader code:
#version 330 core
layout (location = 0) in vec3 vertPos;
layout (location = 1) in ...
1
vote
1
answer
2k
views
C++ OpenGL, why isn't the vertex array binding the vertex buffer?
I'm pretty sure that the vertex array is not binding the vertex buffer because if I comment out the line where I unbind the vertex buffer it works perfectly fine, which suggests that the vertex array ...
2
votes
1
answer
281
views
Fastest way to draw dynamic GL_TRIANGLE_STRIP
After some effort, I managed to draw dynamic aircraft trail using OpenGL. You may see a part of my code below:
private void getTrailVertices(){
verticeBuffer = Buffers.newDirectFloatBuffer(6 * ...
1
vote
0
answers
92
views
How to assemble wavefront .obj data into element and vertex arrays of minimal size?
I'm having trouble putting the data inside a wavefront .obj file together.
These are the vec3 and vec2 definitions
template <typename T>
struct vec3 {
T x;
T y;
T z;
};
template &...
0
votes
1
answer
793
views
Using glBindVertexArray in update loop in DSA code or not
I'm the process of converting some opengl code to DSA and everywhere its written not to bind the vertex array, because its inherit in DSA. So I use
GLuint VBO, VAO, indexBuffer;
glCreateVertexArrays(...
1
vote
0
answers
94
views
OpenGL Vertex array not displaying properly
I have an OpenGL Graphics assignment and well for some reason I'm trying to create a flat square on the X,Z plane (Y is just 1.0 for every vertices). I've tried making the problem smaller by just ...
2
votes
1
answer
998
views
Render multiple pixels using OpenGL ES 2.0
To tell from the beginning, I'm very novice within OpenGL world but I need to use it for some rendering optimisations in Android. I have to render a block or a bunch of contiguous pixels in a 2D space ...
2
votes
1
answer
5k
views
SFML drawing primitives from VertexArray
How do I draw a primitive of my choice from a constructed VertexArray? In the example below I am adding two vertices to the 'vertices' array and I am trying to draw it with 'window.draw(vertices, 2, ...
0
votes
3
answers
2k
views
VertexArray of circles
I am wondering if it is possible to create a VertexArray of circles in SFML. I have looked for answers but I didn't find anything that could help. Moreover, I don't understand the part on the SFML ...
0
votes
1
answer
195
views
How do you flip texture in VertexArray?
I have a spritesheet animation drawn using a vertexarray. As an example let's say I have an arrow pointing to the right with a simple animation. I would like to be able to flip the texture on the x ...
2
votes
1
answer
563
views
Dynamic Lighting program with SFML, 1.6 to 2.x conversion
I found this sfml tutorial written back in 2009 and I'm trying to convert it to 2.4.
I haven't been able to convert these 2 lines:
win.draw(sf::Shape::Rectangle(le.Blocks[0].fRect, sf::Color(255, 0,...
1
vote
3
answers
340
views
OpenGL ES: Do vertex structs need x, y, AND z?
This is probably a stupid question, but I've been wondering it - do vertex structs in OpenGL NEED to have x, y and z? I'm drawing in 2D, yet all the tutorials I've seen seem to have a z variable in ...
1
vote
1
answer
683
views
Combining Primitives in SFML Vertex Arrays
The documentation for SFML states that you can combine primitives to create vertex arrays. I think what they are referring to is the fact that multiple Triangles can be grouped into a TriangleFan or ...
1
vote
1
answer
221
views
OpenGL array handover do not work
I am trying to program some game with OpenGL and read a whole bunch of tutorials. Unfortunately I got a small problem who just interrupts my progress.
I created a "Mesh" class where I handover an ...
2
votes
1
answer
1k
views
How to restore CCW winding order after reflecting vertices in the x or y axis?
I'm rendering a polygon in OpenGL with a vertex array called vertices and a final index buffer called DRAW_ORDER with CCW winding. I have back-face culling enabled, and I make draw calls using ...
0
votes
2
answers
518
views
How to have multiple storage layouts in one Vertex Array Object?
When I say storage layout, I mean what I define with glVertexAttribPointer. Is this state saved in the currently bound VAO or the buffer I bound to GL_ARRAY_BUFFER?
0
votes
0
answers
258
views
OpenGL 4.3+ element arrays
I'm building my own game engine in C++14 with a core OpenGL 4.3 back-end.
I'm following the following tutorials:
http://www.learnopengl.com/
http://antongerdelan.net/opengl/
I also follow these books:...
0
votes
1
answer
622
views
OPENGL: Square Class Using VBO
So, I am trying to make a basic "Drawable" class that handles a lot of the drawing for me in the background and I want to use modern OpenGL (no begin and end statements). I keep just getting a blank ...
0
votes
0
answers
558
views
Vertex Arrays with glDrawElements in jogl not rendering
I have tried following this and this to get vertex arrays from jogl to work and, although its not throwing any errors any more, it also isn't rendering anything but a blank screen. Here is the code:
...
3
votes
1
answer
2k
views
Opengl: How do I texture a model made with a vertex array?
I'm trying to get away from immediate mode because I keep getting told that it really isn't the best way to program in Opengl. I found a tutorial that will make a cube and colour it, but it doesn't ...
1
vote
3
answers
2k
views
Do I have to use glGenVertexArray in opengl
GLuint VertexArrayID;
glGenVertexArrays(1, &VertexArrayID);
glBindVertexArray(VertexArrayID);
As you can see from the above code, some tutorials use this before using opengl. But a tutorial that I ...
0
votes
2
answers
884
views
OpenGL texture coordinates being skewed when using vertex arrays
I have the following code to try to draw a rectangle using vertex arrays:
glEnableClientState( GL_NORMAL_ARRAY );
glNormalPointer( GL_FLOAT, 0, &mNorms[ 0 ] );
glEnableClientState( ...
1
vote
1
answer
388
views
WebGL - which API to use?
I want to draw multiple polygon shapes (where each shape has it's own set of vertices).
I want to be able to position these shapes independently of each other.
Which API can i use to set the ...
4
votes
1
answer
633
views
Generic vertex attribute buffer doesn't seem to work without glVertexPointer
I'm drawing an interleaved buffer - it is a generic vertex attribute buffer. The layout consists of three floats as a vertex coordinate, and two other float attributes, interleaved thus:
| float |...
0
votes
3
answers
1k
views
OpenGL - Indexed Draws with glDrawElements
I have a couple questions about how OpenGL handles these drawing operations.
So lets say I pass OpenGL the pointer to my vertex array. Then I can call glDrawElements with an array of indexes. It will ...
0
votes
1
answer
287
views
glDrawElements not working in the other machine
I'm using OpenGL with g++. This simple code works fine in my system. It draws a rectangle as expected.
GLfloat vertices[] =
{
0,0,0, //0
0,6,0, //1
6,6,0, //2
6,0,0, //3
};
GLint ...
0
votes
1
answer
158
views
Problems with Vertex Arrays
i'm trying to learn how to handle VBOs (VertexBufferObjects), but i can't get further than the Vertex Arrays. I followed some basic tutorials on this topic, each teaching a different way, making it ...
2
votes
0
answers
137
views
Merging polygons [duplicate]
Is there any fast algorithm to merge polygons together as in the image below?
Notice that new vertexes are created in the process.
Is there any way to achieve this fast enough as to implement it in a ...
2
votes
2
answers
765
views
Generating Smooth Normals from active Vertex Array
I'm attempting to hack and modify several rendering features of an old opengl fixed pipeline game, by hooking into OpenGl calls, and my current mission is to implement shader lighting. I've already ...
0
votes
0
answers
94
views
OpenGL Terrain 3D calcul normal summits -> blured
For a smoother surface appearance of the terrain, the solution will be to associate a single not normal to a triangle, but a normal to associate to each of three vertices of the triangle.
So, when I'...
0
votes
1
answer
349
views
gldrawelements bad access in xcode when used outside of GLKViewController
I'm pretty new to OpenGL ES, but all I'm trying to do is draw indexed vertices using glDrawElements in a Character class. I've gotten this to work before inside of my GLKViewController class, but when ...
0
votes
2
answers
789
views
OpenGL + Qt 4.8 is not drawing anything
I've been trying to use OpenGL in Qt with shaders and a simple vertex array. I basically want a plain to be drawn in the middle of the screen but nothing appears when I run the program. I'm basing my ...
0
votes
1
answer
152
views
In OpenGL 2.1, is it safe to use a 3D tex coord, even in 2d space (with a 2D texture)?
Can I use the 3D tex coord function for 2D textures by setting the Z value to 0 in OpenGL 2.1? Are there any 3D functions that I can not use for 2D? I can't use 2D functions because this is for a 2D/...
0
votes
1
answer
962
views
Bitmap fonts in SFML (OpenGL)
I'm writting a simple bitmap font renderer in pySFML and wanted to ask is there a better and faster way to approach this problem.
I'm using VertexArray and create a quad for each character in a ...
0
votes
1
answer
850
views
opengl VBO rendering doesn't work properly
At the beginning of my code I have initialized the vbo:
GLuint VBO;
then my vertex and color array:
GL float vertandcol[]={x1,y1, z1, r1,g1,b1, ...........,x3, y3, z3, r3,g3,b3};
Now I create and ...
0
votes
2
answers
522
views
Render a scene with openGL
I've to render a scene that include various mesh with openGL. the meshes are defined like this:
struct Mesh {
frame3f frame; // frame
vector<vec3f> pos; // vertex position
...
2
votes
1
answer
3k
views
OpenGL ES 2.0: Efficient Rendering of Static and Dynamic Vertex Data
I am writing an iOS/Android game and looking for the most performant way to render my vertex data with OpenGL ES 2.0. I have two different kinds of data: dynamic data that changes its attributes every ...
0
votes
1
answer
582
views
Not able to get output with glDrawElements() & glMultiDrawElements()
I'm in the process of building a graphics app where the user can specify vertices by clicking on a canvas and then the vertices are used to draw polygons.
The app supports line, triangle and polygon ...
0
votes
1
answer
2k
views
Drawing 3D polygon using vertex array
I have a short program which draw a 3D GL.GL_QUADS , here its display() method -
public void display(GLAutoDrawable drawable) {
....
gl.glBegin(GL.GL_QUADS); // of the color cube
...