opengl-3

glLineStipple deprecated in OpenGL 3.1

…衆ロ難τιáo~ 提交于 2019-11-30 11:24:06
问题 glLineStipple has been deprecated in the latest OpenGL APIs. What is it replaced with? If not replaced, how can I get a similar effect? (I don't want to use a compatibility profile of course...) 回答1: Sorry, it hasn't been replaced with anything. The first idea coming to my mind for emulating it would be the geometry shader. You feed the geometry shader with a line, compute its screen space length and based on that you generate a variable number of sub lines between its start and end vertex.

VAO and element array buffer state

杀马特。学长 韩版系。学妹 提交于 2019-11-30 00:09:37
I was recently writing some OpenGL 3.3 code with Vertex Array Objects (VAO) and tested it later on Intel graphics adapter where I found, to my disappointment, that element array buffer binding is evidently not part of VAO state, as calling: glBindVertexArray(my_vao); glDrawElements(GL_TRIANGLE_STRIP, count, GL_UNSIGNED_INTEGER, 0); had no effect, while: glBindVertexArray(my_vao); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, my_index_buffer); // ? glDrawElements(GL_TRIANGLE_STRIP, count, GL_UNSIGNED_INTEGER, 0); rendered the geometry. I thought it was a mere bug in Intel implementation of OpenGL

gluPerspective was removed in OpenGL 3.1, any replacements?

浪子不回头ぞ 提交于 2019-11-29 20:26:36
I'm trying to read some OpenGL tutorials on the net. the problem is that I found some old ones that use gluPerspective() . gluPerspective was deprecated in OpenGL 3.0 and removed in 3.1. What function can I use instead? I'm using C++ with latest FreeGlut installed. Dan You have to compute the matrix manually and then pass it to OpenGL. Computing the matrix This snippet of code is based on the gluPerspective documentation . void BuildPerspProjMat(float *m, float fov, float aspect, float znear, float zfar) { float f = 1/tan(fov * PI_OVER_360); m[0] = f/aspect; m[1] = 0; m[2] = 0; m[3] = 0; m[4]

Using a matrix as vertex attribute in OpenGL3 Core Profile

雨燕双飞 提交于 2019-11-29 04:27:12
I am using OpenGL3.2 Core Profile on OSX. And I want to do instanced drawing (glDrawArraysInstanced), where I pass a matrix for each instance. My vertex shader builds just fine: #version 150 in mediump vec4 position; in mediump mat4 trf; in lowp vec4 rgb; out lowp vec4 colour; uniform highp mat4 modelcamviewprojmat; void main() { mediump vec4 tpos = trf * position; gl_Position = modelcamviewprojmat * tpos; colour = rgb; } The binding of 'trf' went fine: glBindAttribLocation(program, ATTRIB_TRF, "trf" ); But how can I pass in my data? glVertexAttribPointer can not pass values larger than 4

OpenGL 4.1 and 3.1+, What are key differences? [closed]

﹥>﹥吖頭↗ 提交于 2019-11-28 19:36:35
I understand that OpenGL 4 and 3 are fairly similar, especially 3.1 and 4.1. With both being essentially released together, it can be difficult to understand the rationale for OpenGL 4.0/4.1. In previous releases of OpenGL, minor version increments upward until substantial changes accumulated into a new major version. OpenGL 3.x and 4.x introduced backwards-incompatible API changes and then OpenGL 3.2 and 3.3 are said to be specifically branches of the 3 series which are not forward compatible while 3.1 is compatible with 4.1+ What key differences does OpenGL 4.1 offer compared with OpenGL 3.1

gluPerspective was removed in OpenGL 3.1, any replacements?

两盒软妹~` 提交于 2019-11-28 16:29:55
问题 I'm trying to read some OpenGL tutorials on the net. the problem is that I found some old ones that use gluPerspective() . gluPerspective was deprecated in OpenGL 3.0 and removed in 3.1. What function can I use instead? I'm using C++ with latest FreeGlut installed. 回答1: You have to compute the matrix manually and then pass it to OpenGL. Computing the matrix This snippet of code is based on the gluPerspective documentation. void BuildPerspProjMat(float *m, float fov, float aspect, float znear,

How to do ray tracing in modern OpenGL?

£可爱£侵袭症+ 提交于 2019-11-28 15:44:53
问题 So I'm at a point that I should begin lighting my flatly colored models. The test application is a test case for the implementation of only latest methods so I realized that ideally it should be implementing ray tracing (since theoretically, it might be ideal for real time graphics in a few years). But where do I start? Assume I have never done lighting in old OpenGL, so I would be going directly to non-deprecated methods. The application has currently properly set up vertex buffer objects,

OpenGL & GLSL 3.3 on an HD Graphics 4000 under Ubuntu 12.04

丶灬走出姿态 提交于 2019-11-27 19:48:34
I'm running that configuration : Ubuntu 12.04 Intel HD Graphics 4000 glxinfo give me that parameters: OpenGL renderer string: Mesa X11 OpenGL version string: 2.1 Mesa 8.0.4 OpenGL shading language version string: 1.20 OpenGL extensions: My goal was to run OpenGL 3.3 (and so GLSL 3.3). If I'm easy with development issues, I'm lost in hardware and drivers, so does someone knows a way to achieve that with my configuration? Unfortunally at this moment it looks like this is not possible, since the open source drivers provided by Intel are the only available. There is a version newer than yours

OpenGL 4.1 and 3.1+, What are key differences? [closed]

自作多情 提交于 2019-11-27 12:24:59
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . I understand that OpenGL 4 and 3 are fairly similar, especially 3.1 and 4.1. With both being essentially released together, it can be

OpenGL VAO best practices

Deadly 提交于 2019-11-27 05:58:15
Im facing an issue which I believe to be VAO-dependant, but Im not sure.. I am not sure about the correct usage of a VAO, what I used to do during GL initialization was a simple glGenVertexArrays(1,&vao) followed by a glBindVertexArray(vao) and later, in my drawing pipeline, I just called glBindBuffer(), glVertexAttribPointer(), glEnableVertexAttribArray() and so on.. without caring about the initally bound VAO is this a correct practice? VAOs act similarly to VBOs and textures with regard to how they are bound. Having a single VAO bound for the entire length of your program will yield no