Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8137217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:02:09+00:00 2026-06-06T11:02:09+00:00

I’m trying to implement OpenGL brush for mac os. Using GLPaint as sample. Main

  • 0

I’m trying to implement OpenGL brush for mac os. Using GLPaint as sample. Main trouble is that GLPaint is iOS application, and I need it on mac os. Somehow i almost edited it to work on MAC OS (well at least i think so), but it’s still not running. I guess, the main issue is in ‘EAGLContext’ and ‘NSOpenGLContext’ or maybe ‘OpenGL’ and ‘OpenGL ES’ differences. When I try to use ‘renderLineFromPoint:ToPoint:‘

  • [self renderLineFromPoint:vieta toPoint:buvusVieta];

it shows me error at

  • `glBindFramebuffer(GL_FRAMEBUFFER, viewFramebufferis);

with error code

Thread 1: EXC_BAD_ACCSESS (code=1, adress=0x1508)

Whole ‘renderLineFromPoint:toPoint:’ code bellow

- (void) renderLineFromPoint:(CGPoint)pradzia toPoint:(CGPoint)pabaiga
{
static GLfloat*     vertexBuffer = NULL; 
static NSUInteger   vertexMax = 64;
NSUInteger          vertexCount = 0, count, i;

[context makeCurrentContext];
glBindFramebuffer(GL_FRAMEBUFFER, viewFramebufferis);

//Convert from point to pixel
CGFloat scale = self.contentsScale;
pradzia.x *= scale;
pradzia.y *= scale;
pabaiga.x *= scale;
pabaiga.y *= scale;

//Vertex array buffer
if(vertexBuffer == NULL)
    vertexBuffer = malloc(vertexMax * 2 * sizeof(GLfloat));

//Add points to buffer at X pixels
count = MAX(ceilf(sqrtf((pabaiga.x - pradzia.x) * (pabaiga.x - pradzia.x) + (pabaiga.y - pradzia.y) * (pabaiga.y - pradzia.y)) / kBrushPixelStep), 1);
for(i = 0; i < count; ++i) {
    if (vertexCount == vertexMax) {
        vertexMax = 2 * vertexMax;
vertexBuffer = realloc(vertexBuffer, vertexMax * 2 * sizeof(GLfloat));
    }

    vertexBuffer[2 * vertexCount + 0] = pradzia.x + (pabaiga.x - pradzia.x) * ((GLfloat)i / (GLfloat)count);
    vertexBuffer[2 * vertexCount + 1] = pradzia.y + (pabaiga.y - pradzia.y) * ((GLfloat)i / (GLfloat)count);
    vertexCount += 1;
}

//Render vertex array
glVertexPointer(2, GL_FLOAT, 0, vertexBuffer);
glDrawArrays(GL_POINTS, 0, vertexCount);

//Show buffer
glBindRenderbuffer(GL_RENDERBUFFER, viewRenderbufferis);
[context presentRenderbuffer:GL_RENDERBUFFER];
}

Anyone could help me?

Or maybe someone could point me to similar sample code?

That would be very useful even if someone links me to tutorial where is explained such a thing as drawing in real time or etc. I have no problems with mouse events tracking and registering its points. I just need somehow to make OpenGL to draw line between two points or to draw for example circle at each registered point. Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T11:02:10+00:00Added an answer on June 6, 2026 at 11:02 am

    I solved my problem. I just had to use

    mouseDown
    mouseDragged
    mouseUp

    functions to register mouse events, and then call function [self drawSomething]; in witch was written what to draw and use coordinates witch was given me by ‘mouseDown’ ‘mouseDragged’ ‘mouseUp’.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I'm trying to create an if statement in PHP that prevents a single post
I have thousands of HTML files to process using Groovy/Java and I need to
Thanks in advance for your help. I have a need within an application to
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.