opengl-3

How to create OpenGL 3.x or 4.x context in Ruby?

这一生的挚爱 提交于 2019-12-07 11:45:11
问题 I've looked everywhere, but there seam to be no ruby binding that would allow to create OpenGL 3/4 context. It do not have to be complete OpenGL binding library, just portion that creates OpenGL context. Update: If I'm desperate enough I'll do partial glfw ruby binding with ruby ffi. So pls save me from that ;) 回答1: I have written a library that can create an OpenGL 3 or 4 context on most platforms (provided it is supported). It's called Ray. You don't have to use its drawable system or DSL,

Picking triangles in OpenGL core profile when using glDrawElements

时间秒杀一切 提交于 2019-12-07 08:47:30
问题 I am drawing a mesh of triangles using glDrawElements and would like to be able to pick/select a triangle using the mouse click. The mesh of triangles can be very big. In fixed-function OpenGL there is the possibility of using GL_SELECT: http://content.gpwiki.org/index.php/OpenGL:Tutorials:Picking .. However I am only interested in using OpenGL core profile. Another possibility would be to use 'color coding': http://www.lighthouse3d.com/opengl/picking/index.php?color1 http://www.opengl.org

How do I make this simple OpenGL code (works in a “lenient” 3.3 and 4.2 profile) work in a strict 3.2 and 4.2 core profile?

安稳与你 提交于 2019-12-07 01:10:34
问题 I had some 3D code that I noticed wouldn't render in a strict core profile but fine in a "normal" (not explicitly requested-as-core-only) profile context. To isolate the issue, I have written the smallest simplest possible OpenGL program drawing just a triangle and a rectangle: I have posted that OpenGL program as a Gist here. With the useStrictCoreProfile variable set to false, the program outputs no error messages to the console and draws a quad and a triangle as per the above screenshot,

Arcball camera inverting at 90 deg azimuth

风格不统一 提交于 2019-12-06 12:35:34
I'm attempting to implement an arcball style camera. I use glm::lookAt to keep the camera pointed at a target, and then move it around the surface of a sphere using azimuth/inclination angles to rotate the view. I'm running into an issue where the view gets flipped upside down when the azimuth approaches 90 degrees. Here's the relevant code: Get projection and view martrices. Runs in the main loop void Visual::updateModelViewProjection() { model = glm::mat4(); projection = glm::mat4(); view = glm::mat4(); projection = glm::perspective ( (float)glm::radians(camera.Zoom), (float)width / height,

Precision qualifier throws an error for OpenGL 3.0 under Mesa 9.2.1

南楼画角 提交于 2019-12-06 11:06:55
A strange issue with OpenGL 3.0 under Mesa 9.2.1 on Ubuntu 13.10 (64-bit) is observed. Variable definition with explicit precision (like this: highp vec2 v; ) produces an error: syntax error, unexpected VEC2, expecting ',' or ';' It seems like precision qualifier is disabled there for some reasons. Mesa Release Notes doesn't clear the situation -- not bugs, nor notifications are relative to the topic. P.S. with OpenGL ES 3.0 precision qualifier works correctly. Make sure you specify #version 130 . Without a #version directive OpenGL will default to #version 110 where precision qualifiers are

In OpenGL, what is the simplest way to create a perspective view using only OpenGL3+ methods?

不羁的心 提交于 2019-12-06 11:03:12
This might sound lazy at first, but I've been researching it for 2 days. I have an SDL+GLEW app that draws a primitive. I wanted to make a few viewports in different perspectives. I see the four viewports but I can't change the the perspectives. Assume you have draw(); swapbuffers(); What is the simplest way - in OpenGL3+ spec - to create a perspective viewport (or ideally several ones)? The simplest is the only way. Calculate yourself (with some lib, plain math, etc) a projection matrix, and upload it to a uniform in your vertex shader, and do the transformation there. Here's GLSL 1.50 code

Render TTF SDL2.0 opengl 3.1

回眸只為那壹抹淺笑 提交于 2019-12-06 03:31:04
I'm working with SDL2.0, and using a (semi modern) opengl (3.1). I'm looking to add a text overlay to my application, and to render TTF in the application. How would I go about this using modern OpenGL? EDIT: As per the suggestion of genpfault, I've tried using the SDL_TTF library, but All I'm getting is garbage on screen http://i.stack.imgur.com/FqyCT.png I've attached a gist of my shaders, which are very simple for this program, and also the snipped I'm using to load the text into surface, and to bind it to the texture. I'm not trying to do anything crazy here at all. Is there anything I'm

OpenGL 3.x: Access violation when using vertex buffer object and glDrawElements(…)

拥有回忆 提交于 2019-12-06 02:29:48
问题 I have trouble rendering some geometry by using a vertex buffer object. I intend to draw a plane of points, so basically one vertex at every discrete position in my space. However, I cannot render that plane, as every time I call glDrawElements(...), application crashes returning an access violation exception. There must be some mistake while initialization, I guess. This is what I have so far: #define SPACE_X 512 #define SPACE_Z 512 typedef struct{ GLfloat x, y, z; // position GLfloat nx, ny

GLSL: “Invalid call of undeclared identifier 'texture2D'”

蓝咒 提交于 2019-12-05 19:44:32
问题 I'm on a Mac, using Swift, and using OpenGL 3.2. I'm also using XCode 6.1 Beta so I suppose that's the most likely explanation, because it doesn't seem to me like this makes sense. I can't find any evidence that this shouldn't be supported, but this fragment shader is resulting in the error Invalid call of undeclared identifier 'texture2D' during compilation: #version 150 uniform sampler2D usTexture; in vec2 vTextureCoord; out vec4 FragColor; void main() { vec4 color = texture2D(usTexture,

Picking triangles in OpenGL core profile when using glDrawElements

ぃ、小莉子 提交于 2019-12-05 17:13:22
I am drawing a mesh of triangles using glDrawElements and would like to be able to pick/select a triangle using the mouse click. The mesh of triangles can be very big. In fixed-function OpenGL there is the possibility of using GL_SELECT: http://content.gpwiki.org/index.php/OpenGL:Tutorials:Picking .. However I am only interested in using OpenGL core profile. Another possibility would be to use 'color coding': http://www.lighthouse3d.com/opengl/picking/index.php?color1 http://www.opengl.org/resources/faq/technical/selection.htm .. but as far as I know its not possible to indicate per triangle